OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Anton VonE on 18 Mar 2003, 20:42:01

Title: How can I break a loop after a few seconds have past?
Post by: Anton VonE on 18 Mar 2003, 20:42:01
The following is a great little snippet that will follow a unit. However, it follows it indefinately...how would I make it stop after 12 seconds?

Anton

;tracking.sqs created by: ???
_unit = _this select 0
_x = _this select 1
_y = _this select 2
_z = _this select 3
stoptracking = false

_cam = "camera" camcreate [0,0,0]
_cam cameraeffect ["internal", "back"]
_cam camSetTarget _unit
_cam CamSetFOV 0.7
 
#loop
~0.01
_cam camSetRelPos [_x,_y,_z]
_cam camCommit 0
? not stoptracking : goto "loop"


_cam cameraeffect ["terminate", "back"]
camdestroy _cam
exit

Title: Re:How can I break a loop after a few seconds have past?
Post by: Sui on 19 Mar 2003, 01:36:51
Well... you could change this line here:

? not stoptracking : goto "loop"

To look like this:

? _time < 12: goto "loop"

That will make the script destroy the camera and exit twelve seconds after the script starts running ;)
Title: Re:How can I break a loop after a few seconds have past?
Post by: Anton VonE on 19 Mar 2003, 02:58:48
Thank you so much for your help!

Anton