Additive Triggers
by Stadric (view all articles)

unrated
Using Math_Counters To Trigger Single Events From Multiple Triggers
by Stadric (view all articles)

unrated

Additive Triggers
Sometimes you want the player to make something happen (eg. explosions, enemy invasions, etc.) but you want him to do more than just step into a cerain room, or push a certain button, to make it happen. Sometimes you want the player to hit multiple buttons, or step into multiple triggers; well that's where this tutorial comes in.
I am going to show you how to, in this case, release your rebel friends by doing a panoply of things, all by using a math_counter.
I made a map for this tutorial, without the part you care about completed. It's the rudimentary part of the example I will be showing you, so download it from here.
Everything in the map is set, except the ending sequence, which is triggered by a logic_relay. All we have to do is activate that, and then the ending sequence will begin.

The Example Map
Now that we have a basic setup, it's time to make something happen.
See the two hills? Put a func_button on each hill.
Name one button1, and the other button2.
Check the "don't move" flag for each of them
Change delay before reset: -1
Now make a math_counter, and name it counter
Maximum Legal Value: 2

Now give it this output:

Now give each of the func_button entities this output:

Now compile the map. What happens is that after you've pressed both buttons, the door opens, and the citizens inside walk out.
What happens is that when you press a button, it adds 1 to the math_counter (it starts out at 0). The math_counter's maximum value is two, so when both buttons are pressed, it fires its output, which opens the door and releases the citizens.
Now compile and run the map.
*If you learned anything from the above, you don't need to continue*
Now here's another example. Within the same map, place a game_text entity, an env_fade entity, and another math_counter entity.
Env_fade:
Name: fade.
Hold Fade(seconds): 10000.
Game_Text:
Name: text.
Message Text: Congratulations.
Hold Time: 10000.
Math_Counter:
Name: counter2.
Maximum Legal Value: 2.
Give your second math_counter these outputs:

Make two trigger_once entities around the scripted sequence entities already in the map.

Check the "only player ally NPCs" flag, and uncheck all the other flags.
Now give both triggers this output:

Normally I would use the output "OnEndSequence" from a scripted_sequence, but I've found it doesn't work the way I want it to(IE: at all), so I used the method I used
Now compile and run the map, and see the effects!
EDIT:
Due to popular demand, I have added an example map of the full-version of the map in this tutorial.
Linkage