trigger_once_round

Counter-Strike CS
trigger_once_round by MistaX88
Posted 5 years ago2018-06-11 01:51:33 UTC • Examples • Counter-Strike
Loading...
Screenshot Thumbnail
Name
trigger_once_round
By
MistaX88 MistaX88
Type
Map
Engine
Goldsource
Game
Counter-Strike
Category
Examples
Included
BSP, RMF/VMF
Created
5 years ago2018-06-11 01:51:33 UTC
Updated
5 years ago2018-06-11 01:55:21 UTC
Views
2233
Downloads
531
Comments
1

Anyone who has mapped for Counter-Strike for more than a minute knows that entities aren't always the friendliest things to work with because they aren't all set up to reset on each round. One well known issue is that trigger_once only works once per map load, not per round, and trigger_multiple does not have the ability to be set once per round. It only has a time delay before reset.

This setup functions as a trigger once by utilizing the game_counter entity. Instead of using a trigger once, a trigger_multiple is set up with a short 1 second reset, but it's target is a game_counter which starts at 0 and fires it's target at 1. Leaving the "reset on fire" flag unchecked means that it will no longer fire when it is targeted by the trigger_multiple. To reset it at the start of each round, simply use the age old func_door method. Using an offsite func_door you can target a game_counter_set entity which targets the game_counter entity and sets it to 0. Since it will always set it to 0 regardless of it's current state, you won't run into issues if the entity setup never gets triggered on some rounds.

On this map, we have 4 entity setups.

The first 3 setups involve doorways with invisible triggers inside of them.

The first setup is simply a trigger_once targeting the func_breakable crate in front of it. It works as intended, but only once per map load, leaving it nonfunctional for the rest of the map.

The second setup is exactly the same only the func_breakable crate is now targeted by a trigger_multiple with a 5 second delay before reset. It works every round, but it also works on the same round, even if the crate already exploded, leaving a disembodied explosion and magically appearing pieces of broken wood.

The third setup is how we trigger it only once per round. A trigger_multiple with only a 1 second delay before reset, but, instead of targeting the func_breakable crate directly, it targets a game_counter starting at 0 and triggering at one. After getting triggered one time by the trigger_multiple it fires the func_breakable crate. You can walk through this trigger repeatedly on the same round and it will not fire again. Type kill in console to start the next round and you'll find the setup works again, just once, like before. Skip it for a round, or even a few rounds, and it will still work for you when you do trigger it again.

The 4th setup is an example of a slighly more complex setup. This time using a func_button as a plunger to trigger some explosives to blow up a door. A func_button doesn't reset each round, but has a delay before reset like the trigger_multiple. Here we've added another trigger. A successful bomb explosion will also blow up the door. But what if you already blew the door up with the plunger? Well, luckily, we use the same game_counter setup as before, except, instead of a single trigger_multiple targeting the game_counter, it is now targeted by both a func_button and a func_bomb_target on bomb explosion. The game_counter doesn't care what triggered it, it still functions the same way that it did before, it gets triggered, counts to 1, fires it's target, and then awaits a reset via func_door and game_counter_set on the next round start.

1 Comment

Commented 5 years ago2018-06-11 03:37:24 UTC Comment #101241
Good timing for this example, I added a link to this to the Tutorial: Counter-Strike mapping page since it's a common problem that people have when mapping for CS. Thanks for making it!

You must log in to post a comment. You can login or register a new account.