Jump to content
Sign in to follow this  
Modinthalis

Worthless triggers

Recommended Posts

So I am trying to make a simple air support type script, which is activated by radio. Upon activation, a C-130J will fly to the area, activate a trigger, and spawn a bomb.

The problem is that I can't get the trigger to do anything apart from give hints. It doesn't spawn objects, move objects, run scripts, or anything useful. So how can I make the trigger spawn a bomb?

NOTE: I know that for cursorTarget to work Player must knowsAbout what he is pointing to.

Code:

_targetpos = getpos cursorTarget;

C130J2 flyinHeight 120;

C130J2 doMove _targetpos;

_trigger = createTrigger ["EmptyDetector", _targetpos];

_trigger setTriggerArea [15, 15, 0, false];

_trigger setTriggerActivation ["WEST", "PRESENT", true];

_trigger setTriggerStatements ["this", "hint 'Missile Inbound'; _cpos = getpos C130J2; sleep 0.3; _b1 = 'BO_GBU12_LGB' createvehicle _cpos;", ""];

Share this post


Link to post
Share on other sites

You can't sleep inside a trigger's callback (setTriggerStatement). Just spawn a new thread from there, which also helps readability quite a lot. Something like:

C130_action = {
  // do your sleepy sleepy and other stuff in here.
};

// ...
_trigger setTriggerStatements["this", "_nul = [] spawn C130_action;", ""];

Share this post


Link to post
Share on other sites
You can't sleep inside a trigger's callback (setTriggerStatement). Just spawn a new thread from there, which also helps readability quite a lot. Something like:

C130_action = {
  // do your sleepy sleepy and other stuff in here.
};

// ...
_trigger setTriggerStatements["this", "_nul = [] spawn C130_action;", ""];

That helped me with another problem - thank you!

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  

×