Tutorials

quake2 - func_button


The func_button entity is a very simple entity that is used for for triggering other entities such as doors to open, platforms to rise, etc, etc. In many ways it acts like a regular trigger_ entity but there are a few more options and differences that you may notice.

Creating the func_button

First thing you need to do is create the brush/brushes that will be the func_button and then turn it into a func_button. Pretty straight forward and simple.

Key Value Pairs

Angle

Angle determines the direction that the button will move when it is pressed. In most cases you will set the angle towards the wall that the func_button is up against to give the impression that it is being pressed into the wall. There are also cases in which you would have the angle set differently then towards the wall that it is up against. For example: You could have a button on the floor that the player would step on to trigger. Another advanced use of the angle key is for creating a lever. This would just be made by creating a thin lever shaped brush that has the angle set parallel to the wall.


Target and Targetname

Target will be set to the corresponding targetname that the func_button will trigger. A func_button MUST have a target or it would be useless.

A targetname on a func_button is very strange, but it still works fine and can be useful. When a func_button has a targetname and is triggered the button will be set off just like it was pushed by the player, setting off it's own targets in the process.


Speed

Speed is pretty self explanatory. It determines the speed in which the button moves when it is pushed.


Wait

Wait is the amount of time that the button will pause before becoming active again. If you don't want the button to return then set the wait to -1.


Lip

Lip is the length of the button that is offset after being activated. So if you have a large lip value then more of the button will stick out after being pressed in.


Health

A value for health can be set if you want the button to be activated when shot. The button MUST be killed to be activated. Pushing it won't do anything after a value for health is set. The higher the value for health the more damage is needed to trigger it.


Sounds

The key value pair sounds works the same way for the func_button entity as it does for func_door and func_door_rotating:

1. There are no choices for different sounds, only one sound is available.

2. If you set this key to anything else than 1, you will always get the same standard button sound. If you set it to 1, you will have no sound.

So the "sound choices" list in the source code comments are outdated and probably just left over from Quake1. You do NOT have to use this key value pair unless you want your button to be silent.

Spawnflags

There are no spawnflags that are required or used for the func_button


Animated Textures

There are lots of animated textures that can be used for buttons. Animated textures are not something new but in Quake2, they behave a bit differently and this is one of it's coolest features. The best choice for these are 4 frame texture sets: To make a long story short, the button's face will toggle between the first 2 when idle and between the last 2 when pressed. Here's an example:

Suppose you make a button and apply the e1u1/arrow0 texture, when the button is idle, the button face will cycle between the arrow0 and arrow1 textures. While the button is pressed, the button face will cycle between the arrow2 and arrow3 textures.

This will work with all textures that follow one another in alphanumeric order and which end with the numbers 0 to 3. If you use a set which has only 2 textures in a row in the list, the button face will cycle between these 2 textures both in the idle and pressed states. Note that if there are more that 4 textures in the set, the ones after 3 will simply not be used. For instance, there is a e1u1/arrow4 in the last example: well, it is not used in the animation sequence. If you apply it to the button face, the texture will not be animated.

Also note that whether you apply the first, last or any other texture in the set makes no difference, the button face's texture will still be animated. If you use a 4 texture set, changing which one of the 4 you apply to the button face will change the sequence of which pair is displayed in the idle and pressed state. Let's pick up the previous example with a slight modification:

Make a button and apply the e1u1/arrow1 texture, when the button is idle, the button face will cycle between the arrow1 and arrow2 textures. While the button is pressed, the button face will cycle between the arrow3 and arrow0 textures.

Most animated "4 frame sequence" textures usually look and operate better when you apply the first texture (no. 0) in the set to the button face but that's not a fixed rule. Experiment and see what works best for you.


Uses of the func_button

In most cases you are going to use the func_button for easy tasks such as opening a door or triggering a lift of some sort. Which is very simple. Just make the func_door or platform give it a targetname, then target it with the func_button.

There are also some more advanced uses of a func_button such as a platform or a lever. Remember that although it is called a func_button you can use it for anything that you want to use it for. I'm sure that some of you can find some pretty wild things to use a func_button for and I would love to hear about them and I will post them on this page. On the [example .map], I have included examples of the most basic uses of a func_button as well as some of the more advanced uses, such as a lever.

Well anyways if you still don't understand please post your questions 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.