Jump to content
Sign in to follow this  
pd3

Only allow a trigger to run if another trigger has already executed.

Recommended Posts

Is there a fairly simple way of doing this?

I would like to create a mission in which you fight multiple waves of enemies that are spawned by triggers.

I'm thinking that the simplest way of doing this would be to basically "queue" the triggers in a way that only allows the next trigger to activate after the previous one has run.

Is there something simple I can add to one trigger and the next one in sequence to arrange this?

Share this post


Link to post
Share on other sites

One simple way to do this , is by using global variables.

-In the mission init.sqf or in any unit's init put Var1 = false

-In the first trigger On act. field put : Var1 = true.

-In the condition field of the 2nd trigger put : this AND Var1

Share this post


Link to post
Share on other sites

That is fairly simple. Just use variables.

In your first trigger add this to activation (trigger1 is the variable):

trigger1 = true;

In your second trigger change the condition from "this" to "this && trigger1";

You can easily chain multiple booleans that way.

A condition could even be as complex as this:

"(this && trigger1) || (this && trigger2 && !trigger3)"

&& = AND

|| = OR

! acts as negation

Share this post


Link to post
Share on other sites
triggerActivated

True, but only if the triggers are either set to "single activation" or if they're intended to be activated at the same time.

Share this post


Link to post
Share on other sites

Remember, when using variables make sure they are publicVariables. That allows it to be MP compatible.

Share this post


Link to post
Share on other sites

Thanks a lot for the help guys, I'm going to test that out when I get a spare moment.

Share this post


Link to post
Share on other sites

Okay, well it seems I've run into a snag as the transition time between the execution of the first and second triggers are basically instantaneous.

This is detrimental because the second trigger should activate based on what has been created with the first trigger, namely more enemies.

Basically, what I thought in theory would happen is that the first trigger would activate, spawn units, at which point the second trigger should only activate when all enemies of that side are no longer in the affected area, either dead or fleeing.

Unfortunately it seems that in the time it takes for the first trigger to spawn the enemies, the second trigger has more or less determined that there were no OPFOR there and ran anyhow.

Is there a simple way I can add a delay to the execution of the second and subsequent triggers to give the previous trigger time to generate the necessary AI?

-EDIT-

It seems setting the trigger to "countdown" can provide that appropriate delay.

Edited by Pd3

Share this post


Link to post
Share on other sites
Remember, when using variables make sure they are publicVariables. That allows it to be MP compatible.

Normally yes, but since regular triggers are run on all clients it isn't really necessary here.

Share this post


Link to post
Share on other sites
Okay, well it seems I've run into a snag as the transition time between the execution of the first and second triggers are basically instantaneous.

Use a second trigger with a 1 second countdown. So the first trigger condition "this" activation "a = true; b = true" (a being your main effect, whatever you want it to be) ... second trigger condition "a and this" on activation "c" (your secondary effect, whatever you want it to be), with countdown selected and 1, 1, 1 for the min, med, max time. Hope this works.

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  

×