OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: kevind2003 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
-
"[_x,rope] exec {myscript.sqs}" foreach units mygroup
-
"[_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 :-\)
-
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"
_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.