Download (direct link):
4. Press the Gui button now to launch the GUI selection window.
Chapter 16: Gaming with GUIs 289
To select and apply a GUI to your entity, click the Gui button in the Entity tab.
You can browse and preview GUIs just like you can with models.
func_sÂ»atc 7] Cieate |
Usage Usage * A bush modd lhal Mst sits there, dang nothing. Can be used (or conditional walls and models v
classname func_static A
name func static 40
model (unc static 40
Val f~~ d<J
Upj 3 Play | Stop[ Curve | Model. |
Dn| _|-------------------------- ^ Sion- | ^Saind^J
Entity I Media | Textures j Console | Groups |
The GUI selection dialog box looks a lot like the model select window, discussed in Chapter 12. It contains folders that better sort the different GUIs that are available. It also has a preview window on the bottom left and a comments window on the bottom-right, as shown in Figure 16-5. Feel free to explore the different GUIs that are available before continuing.
290 Part IV: Going Beyond the Basics
Many of the GUIs have comments available. These comments are meant to assist you in applying special settings that are unique to each GUI.
The settings can be applied within the entityâ€™s properties as a Val and Key or through scripting by using the entity.setGuiParm( "Key", "Val" ) script command.
5. For your door GUI, open the folder base/guis/common/strogg.
Here you can find open.gui, a simple GUI that will work perfectly for your door. Select it and take a look at the preview of it, as shown in Figure 16-6.
6. With your GUI interface selected, press OK to proceed.
The open.gui GUI is simple in that when the player uses it, it triggers whatever you have targeted. Then itâ€™s ready to run again just like a trigger-multiple brush. Some GUIs can be used only once or need additional commands to be reset.
Controlling your doors
Your GUI is set for the game, but it doesnâ€™t do much other than look pretty. You still need to tell your GUI to control the doors. Follow these steps:
Chapter 16: Gaming with GUIs 291
1. Press Esc to deselect everything, select your GUI entity first, select one of your door entities second, and then press Ctrl+K.
This targets your GUI to your doors in the order you selected. This targeting will be made apparent by a blue line that extends from the GUIâ€™s point of origin to the doorâ€™s point of origin, as shown in Figure 16-7.
You donâ€™t have to select both of the two doors for targeting. In Chapter 12, you used an entity Key and Val to team the doors together so that they acted in unison. So, you need to target only one of the doors to open on command, and then the other door, because itâ€™s on the same team, will open with it.
You must do one more thing before the doors are complete. Right now, if you walk up to the doors, they open automatically. You donâ€™t want the doors to open automatically when you have an interface on the wall to perform this same function. You need to tell the doors not to open unless they have been triggered to do so.
When the GUI entity is ready, remember to target your doors with it.
292 Part IV: Going Beyond the Basics
2. Press Esc to deselect everything and then select the two doors.
The command youâ€™re going to apply has to be applied to both doors, and you can apply the same command to all the selected entities at one time. If you look through the options available for this entity as presented in the scrollable field of the Entity tab, one of the listed options is no_touch. The description states, â€śthe door should not be triggered by the player touching it, only by another trigger. In multiplayer, this door canâ€™t be shot to open.â€ť This is exactly what you want because the GUI is to trigger the doors to open.
3. On the Entity tab, enter no_touch in the Key field and 1 in the Val field, as I have done in Figure 16-8. Then press Enter to apply the changes.
Your doors are now controlled with a trigger and wonâ€™t open automatically.
Textures (alt) EnMy Oces
225| 27p| 31S|
func_doot 7] Create
no J ouch the door should not be triggered by the * player touching it, only by another trigger, in multiplayer, thrs door can't be shot to open. v
team doorsjed A
no touch 1
Val |1 XJ
^ I Play I Stop I Curve.. I Model.. |
Entity ! Media j Textures j Console |
Now you can save your map, compile it, and test it in the game. The result will be a great-looking GUI to the side of the doors that the player can use to open the doors. It will look something like Figure 16-9 in the game.
Working on your own
While play-testing your map, you might notice some things that still need to be done. Depending on how you plan on using this map, you might need more interactivity with the doors. For instance, when the player gets outside of the room, how should he or she be able to get back in? Some options that you have: