Jump to content
Sign in to follow this  
james mckenzie-smith

Assistance requested: Looping triggers, with intervals, and how to stop them?

Recommended Posts

Greetings,

I would like to make a radio trigger that causes a unit to do an action looping until stopped by a second radio trigger, with a 2 second delay between actions.

In this case, the desired effect is:

_____________________

Radio Alpha activated

soldierOne action ["salute", soldierOne]

// 2 seconds of no saluting

soldierOne action ["salute", soldierOne]

// 2 seconds of no saluting

soldierOne action ["salute", soldierOne]

// 2 seconds of no saluting

etc.

_____________________

The whole loop would then be stopped by Radio Bravo. I have no idea how do this, to be honest, and I have searched (and learned lots of good stuff on the side!).

Could someone help this neophyte scripter? I'm being driven mental here...

Share this post


Link to post
Share on other sites

what you are looking for is global variables.

Asuming you got the anim loop.

My_variable = true;

when the above is set to true, f ex in your radio bravo trigger script, if you have a condition in the alpha radio trigger script that waits or checks for this to be true, it will respond.

Global_variable = true; // this one can be acessed by any scripts.

_Local_variable = true; // this one is only present inside its own script.

Note the _ in front of the local.

Why you would like your AI to salute then pause 2 seconds and repeat is beyond me, i asume it was just an example or you have a specific need, nontheless, you should look into while loops

// salute

run the animation in this line;

waituntil {(animationstate _unit) == "same_as_animation"};

_unit disableAI "ANIM";

waituntil {Global_variable}; // wait until radio bravo trigger global variable is true.

_unit enableAi "ANIM"; // will cause AI to finish animation.

Edit: i forgot to include the _unit in the animationstate check, but if you read the link on animationstate you would have seen that.

Anyway its corrected now.

Edited by Demonized
forgot to add in the _unit in animationstate

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  

×