Home   Help Search Login Register  

Author Topic: How to execute a script for a group of soldiers?  (Read 676 times)

0 Members and 1 Guest are viewing this topic.

kevind2003

  • Guest
How to execute a script for a group of soldiers?
« on: 27 Mar 2003, 00:17:04 »
Hi,

I'm using a script which let the soliders rope down from a chopper, using like this:

[Unit,Rope] exec "ropedown.sqs"

But I want a group of soliders to execute this script. How to do that?  ??? Thanks


The sqs file content:

_man = _this select 0

#loop

_height = (getpos _man Select 2)

_man setvelocity [0,0,0]
_man setpos [ getpos _man select 0 , getpos _man select 1 , _height - 0.2]

~0.01

? not alive _man : _man switchmove ""
? not alive _man : goto exit
? _height < 2 : goto "loop2"
? _height > 2 : goto "loop"


#loop2

_height = (getpos _man Select 2)

_man setvelocity [0,0,0]
_man setpos [getpos _man select 0 , getpos _man select 1 , _height - 0.08]

~0.01


? _height > 0.5 : goto "loop2"


? not alive _man : _man switchmove ""
? not alive _man : goto exit
? _height < 0.5 : _man switchmove ""
? _height < 0.5 : goto exit

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:How to execute a script for a group of soldiers?
« Reply #1 on: 27 Mar 2003, 02:55:39 »
"[_x,rope] exec {myscript.sqs}" foreach units mygroup
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

kevind2003

  • Guest
Re:How to execute a script for a group of soldiers?
« Reply #2 on: 27 Mar 2003, 05:13:16 »
"[_x,rope] exec {myscript.sqs}" foreach units mygroup

Thanks toadlife!  :D

But is this possible to execute the script every 1 second foreach units? (I don't want all the soliders rope down at same time  :-\)

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:How to execute a script for a group of soldiers?
« Reply #3 on: 27 Mar 2003, 08:10:57 »
Yeah but not with that example I gave you. PERHAPS you could modify the script just a bit like so:


[Unit,timetowait] exec "ropedown.sqs"

Code: [Select]
_man = _this select 0
_wait = _this select 1
~_wait

#loop

_height = (getpos _man Select 2)

_man setvelocity [0,0,0]
_man setpos [ getpos _man select 0 , getpos _man select 1 , _height - 0.2]

~0.01

? not alive _man : _man switchmove ""
? not alive _man : goto exit
? _height < 2 : goto "loop2"
? _height > 2 : goto "loop"


#loop2

_height = (getpos _man Select 2)

_man setvelocity [0,0,0]
_man setpos [getpos _man select 0 , getpos _man select 1 , _height - 0.08]

~0.01


? _height > 0.5 : goto "loop2"


? not alive _man : _man switchmove ""
? not alive _man : goto exit
? _height < 0.5 : _man switchmove ""
? _height < 0.5 : goto exit

Then to execute it you would do these two lines....

_wait = 0
"[_x,_wait] exec {script.sqs};_wait = _wait + 1" foreach units mygroup

In theory, it would make each soldier it executes the script for wait 1 more second than the last to start rapelling down. Give it a shot.
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.