Jump to content
Sign in to follow this  
joeanorak

Detecting trigger activations in a script

Recommended Posts

How do you go about detecting a trigger activation in a script? Thus far I've got this:

titlecut [" ","BLACK IN",1]
_camera = "camera" camcreate [0,0,0]
_camera cameraeffect ["internal", "back"]

#loop
;=== 14:51:29
_camera camSetTarget man1
_camera camSetrelPos [0,1,0]
_camera camPrepareFOV 0.500
_camera camCommitPrepared 0
@camCommitted _camera

? v1=1; goto "end"
goto "loop"

#end
player cameraeffect ["terminate",""back"]
camdestroy _camera
end1=true;
exit; ]; 

I've set up a 'check' trigger to confirm v1 is being set to true (which it is) but the script doesn't appear to detect it. Any help in expanding my rather limited scripting palette would be appreciated!

Edited by W0lle
spoiler tags replaced by code ones

Share this post


Link to post
Share on other sites

Please don't use spoiler tags for code.

Modified your script as sqf, now waiting for v1 set to 1 and exiting then:

if (v1==1) exitWith {};

titleCut [" ","BLACK IN",1];
_camera = "camera" camCreate [0,0,0];
_camera cameraEffect ["internal", "back"];

while {v1==0} do
{
   showCinemaBorder false;
   _camera camSetTarget man1;
   _camera camSetrelPos [0,1,0];
   _camera camPrepareFOV 0.500;
   _camera camCommitPrepared 0;
   waitUntil {camCommitted _camera};
};

_camera cameraEffect ["terminate","back"];
camDestroy _camera;
end1=true;

Edit: Trigger or Variable activated, that is the question. If you really want to detect when a trigger has been activated then you need to work with triggerActivated, however if you actually mean wait until a variable has been set to true (or 1) then my script works.

Edited by W0lle

Share this post


Link to post
Share on other sites

W0lle, thanks for your help and apologies for the faux pas with the spoiler tags. You were spot on with realising what I wanted to do was wait until a variable was set true (it would seem my ability to describe problems is directly proportional to my lack of scripting ability)! Works like a charm.

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  

×