Jump to content
Sign in to follow this  
Koni

loops and conditions for scenes in sqf

Recommended Posts

Hey.

When making a movie scene in sqf, how do you first set a loop like the camera is following a unit until another condition is met, then will jump to the next scene ?

I use things like this in sqs, but I'd like to learn sqf.

#loop

_camera camsetTarget h1

_camera camsetrelPos [2,-5,1]

_camera camPrepareFOV 0.700

_camera camCommitPrepared 0

? UnitName distance UnitName <=10 : goto "nextscene"

goto "loop"

#nextscene

But I can't get my head round the sqf version.

Can anyone help please :)

Share this post


Link to post
Share on other sites

Yes as Kylania said, you can use wait until, or you can use while {condition}

Here..

unitName doMove getPos unitName2; //Moves unitName to unitName2

while {unitName distance unitName2 > 10} do //While the unitName is greater than 10 meters away from unitName2 do
{
[indent]_camera camsetTarget h1;
_camera camsetrelPos [2,-5,1];
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 0;[/indent]


};

// When unitName is 10 or less meters away from unitName2 the while {condition} will stop and carry the script on.

waitUntil {unitReady unitName}; //Waits until unitName is ready (stopped)

unitName attachTo [unitName2[0,0,2]]; //Attaches unitName to unitName2

unitName2 doMove getMarkerPos "ManOnMyHead"; //Moves unitName2 with unitName on his head to the position of the marker called ManOnMyHead

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  

×