Jump to content
Sign in to follow this  
undercoverbrother

How to create a loop for a certain amount of time

Recommended Posts

Taking your question literally, this is what I do in cutscenes when I want the camera on a target for a certain time:

_limit = time + 4;
while {_limit > time} do
{
_camera camSetTarget spycar;
_camera cameraEffect ["internal", "BACK"];
_camera camSetRelPos [5,-12,2];
_camera camSetFOV 0.700;
_camera camCommit 0;
waitUntil {camCommitted _camera};
};

time is always the current number of seconds into the mission (or movie). So I create a var called _limit and set it however many seconds I want *beyond* current time, as in the first line above. Then the while loop runs for 4 seconds, basically, while _limit is greater than the current time in seconds.

If you have some other special need, let me know :)

Share this post


Link to post
Share on other sites

Thanks heaps man, you have no idea how much this will help and your example is the exact same situation I'm using the loop in as well. Thanks again :)

Edited by undercoverbrother

Share this post


Link to post
Share on other sites

Oops, I meant to start a new thread.

Edited by fatty86

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×