Warning: array_merge() [function.array-merge]: Argument #1 is not an array in [path]/archive/global.php(40) : eval()'d code on line 2
[Tutorial] MacNetrons guide to Gravelpit-like CP maps [Archive] - TF2Maps.net Forums

PDA

View Full Version : [Tutorial] MacNetrons guide to Gravelpit-like CP maps


MacNetron
02-24-2008, 05:34 PM
This guide will consist of 4 parts.
Part 1 is the easy starter and will just show how to make a Control Point (=CP from now on).
In Part 2, we extend our one CP room to a room with 3 CPs, named A, B and C. In Gravelpit-style, A and B together unlock C for capture.
If that is not enough for you, in Part 3 we throw in some logic to unlock C for capture after A OR B has been capped. Now that will teach them not defending C!
For the final piece the resistance, Part 4 will make the room ready for publication by adding final pieces like setup-time and its triggered doors.


[Part 1]

First, create a big room so everything we will build will fit. I've created a 2048x2048x384 sized one. You are of course free to make 3 rooms to 'replicate' the Gravelpit-style, but I've just textured one side Red and the other side Blue (Red and Blue textures by Youme, available on the forum).
Now, a CP consists of a couple of brushes and entities, 4 to be precise (as you can see below):

http://83.81.118.36/gfx/part01-01-CPA.jpg

Lets create a CP.

1) Create a brush at the bottom with a minimum size of 224 (mine is even 512x384 to create a nice big capture area). Keep its height low, so we can walk onto it. My base is quick and dirty textured with “hazardstrip001a”. I leave it to the reader to create a nicer looking one.

2) Add an entity prop_dynamic and edit its properties:
World Model: models/props_gameplay/cap_point_base.mdl (hint: filter on cap_point)
Name: prop_cap_a
Thats all, move the prop to the middle of the bottom brush.

3) Add an entity team_control_point on top of the prop_cap_a. Properties:
Name: control_point_a
Print Name: A
Default Owner: Red

On the tab Outputs, add a new output with the following settings:
My output named: OnCapTeam2
Target entities named: prop_cap_a
Via this input: Skin
With a parameter override of: 2
After a delay in seconds of: 0 (Click Apply)

4) Last, create a boxed brush with texture “tools/toolstrigger”. Width and length of the bottom box and a height of (in my case) 256. Then tie it to an entity by Tools -> Tie to Entity or just CTRL-T.
Class: trigger_capture_area (click Apply)
Name: team_cap_area_a
Control point: control_point_a


That is it! You've done it, your CP is ready and fully operational.

Some further explanations. The team_control_point (point 3) is controlling who is the owner of the CP and for instance dependencies. Just have look at the properties. The trigger_capture_area (point 4) is making sure a player inside it, is capping the point if he is allowed to do that at all. The added output triggers a change of the skin of prop_cap_a. It will turn blue (by showing picture number 2) after the event OnCapTeam2 is triggered. Team1 is Red and Team2 is Blue.

Technically speaking, if you look closely who is referring to who, only building the last two would be enough for a CP, but that will not look very TF2-ish.

For the names, I follow the convention: “what is it doing?”_”who/where is it?”. So in this case everything with the same functionality will be “grouped” together in the various pull down menus we will see later on. And of course “a” is just for this tutorial. We could also named it “factory”, but you already guessed that, right?


[Part 2]

Now, for a Gravelpit-style map, we need 3 CPs. As rehearsing is the key concept of learning, do Part 1 another two times. Veterans are allowed to copy two CPs from CP A :)
Make sure you replace all “a”'s in the names with “b”'s and “c”'s (“Duhh!” I hear you say...).

Now lets look at the properties again for the various parts as there are small adjustments needed. The changes or additions are marked in bold.

Point A (and B but with “b”):

3) The team_control_point:
Name: control_point_a
Print Name: A
Default Owner: Red
Index: 0 (and B: 1)
Blue Previous Required Point 1: control_point_a (Yes! Itself!)

4) The trigger_capture_area:
Name: team_cap_area_a
Control point: control_point_a
Can RED Cap?: No


Now our final Point C, I'll hope you say something like – I guessed that!:

3) The team_control_point:
Name: control_point_c
Print Name: C
Default Owner: Red
Index: 2
Blue Previous Required Point 1: control_point_a
Blue Previous Required Point 2: control_point_b


Each Index must be unique. We will see why later on. At CP C, we define which CPs are required to unlock capping. In this case, CP A and CP B are required to be capped by Blue, then and only then CP C will be available for capturing.

http://83.81.118.36/gfx/part02-01-CPABC.jpg

You can see at the left (blue) side the CPs A and B and on the right (red) side CP C.

Add an info_player_teamspawn for each team and you are able to test the map for both sides.
And we run immediately into problems. When playing Blue, we instantly lose, and when playing Red, we instantly win. We have created a linear CP-game, like Granary and Well. Congratulations, but that was not our goal.

Lets add the final entities to complete Part 2 (Yes, those are the small dots in the middle of my map).

1) Add an entity team_control_point_master:
Name: team_control_point_master
Cap Layout: 2, 0 1
Restrict team from winning: Red
Switch teams on map win?: Yes

2) Add an entity game_round_win:
Name: game_round_win_red
Team: Red
Switch teams on map win?: Yes

3) Last, add an entity team_round_timer:
Name: team_round_timer
Timer length (in seconds): 120
Max timer length (in seconds): 120
Start paused: No
Setup timer length (in seconds): 10

On the Output-tab, add a new output:
My output named: OnFinished
Target entities named: game_round_win_red
Via this input: RoundWin
After a delay in seconds of: 0 (Click Apply)


The team_control_point_master draws the Cap Layout on the HUD (with the Indexes, so that is why they need to be uniquely numbered). And it restricts team Red from winning when Red has all CP captured. So only Blue can win by owning all CPs.

Red can only win if the time runs out. To create this, we have a nice combo by team_round_timer and game_round_win. The timer creates a 2 minute (=120 seconds) game and has an output to game_round_win_red. When the timer hits 0, it triggers an OnFinished. With the output-link, it will now raise the event RoundWin on Reds win condition, so Red can now win too.

MacNetron
02-24-2008, 05:35 PM
[Part 3]

As you might have seen looking at the team_control_points previous required points, you can select multiple points, but not the logical operator on them. So in our case, we need A AND B to be able to capture C. It might be nice to create a map with A OR B to unlock C for capping. Just for advanced logical mapping fun, or because you made your map a bit easy to defend.

Because we can't change the logical operator of the required points, we need a trick to have C only have one previous required point, named D. When Blue captures A OR B, D will turn Blue too so it will unlock C.

3) Add for CP D just a lonely entity team_control_point:
Name: control_point_d
Print Name: D
Index: 4

On tab Flags, check the option Hide Control Point on HUD.


Now, we trigger the ownership (eg. Red, Blue, Neither) of CP D directly from CP A and B by adding the same output to both control_point_a and control_point_b:

My output named: OnCapTeam2
Target entities named: control_point_d
Via this input: SetOwner
With a parameter override of: 3
After a delay in seconds of: 0 (Click Apply)


Capping CP A OR B will now directly trigger setting the owner of CP D to Blue (=3). Only thing left to do is having just one previous required point at C:
Blue Previous Required Point 1: control_point_d


http://83.81.118.36/gfx/part03-02-cappedB.jpg

On the picture, CP D in action. Capping B triggers ownership of D to Blue and unlocks C.

As of win conditions, Red still wins when the time runs out. Blue still have to capture all CPs, only now the order might be a bit different, because B, C, A is possible.

Note: We can't do this trick unlimitedly. There is a maximum of 8 CPs allowed in TF2. If you add more, then the game will crash on loading the map.


[Part 4]

To reward the attackers for their hard work capping the CPs, we can add some time to assist them capturing the remaining ones. This example will add 10 seconds when a CP is capped.

Add a new output for each control_point_x:

My output named: OnCapTeam2
Target entities named: team_round_timer
Via this input: AddTime
With a parameter override of: 10
After a delay in seconds of: 0 (Click Apply)


Note that the added time can never have the time pass the number set in Max timer length (in seconds) in the team_round_timer.


It is nice to have some setup time for the defenders to move to their positions and have engineers built some stuff. The setup time itself, we've already added that to the team_round_timer in part 2, with the entry Setup timer length (in seconds): 10.

Add an entity prop_dynamic. This will be our door:

World Model: models/props_gameplay/door_slide_large_dynamic.mdl
Name: blue_spawn_door_prop


Create 2 walls to make sure the players won't be able to leave to spawn area before the setup time has passed. Make a brush (texture: no_draw), filling the doorway and slightly overlapping the door.

Tie the brush to the entity func_door:

Name: blue_spawn_door_func
Render Mode: Don't Render
Speed: 500
Delay Before Reset (-1 stay): -1
Move Direction: Up


http://83.81.118.36/gfx/part04-01-triggereddoor.jpg

At the picture, the blue_spawn_door_prop is selected. You can see the blue_spawn_door_func in the doorway.

Now we have to make sure the door is opened when the setup time has passed.

Add a new output for the team_round_timer:

My output named: OnSetupFinished
Target entities named: blue_spawn_door_func
Via this input: Open
After a delay in seconds of: 0 (Click Apply)

Now the blue_spawn_door_func has to really open the door:

My output named: OnOpen
Target entities named: blue_spawn_door_prop
Via this input: SetAnimation
With a parameter override of: open
After a delay in seconds of: 0 (Click Apply)


The door is working now, but not complete. So, for more info on doors – for instance keeping the other team out – I advice to read [TUTORIAL] A Beginner's Guide:The Spawn Room (http://tf2maps.net/showthread.php?t=198).

Last thing to add to this map are the letters of the CPs to the Cap Layout on the HUD, so the players instantly will see which CP is being capped.
Open the properties of the team_control_point. Scroll down and add:
3)The team_control_point:
Name: control_point_a
HUD overlay neutral: icon_obj_a (Tip: filter on 'icon' in the Texture browser)
HUD overlay RED : icon_obj_a
HUD overlay BLUE: icon_obj_a


This will add a small 'A' in the upper right corner of the HUD icon representating CP A. For B and C, same thing, only choose the appropriate icon of course.


That is it for now. Should the need arise, I'll change and/or add things. For now: Happy mapping!

MacNetron
02-26-2008, 04:02 PM
It takes some time, but it is rewarding, having your own written reference. Now lets hope I finish my contest map in time :)

Vander
02-26-2008, 04:19 PM
Thanks for the tut! Gravelpit style maps are my favorite.

Termaximus
03-11-2008, 09:21 AM
Nice tut. Will be using this for my next map once I finish my contest map of course.

Youme
03-11-2008, 10:45 AM
*Craves some screenshots of those outputs* (don't remove the text though!)

MacNetron
03-11-2008, 02:30 PM
hum... they were there! My Apache seems to be down.
I'm trying to get Subversion working on my home server and apparently it has broken Apache...

EDIT: its working again... but found some disturbing thing in the error.log
[Tue Mar 11 20:18:30 2008] [notice] caught SIGTERM, shutting down

TeamNightHawK
03-11-2008, 09:58 PM
This helps me alot :D

MrSinistar
03-13-2008, 11:27 PM
Thanks a million for this tutorial, man. I understand control points a lot more now. :D

Paria
04-13-2008, 07:05 PM
just ran through this on a test map, very nice tutorial to follow.

1 thing i would add to the tutorial if you are trying to acheive the A / B / C gravel pit format is to add to the

team_control_point

keyvalues

HUD overlay Blue - sprites/obj_icons/icons_obj_a (b or c)
HUD overlay Red - sprites/obj_icons/icons_obj_a (b or c)

This will give you the letters A /B /C on the actual hud squares.

MacNetron
04-16-2008, 01:09 PM
Yeah, thnx! That is indeed a valuable addition. Not much, but certainly needed for the Gravel pit experience :)

Added:

part 3: note on maximum of 8 CPs
part 4: HUD indicators A, B, C (thnx Paria)