Jump to content
Sign in to follow this  
burdy

Holding Trigger with condition

Recommended Posts

Hey, I am wondering how would I hold a trigger from firing if a condition is active (ex more then 350 units are on the map.)

Currently the triggers are this

Trig 1

Timeout 2000 seconds

Cond.: {alive _X && !(fleeing _X)} count thislist < 300

On Act: [xx] call DAC_Activate

Trig 2

Timeout 4000 seconds

Cond.: {alive _X && !(fleeing _X)} count thislist < 300

On Act: [xx] call DAC_Activate

The problem is, when the game loads up and the unit count is below 300, the trigger automatically fires when it hits the time. Is there a way to have the trigger do the countdown / hit the time, and then hold from firing until the condition is true [e.g after 10 mins, if there are more then 300 units on the map, the trigger will hold from firing until there are 299 - the time countdown begins off the start of the map, but it holds when it gets to the end of the timeout and waits until there are less then 300 units on the map, then fires.]

Share this post


Link to post
Share on other sites

I wouldn't use a trigger for this, but a script which is executed upon server initialization (init.sqf)

if (isServer) then
{
   [] spawn {
       waitUntil {(count allUnits) >= 300};
       while {true} do {
           sleep 2000;
           waitUntil {({alive _x && !(fleeing _x)} count allUnits) < 300};
           [xx] call DAC_Activate;
       };
   };
};

If you don't want to have an infinite loop (you didn't meantion if your trigger is repeating or not) you can just erase the while-part.

Share this post


Link to post
Share on other sites
I wouldn't use a trigger for this, but a script which is executed upon server initialization (init.sqf)

if (isServer) then
{
   [] spawn {
       waitUntil {(count allUnits) >= 300};
       while {true} do {
           sleep 2000;
           waitUntil {({alive _x && !(fleeing _x)} count allUnits) < 300};
           [xx] call DAC_Activate;
       };
   };
};

If you don't want to have an infinite loop (you didn't meantion if your trigger is repeating or not) you can just erase the while-part.

It's non repeating. So this will make the trigger start the countdown from 2000 when told so (in my case blufor present) and hold at the end of the countdown until there are less then 300 units left?

Just want to make my question clear -the triggers currently wait until there are less then 300 units to BEGIN there countdown, where I want it as I said above, where they begin the countdown off the bat and then hold at the end of it and wait for the condition to be true

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  

×