in black and white
Main menu
Share a book About us Home
Biology Business Chemistry Computers Culture Economics Fiction Games Guide History Management Mathematical Medicine Mental Fitnes Physics Psychology Scince Sport Technics

Quake 4 mods for dummies - Guilfoyle E.

Guilfoyle E. Quake 4 mods for dummies - Wiley publishing , 2006. - 411 p.
ISBN-13: 978-0-470-03746-1
Download (direct link): quake4modsfordumm2006.pdf
Previous << 1 .. 88 89 90 91 92 93 < 94 > 95 96 97 98 99 100 .. 129 >> Next

GUIs are everywhere. For example, while your map is loading, your map name appears with a dark background at the top of the screen; there is a loading bar, and there is a dark background at the bottom of the screen, too. This is all one big GUI.
To create a total modification of the game, you must know how to create your own GUIs. I show you how to add your own graphics; how to control an entity (in this case, a pair of doors); and how to make that entity usable by the player.
286 Part IV: Going Beyond the Basics
Opening Doors
To start, first add a simple GUI to your map. Your new GUI will be used to control the opening of the doors in place of the existing trigger brush. However, that trigger brush will need to remain in place so it can trigger the monster on the other side. This means that the player will have to walk up to this interface and use it to cause the doors to open. This effect is exactly the same as you might see in some of the single-player maps that come with the game.
GUIs aren’t limited to use in single-player maps. You can use GUIs in any type of map. Just be sure that when you’re inserting them into your maps that you don’t make them a nuisance to the player, thereby making the level less fun to play.
Looking at the Watt
Before you start, open the map from the last chapter. Then save it as in the same location as the previous map. This way nothing will happen to the last map you made, and you can continue the work you’ve already done. Also, copy any scripts you have from the previous map version and save them under the name of the new map so that they are available in this map as well. Specifically, the chapter15.script needs to be copied and renamed to chapter16.script.
Focus the editor on the set of doors in the room at the bottom of the map. This is the blue room, and this is where you are going to add your GUI to control the doors.
1. Load your Common texture set and select the Nodraw texture.
Generally you would create your brushes with the Caulk texture, but not in this case. Here, you want to make sure that your brush is invisible on all sides except the panel where the user will interact with the GUI. It also needs to be a non-solid. (The Caulk texture creates an invisible, yet solid brush.)
2. Zoom in close to the left side of the doors on the inside of the room. Here, draw a brush with the Nodraw texture that is about 16 units away from the doors and about 16 units wide.
3. Move the brush so it’s centered on the 64-unit Z axis and stretch it to 16 units tall.
The brush should look like the one shown Figure 16-1.
Chapter 16: Gaming with GUIs 287
Figure 16-1:
Create a small brush near the door for your GUI by using the Nodraw texture.
4. Zoom in closer to your brush within the 2D window. Zoom in until the brush nearly fills the window. Then change your grid size to 1 unit by pressing 1.
5. Adjust the brush so that it is against the wall and is only 1 unit thick (see Figure 16-2).
The idea is to make your brush so thin that the player can’t see that it sticks off the wall. In the game, the Nodraw texture won’t be displayed, and your GUI will appear to be floating. This will hide that effect.
Figure 16-2:
Make the brush 1 unit thick so that it looks like it’s part of the wall.
6. When you’re done stretching the brush, return your grid size to 8 units by pressing 4.
This way you won’t accidentally make single-unit adjustments to any of your brushes later on without realizing it. Such a small unit adjustment isn’t easy to see unless you’re zoomed in close.
7. Select the brush face on which you intend to apply the GUI.
This is the larger surface facing away from the wall and the surface that the player will interact with.
288 Part IV: Going Beyond the Basics
Figure 16-3:
Apply the entitygui texture to the face of the brush and fit it to size.
8. Apply the texture common/entitygui. Open the surface inspector by pressing S. Enter a value of 1 in both the Width and Height value boxes to the right of the Fit button. Then click the Fit button, as I have done in Figure 16-3. Close the Surface Inspector.
Later, when you tell the game to display the GUI on this brush, the game will display it on this texture. Because the size of the texture influences the size of the GUI, you must size the entitygui texture to the size of the brush. If the texture were off-centered and too large, the GUI would also be off-centered and too large.
Interacting with an entity
Now you have to turn your brush into a GUI entity. Here’s how:
1. Select the entire brush you’re working on.
You now must turn it into an entity so that the game can apply the GUI.
2. Turn the brush into a func_static entity by right-clicking the 2D window and choosing funcOfunc_static.
3. Open the Entity tab.
On the bottom-right of this tabbed window, you see a button labeled Gui. It’s also shown in Figure 16-4. This button allows you to select a GUI for your entity.
Previous << 1 .. 88 89 90 91 92 93 < 94 > 95 96 97 98 99 100 .. 129 >> Next