Jump to content

GtkRadiant/Linking Entities

From Wikibooks, open books for an open world

Linking Entities

GtkRadiant

Many entities can trigger other entities, or be triggered. For example you could switch a light on and off with a button, so here the button triggers the light. You could also unlock a door with a button, or open a door. Not only buttons can trigger things, for example a destructible wall could trigger that an NPC spawns when it is destroyed, or that a message is broadcasted when it is shot at. But in this chapter we will simply turn a light on and off with a button.

Lets begin with making something that could look like a button, or at least could look like a button, a simple box is enough here. Texture it with any texture you like, and put it where ever you want. It doesnt matter where you put it since it isn't the button itself you press. To make something "pressable", you will have to add another brush in front of your button brush. This time, texture it with the system/trigger texture. Then, while the brush is still selected, right click, and choose trigger and then trigger_multiple. This will make the brush with the trigger texture a trigger_multiple entity. By default, this will trigger something as long as you are in the brush. But since you want the trigger to only trigger when you are in it and press the USE button, you will have to open the entity window (N) and check the use_button spawnflag.

Everything still isn't fine, since, right now the trigger will fire continuously as long as you hold down the button, so since you don't want that add the property wait with a value of 1 to make it wait one second between the triggerings. Now that the trigger is set up, create a light (you should know how by now), then deselect everything (ESC). Then select the trigger brush, and then the light (SHIFT+LMB) and press CTRL+K to connect them. If everything is done correctly, a line will appear between the two entities, if not, try again.