Jump to content
Sign in to follow this  
anthonyfromtheuk

Count and display how many times trigger has been activated

Recommended Posts

Looking around for this all I can seem to find is code to count units or alike but not how many times a trigger has been activated anybody point me in the right direction please? What I would like is a hint to pop up at the end of my mission showing how many times trigger X has been activated.

Share this post


Link to post
Share on other sites

Use a Variable and on activation give it myvariable = myvariable + 1

Share this post


Link to post
Share on other sites

I get what you mean but i have never used variables before, could you elaborate or link me to some sort of an example of variables in use please?

Share this post


Link to post
Share on other sites

That should make the trick:

http://community.bistudio.com/wiki/Variables

Imagine you want a trigger to activate when another one has been activated 10 times...

On init.sqf, add this: triggerCounter = 0;

Create the trigger you want to count their activations, set it to activate repeteadly, and on activation: triggerCounter = triggerCounter + 1; publicVariable "triggerCounter";

You can also add, just for more mission stability, in the condition place: this AND (triggerCounter < 10)

On the trigger you want to activate after ten times, on condition write: triggerCounter == 10

Hope this helps.

Regards

Share this post


Link to post
Share on other sites

Managed to figure it out myself. Set variable in the init

triggered = 0;

. My first trigger is grouped to my unit being present and set to repeatedly has this in activation

triggered = triggered +1; Anthony sidechat "Trigger set off";

And then my second trigger set with same settings and this in activation

hint format["Triggered %1 times",triggered]; 

and this in deactivation

Sleep 3; Hintsilent "";

Works like a charm ;)

Thanks for your help Tisor, much appreciated.

Edited by Anthonyfromtheuk
Was wiki that did it for me ;)

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  

×