Home   Help Search Login Register  

Author Topic: Deployment issue  (Read 471 times)

0 Members and 1 Guest are viewing this topic.

Offline Wildebeest

  • Contributing Member
  • **
  • The time the wildebeest ruled the Earth.
Deployment issue
« on: 27 Nov 2004, 12:57:52 »
Here's a tricky question for you. Or maybe not.

I'm making a strategic mission in which you may deploy units on the map before the action. I have a cannon with gunner and commander, but also some guys standing around it, all in the same group. Now, when I move the gun to another position on the map I make the guys "teleport" to the same spot like this:

onMapSingleClick {"_X setpos _pos" foreach Units rGrp1;  rGunGrp3 setpos [(getpos rGrp3_1 select 0),(getpos rGrp3_1 select 1),-0.2]}

The rGunGrp3 is the cannon and rGrp3_1 is just a guy in the group making the cannon get to the spot where he appears. Prolly a better way of solving that, but anyway, here's the problem. The guys who are supposed to be standing spread out around the cannon instead end up inside it, since they were teleported to the exact same spot.

Is there a way of making them appear next to the cannon instead of inside it when they are "teleported"?

Thx guys, yer the best  :)
Weeee...

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Deployment issue
« Reply #1 on: 27 Nov 2004, 13:40:50 »
Yes.    The secret is to split the whole thing into two stages.   Stage 1 teleports a central unit, for example the gun, to the position clicked on the map.    Then you have stage 2, which teleports all the other units to a position which is described relative to the central unit.

You can't use a simple forEach command, you have to have seperate command for each unit since each one is going to a different place.

loon1 setPos [(getPos gun1 select 0) + 2, (getPos gun1 select 1) - 3, 0]

That's just a simple version and syntax is not guaranteed.
Plenty of reviewed ArmA missions for you to play

Offline Wildebeest

  • Contributing Member
  • **
  • The time the wildebeest ruled the Earth.
Re:Deployment issue
« Reply #2 on: 27 Nov 2004, 13:59:52 »
Thank you very much. That solved it.  :)
Weeee...