Team score with brushes

From Valve Developer Community
Jump to navigation Jump to search


Overview

This tutorial will show you how to activate the team score in a HL2DM (Half-life 2 Deathmatch) using only brushes, which will allow you to create games like football, CTF, or other games that use a phys object to trigger team score.


**This tutorial assumes you have some hammer knowledge and a map with team spawns in it**

.

Step 1 ~ Create your trigger object

First create the object you want to trigger the team score with; this will most likely be a ball or some kind of flag for CTF. This can be done by creating a brush in the shape you want (sphere for a ball) and clicking the To Entity button on the right hand tool panel in hammer. When the shape is turned into an entity the default setting is usually a func_detail, but this can be changed to whatever entity type you need for the game you are making though for this tutorial we will make it into a func_physbox.

Name your object something meaningful so you can easily recognise it later from the list, for this example call the ball game_ball in the name setting.


.

Step 2 ~ Setup your goal areas

Once you have your trigger object/s you must make the areas that causes the team score to be advanced/decreased (cap area, goal ect ect) when the trigger object touches it. To do this you must select the trigger texture (use tools in filter to find trigger) and make a box that covers your goal/cap area completely. For example if you had a goal you would make the box inside the goal area so it completely fills the inside of the goal.


Turn the box you have just made into an entity (as in step 1) and then make that box into a trigger_multiple using the pulldown. Name this box so you can recognise it easily, for example my goal will be called goal_rebel.

Repeat this step again to create another trigger_multiple called goal_combine.


Once you have your two goal triggers setup you must change the filter name option to our ball object called game_ball in the pulldown, this should be done for both triggers.


**You should now have two trigger_multiple boxes; one for each team.**


.

Step 3 ~ Make a score entity

Next thing you need to do is to setup the game score that the teams will use. To do this you must first create a game_score entity which should be placed in plain view so you can find it easily, this could be outside your map as game_score does not have any in-game model or collision.


Input the score you want to give for a successful goal/cap, though we will set the score to set as 5 for this tutorial.

Name your game_score entity something; we will call it score_add.

Now tick the Team Score tab in the properties of the game_score to enable the team to be given the score not the player.


.

Step 4 ~ Make the team filters

We now need something to tell the two teams apart when deciding who get the score, so we will create two filter_activator_team entities and name them filter_rebel and filter_combine. Open the properties of fiter_rebels and change the team filter setting to rebels. Do the same for the filter_combine but obviously change the team setting to combine.


.

Step 5 ~ Setup the team triggers

Last thing we need to make is the actual triggers that we use to give the team score. These should be trigger_multiple boxes that cover the entire map (anywhere the players can go at least) and there should be one for each team named accordingly. We will name our triggers trig_rebel and trig_combine, make sure only clients can activate these triggers by un-ticking all activation options apart from client.

Next open the trig_rebel properties and change the filter option to use our filter_rebel, then goto the start disabled option and select yes. Do the same for trig_combine but use filter_combine, though this must also start disabled.


These triggers will be used to activate the game score, so goto outputs in trig_rebel and add a new output OnTrigger, make it activate game_score and the action should be to AddScore. Again do this for the trig_combine in exactly the same way.


.

Step 5 ~ Putting it together

All we need to do now is to go back to the goals we made earlier (goal_combine and goal_rebel) and add outputs to them that will activate the triggers to apply the score.


Start with goal_rebel and add the output OnTrigger and make it activate trig_rebel, the action should be Enable. Make another output OnTrigger and make it activate trig_rebel with the action Disable, though this should have a delay of 1 second so the trigger is enabled for a second and the score is applied then disabled again.


Do the same for the goal_combine instead using the trig_combine in the same outputs as above.


Now you should have a working brush triggered team score system set in place, this technique can be used in different ways to make other game styles.


Sorry about the tutorial, it's my first wiki one. :p

www.teamskc.co.uk