- Nov 30, 2007
- 122
- 89
In this tutorial, we'll make a safe place for players to spawn and resupply, while keeping enemies out.
The Room
Obviously, the first thing you'll want is a room, so go ahead and make one. I've got a floorspace of 384x304, but that is up to you of course. You don't want it too cramped, nor too open. I've left a gap to insert a door later on.
Respawn & Resupply Ents
We'll first add places for players to spawn. Place an info_player_teamspawn entity. Bring up its properties (alt+enter). The only settings you need to change are the Team and Angles. Since we're working with RED team for the moment, set the Team as Red. Use the compass so that the entity is facing the exit.
Now clone (shift+drag) this entity until you have at least 16 in the room.
Next, create a brush that fills the room, and tie it to the entity func_respawnroom. This area allows players to switch classes instantly, and prevents engineers building. In its properties, set its Team to Red and give it a logical name. I'm using "respawn_red1".
Note: See how I've used "red" in the name? Make sure all your new entities follow this pattern. This will be important in the last part of the guide.
For the resupply locker, first place a prop_dynamic. For its World Model, choose "models/props_gameplay/resupply_locker.mdl". Give it a name as well. "resupply_red1" will do.
Then, create a func_regenerate surrounding the locker. Set its Team, and Associated Model to the name of the locker you just made. In our case, "resupply_red1".
Doors
A hole in the wall isn't going to be much good, so we'd best make a door to fill it up.
Insert a prop_dynamic. Set its World Model as "models/props_gameplay/door_slide_large_dynamic.mdl". With this particular model, you get a door trim with animated sliding door. Give it a name, something like "door_red_respawn1_prop".
Now create a func_door which fills the doorway, but slightly overlaps the prop door. This will be an invisible door which controls the prop door. Give it the following properties;
Name: door_red_respawn1
Render Mode: Don't Render
Speed: 500
Delay Before Reset: -1
Move Direction: Up
Lastly, check its Flags and ensure that Touch Opens is not ticked.
Now we need to tell the prop door to play its opening animation when the func_door is opened. Bring up the Outputs of the func_door, and the two following outputs;
My output named: OnOpen
Target entities named: door_red_respawn1_prop
Via this input: SetAnimation
With a parameter override of: open
My output named: OnClose
Target entities named: door_red_respawn1_prop
Via this input: SetAnimation
With a parameter override of: close
Finally, create a trigger_multiple that extends well past the door so that players can trigger the func_door to open as they approach. Since we also want this trigger to only work for one team (RED) we will need to use a filter entity. Place a filter_activator_tfteam somewhere on the map. Set its Team as Red, and name it "filter_red_team".
Back on the trigger_multiple, Set the Filter Name to the name of the filter you just created. Also, set the Delay Before Reset to 0.
Just another two outputs remain;
My output named: OnStartTouchAll
Target entities named: door_red_respawn1
Via this input: Open
My output named: OnEndTouchAll
Target entities named: door_red_respawn1
Via this input: Close
Keeping the Enemy Out
One last thing we can do with our door is place a func_respawnroomvisualizer. While invisible and non-solid to the team that owns the spawn, it appears as a no entry sign and blocks the enemy team from passing through the open door.
Create the entity somewhere inside the doorway, filling the gap. All sides should be textured with tools/toolsnodraw except for the outer side, which should use overlays/no_entry. In its properties, the only thing you have to set is its Associated Respawn Room. For us, that'd be respawn_red1
Lighting and Detail
This is only a simple example map, but it wouldn't hurt to make this look a little more like an actual respawn room.
The first thing we'll want is some lights. Place a light prop or two with the prop_static entity. I've used the model "models/props_lights/light_fluorescent_basement.mdl". Just underneath the light fixture, place a light_spot. For longer lights like I've used, you might want to use 2 light_spots. Choose a light blue/white colour, and a brightness of about 500.
Place any other details you want. I've placed a couple of prop_static benches ("models/props_spytech/bench001a.mdl"), a func_detail door trim, as well as a RED team logo info_overlay ("signs/team_red").
Last but not least, you should place an env_cubemap entity to ensure that any shiny surfaces reflect their surroundings correctly. No extr aproperties are required.
Optimisation
One final thing you can do is increase optimisation by the use of a func_area portal. What this does is prevents the engine from rendering anything on the opposite side of the door when it is closed (since usually, the engine will just assume the player can always see it, and render unnecessary parts of the map).
Start with a solid textured completely in "tools/toolsareaportal" which fills the doorway. However, ensure that it is actually placed inside the door prop. You'll likely have to make it only 1 unit thick in order to fit.
Tie it to the entity func_areaportal.
Set its Name of Linked Door to the name of the respawn door, "door_red_respawn1".
lastly, set its Initial State to match the state the respawn door will start in- Closed.
One for BLU Team
At the moment, only RED team has a spawn room, which is hardly fair for the BLUs.
The first thing to do is select your whole room and clone (Shift&drag) it to another part of the map. Once you've done this, either keep your current selection, or select the old respawn and click the "New Visgroup" button (dotted red button on the upper toolbar). In the Visgroup window that pops up, enter a name of "Red Spawn". This will hide one of your spawn rooms in the editor, leaving us with what we'll turn into the BLU spawn.
First, let's retexture it. With the Texture Application tool, select one of the floor or wall textures of your spawn, and then click the "Replace" button. Make sure the "Hidden objects too" box is not ticked, and then click the right-hand "Browse" button. Find and select the blue equivilent texture for whatever surface you selected, and click Ok. All textures of that type wil be replaced with your new texture.
Repeat this process for all textures that need replacing.
The last thing to do is to go through every entity and reconfigure it to work for BLU instead of RED.
At least it would be if it weren't for this handy little feature!
Just like in any word editor, there is a "Replace" function specific to entities.
Go ahead and select Edit-Replace... (Ctrl+Shift+R).
In the "Find what"" box, enter "red".
In the "Replace with:" box, enter "blue".
Make sure that the "Visable objects only" box is not ticked! Press "Replace All" when you're done.
Every entity with a reference to the word "red" now uses "blue" instead.
Unfortunately, this is not 100% effective. While this works for instances where you had to type either "red" or "blue" (such as a Name field) this process works. However, in cases where you need to actually select the team from a drop-down box, you'll have to manually go and set the correct team. Check your info_player_teamspawns, func_respawnrooms, func_regenerates, and filter_activator_tfteams.
Finally, you can bring your original RED spawn back out of hiding by ticking its name in the little VisGroups window on the right. You should also select and hide/unhide the new BLU spawn so it has it sown visgroup as well. Doing this makes it easier to work with parts of the map at once.
Hopefully this has been a helpful tutorial. The example map built for this tutorial can be be found here. (Save Target As..)
The Room
Obviously, the first thing you'll want is a room, so go ahead and make one. I've got a floorspace of 384x304, but that is up to you of course. You don't want it too cramped, nor too open. I've left a gap to insert a door later on.
Respawn & Resupply Ents
We'll first add places for players to spawn. Place an info_player_teamspawn entity. Bring up its properties (alt+enter). The only settings you need to change are the Team and Angles. Since we're working with RED team for the moment, set the Team as Red. Use the compass so that the entity is facing the exit.
Now clone (shift+drag) this entity until you have at least 16 in the room.
Next, create a brush that fills the room, and tie it to the entity func_respawnroom. This area allows players to switch classes instantly, and prevents engineers building. In its properties, set its Team to Red and give it a logical name. I'm using "respawn_red1".
Note: See how I've used "red" in the name? Make sure all your new entities follow this pattern. This will be important in the last part of the guide.
For the resupply locker, first place a prop_dynamic. For its World Model, choose "models/props_gameplay/resupply_locker.mdl". Give it a name as well. "resupply_red1" will do.
Then, create a func_regenerate surrounding the locker. Set its Team, and Associated Model to the name of the locker you just made. In our case, "resupply_red1".
Doors
A hole in the wall isn't going to be much good, so we'd best make a door to fill it up.
Insert a prop_dynamic. Set its World Model as "models/props_gameplay/door_slide_large_dynamic.mdl". With this particular model, you get a door trim with animated sliding door. Give it a name, something like "door_red_respawn1_prop".
Now create a func_door which fills the doorway, but slightly overlaps the prop door. This will be an invisible door which controls the prop door. Give it the following properties;
Name: door_red_respawn1
Render Mode: Don't Render
Speed: 500
Delay Before Reset: -1
Move Direction: Up
Lastly, check its Flags and ensure that Touch Opens is not ticked.
Now we need to tell the prop door to play its opening animation when the func_door is opened. Bring up the Outputs of the func_door, and the two following outputs;
My output named: OnOpen
Target entities named: door_red_respawn1_prop
Via this input: SetAnimation
With a parameter override of: open
My output named: OnClose
Target entities named: door_red_respawn1_prop
Via this input: SetAnimation
With a parameter override of: close
Finally, create a trigger_multiple that extends well past the door so that players can trigger the func_door to open as they approach. Since we also want this trigger to only work for one team (RED) we will need to use a filter entity. Place a filter_activator_tfteam somewhere on the map. Set its Team as Red, and name it "filter_red_team".
Back on the trigger_multiple, Set the Filter Name to the name of the filter you just created. Also, set the Delay Before Reset to 0.
Just another two outputs remain;
My output named: OnStartTouchAll
Target entities named: door_red_respawn1
Via this input: Open
My output named: OnEndTouchAll
Target entities named: door_red_respawn1
Via this input: Close
Keeping the Enemy Out
One last thing we can do with our door is place a func_respawnroomvisualizer. While invisible and non-solid to the team that owns the spawn, it appears as a no entry sign and blocks the enemy team from passing through the open door.
Create the entity somewhere inside the doorway, filling the gap. All sides should be textured with tools/toolsnodraw except for the outer side, which should use overlays/no_entry. In its properties, the only thing you have to set is its Associated Respawn Room. For us, that'd be respawn_red1
Lighting and Detail
This is only a simple example map, but it wouldn't hurt to make this look a little more like an actual respawn room.
The first thing we'll want is some lights. Place a light prop or two with the prop_static entity. I've used the model "models/props_lights/light_fluorescent_basement.mdl". Just underneath the light fixture, place a light_spot. For longer lights like I've used, you might want to use 2 light_spots. Choose a light blue/white colour, and a brightness of about 500.
Place any other details you want. I've placed a couple of prop_static benches ("models/props_spytech/bench001a.mdl"), a func_detail door trim, as well as a RED team logo info_overlay ("signs/team_red").
Last but not least, you should place an env_cubemap entity to ensure that any shiny surfaces reflect their surroundings correctly. No extr aproperties are required.
Optimisation
One final thing you can do is increase optimisation by the use of a func_area portal. What this does is prevents the engine from rendering anything on the opposite side of the door when it is closed (since usually, the engine will just assume the player can always see it, and render unnecessary parts of the map).
Start with a solid textured completely in "tools/toolsareaportal" which fills the doorway. However, ensure that it is actually placed inside the door prop. You'll likely have to make it only 1 unit thick in order to fit.
Tie it to the entity func_areaportal.
Set its Name of Linked Door to the name of the respawn door, "door_red_respawn1".
lastly, set its Initial State to match the state the respawn door will start in- Closed.
One for BLU Team
At the moment, only RED team has a spawn room, which is hardly fair for the BLUs.
The first thing to do is select your whole room and clone (Shift&drag) it to another part of the map. Once you've done this, either keep your current selection, or select the old respawn and click the "New Visgroup" button (dotted red button on the upper toolbar). In the Visgroup window that pops up, enter a name of "Red Spawn". This will hide one of your spawn rooms in the editor, leaving us with what we'll turn into the BLU spawn.
First, let's retexture it. With the Texture Application tool, select one of the floor or wall textures of your spawn, and then click the "Replace" button. Make sure the "Hidden objects too" box is not ticked, and then click the right-hand "Browse" button. Find and select the blue equivilent texture for whatever surface you selected, and click Ok. All textures of that type wil be replaced with your new texture.
Repeat this process for all textures that need replacing.
The last thing to do is to go through every entity and reconfigure it to work for BLU instead of RED.
At least it would be if it weren't for this handy little feature!
Just like in any word editor, there is a "Replace" function specific to entities.
Go ahead and select Edit-Replace... (Ctrl+Shift+R).
In the "Find what"" box, enter "red".
In the "Replace with:" box, enter "blue".
Make sure that the "Visable objects only" box is not ticked! Press "Replace All" when you're done.
Every entity with a reference to the word "red" now uses "blue" instead.
Unfortunately, this is not 100% effective. While this works for instances where you had to type either "red" or "blue" (such as a Name field) this process works. However, in cases where you need to actually select the team from a drop-down box, you'll have to manually go and set the correct team. Check your info_player_teamspawns, func_respawnrooms, func_regenerates, and filter_activator_tfteams.
Finally, you can bring your original RED spawn back out of hiding by ticking its name in the little VisGroups window on the right. You should also select and hide/unhide the new BLU spawn so it has it sown visgroup as well. Doing this makes it easier to work with parts of the map at once.
Hopefully this has been a helpful tutorial. The example map built for this tutorial can be be found here. (Save Target As..)
Last edited: