quake2 - trigger_once, trigger_multiple, trigger_always, trigger_counter, trigger_relay, target_earthquake

This tutorial is over the entities that are used to trigger actions into happening, as well as the target_earthquake entity. Triggers are probably the most used entities of all and I guess that means you should know everything about them or something. =) As you will see they are all pretty easy to use and understand. The first trigger we will go over is the trigger_once entity. If you have any editing experience at all then you probably know how to use this entity. What it does is triggers an event when another entity such as the player or a monster(we will go over this in a minute) touches it, but only 1 time. One thing you should know when making the brush that will be the trigger_once is that all the trigger entities that we are going to go over in this tutorial are not visable in the level so it doesn't matter where you place them. Also it is good editing practice to give the trigger_once or any other non visable brush the trigger texture. This makes it easier to see and organize in your level editor. The key value pairs for trigger_once are target, targetname, killtarget, sounds, message, and delay. Target is the name of the corresponding targetname that will be triggered when the trigger_once is touched by the player or a monster(see below). So if you want the trigger_once to open a door then you need to give the door a targetname of something like door1 and then set the target of the trigger_once to door1. Sounds is the sound that the trigger will play when the trigger_once is touched. This can be set to 0,1,2 or 3. Each corresponding to a different sound. 0 is the default "beep beep" sound and 3 is no sound. If you use 3, you will get an annoying but harmless error message in the game saying "couldn't load sound/misc/trigger1.wav" but the trigger will still work and won't make any sound. This is due to a bug in the entity code. If you open the PAK file, you will see that sound/misc/trigger1.wav doesn't exist and that's the reason why the game complains. Message will print to the screen whatever it is set to when the trigger_once is triggered. So if you want the trigger_once to print "door was opened" then you would set message to "door was opened". Pretty simple. Remember to use \n to break to the next like or you will run out of space. Delay is the amount of time between the touching of the trigger and the actual triggering taking place. So if you have a trigger_once targeted to a target_explosion, setting delay=2 will create a 2 second delay between the touching and the explosion. Targetname is used along with the triggered spawnflag (see below). Killtarget will remove any entity that has a matching targetname. You can target pretty much any entity you want with this, including monsters. If you target a monster with killtarget, it won't gib or anything, it will just disappear. The 2 spawnflags that can be turned on for a trigger_once are not_player and triggered. not_player is not listed on any of the entity references but it is there. Just set the spawnflag 2 and not_player will be turned on. What not_player does is makes it so the player has no effect on this trigger_once. Something like a monster must touch it and trigger it. This can be used for a variety of cool things. A monster could trigger a trap on the player or could spawn more monsters that would actually come to the place of the trigger. This could give the effect of the monster calling for reinforcements. Very cool. The triggered spawnflag makes it so the trigger_once must be triggered itself to be turned on. So therefore, if this spawnflag is on then the trigger_once must have a targetname. What you should remember though is that the trigger_once that is triggered by another entity will NOT actually trigger its own targets when it is triggered. The trigger_once will only become "live" or "enabled" if you will. So after it is triggered, the player will have to touch it for it to trigger its targets. That sure was a mouthful. =) That's about as easy as I can explain it though. An example of a way to use this is the following: Lets say that you have a huge level in which the player walks across a bridge to get into the strogg base. Later near the end of the level after he defeats the boss alien he unknowingly walks across a trigger_once that in turn makes another trigger_once near the bridge live. The player now has to exit the base and walk back across the same bridge. Well..the trigger_once that was just made live triggers the bridge to explode as the player is walking over it and he falls into the river getting into more trouble. Hope this kind of helped. I know it's kind of stupid though. hehe. The trigger_multiple works in basically the same exact way the trigger_once does except for a few minor details. First of all, it can be triggered multiple times instead of just once. It also has 1 more key value pair and 1 other spawnflag. The new key value pair is wait, which determines the amount of time to wait before the trigger will trigger its target again when touched by the player. An interesting thing to note is that if you assign a value of -1 to this, you will effectively have transformed your trigger_multiple into a trigger_once. Not much point in doing that but anyway... :-) The new spawnflags is monster. What monster does when enabled is allows a monster or the player to use the trigger. This is opposed to not_player which allows only monsters to use the trigger. For some reason the spawnflag monster does not work for trigger_once. Strange. As for all the other keys and spawnflags, just look at the trigger_once. They behave in the same way except for the 3 differences I mentioned above. trigger_always is just a trigger that is always on and starts on when the level begins. The other keys you can set are target, killtarget and delay (default 0.2). trigger_counter is a trigger that allows for multiple inputs. What this means is that you can have a door that only opens when 2 or more buttons are pushed. This is just once example though. The trigger_counter could trigger anything. You could set it up so the player would have to use 2 [insert you favorite item here] with a computer or something which in turn destroys a bunch of walls. There are only 3 keys that you have to set. Count, target, and targetname. Count is the amount of actions that is required before the trigger_counter triggers its target. So if you have a door that must have 2 buttons pressed to open then you would give the trigger_counter a count of 2. target is the target of the entity that will be triggered when the specific amount of actions is performed on the trigger_counter. Targetname is self explanatory, but I just wanted to stress that the trigger_counter MUST have a targetname. For example: Lets say you want a door that will be opened by pressing 2 buttons. First you would make the door and give it a targetname of door1. Next make the trigger_counter and set the target to door1, the count to 2, and targetname to count1. Now create the 2 buttons and give each of them a target to count1. That's it! Pretty simple huh? There is one spawnflag that can be used with the trigger_counter which is nomessage. By default, when the buttons in the example above are pressed, the messages, "1 more", "2 more", and "sequence complete" would be printed. nomessage disables these messages. trigger_relay is used to relay actions. This can be used for a variety of effects and is used very often in the id levels. a trigger_relay is not triggered when touched so therefore it must have a targetname and must be triggered by something else to work. It must also have a target. The other keys that can be set is delay, which determines the amount of time to pause before triggering it's target, killtarget and message. There are NO spawnflags. An example use of this would be to have a crate that when shot explodes, but when it explodes it triggers more explosions in the surrounding areas. What you would do is create the func_explosive crate and give it a target to a trigger_relay which in turn would target multiple target_explosions that would all have the same targetname. Or you could target several trigger_relay's all with different delay values that each in turn target their own func_explosive crates so you can have a sequence of timed explosions for cool effects. Hope this explains it a bit. The last entity that we will discuss in this tutorial is the target_earthquake. What this does is......create an earthquake!! Pretty difficult huh? There are a few options and other rules that you should know about though The target_earthquake does NOT start on and must be triggered into working. There are 2 key value pairs that you can set. They are speed and count. Speed is the magnitude of the quake. Count is the length of time the quake will last. Some other things to know is that the earthquake does not give off damage and it is not viewed in the level so size of the entity does not matter. Hope this tutorial helped yall out. All of the entities covered were all pretty easy. If you have any problems then be sure to check out the example map (rust29.map). If there is anything I missed or if you still have questions then please post to the discussion board. Return to Tutorials Page...

HTML Design, original concept of rust by Shane 'Fishman' Sherman rust is © 1998 by Shane 'Fishman' Sherman and Martin Ka'ai Cluney(GrrandMaMa). Quake and Quake2 are trademarks of id software. All rights reserved.