Jump to content
Sign in to follow this  
anthonyfromtheuk

Script triggered by how many times trigger set off

Recommended Posts

I would like to count how many times a trigger has been activated and use the count to effect how many times a random enemy spawn script is called.

So for example mission starts, trigger to call the script activation would be OPFOR not present. As its the first time the random enemy script would be called once.

Once those enemies are killed the trigger OPFOR not present will be activated again and the random enemy script will be called again this time twice.

After killing the second lot of spawned enemy the trigger OPFOR not present would be activated again and would call the random enemies script three times and so on and so forth...

How may I go about doing this?

Share this post


Link to post
Share on other sites

Set the trigger to repeatedly. Give the trigger a name (ie; sensor1) with any condition you like. Timeout = ~5 or so. Define a variable somewhere (init.sqf). So something like this:

init.sqf

trigActCount = 0;
execVM "script.sqf";

trigger:

onAct:
trigActCount = trigActCount + 1;

script.sqf

waitUntil {trigActCount == 1};
[arguments] execVM "someScript.sqf";

waitUntil {trigActCount == 2};
[arguments] execVM "someScript.sqf";
[arguments] execVM "someScript.sqf";

waitUntil {trigActCount == 3};
[arguments] execVM "someScript.sqf";
[arguments] execVM "someScript.sqf";
[arguments] execVM "someScript.sqf";
deleteVehicle sensor1;

---------- Post added at 10:35 ---------- Previous post was at 10:33 ----------

Updated info after I actually read your post and not just the title LOL.

---------- Post added at 10:39 ---------- Previous post was at 10:35 ----------

Oops, updated again. It may actually work this time :cool:

Edited by Iceman77

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  

×