Randomizing Control Point Owners

From Valve Developer Community
Revision as of 12:08, 17 March 2012 by Freeze10415 (talk | contribs) (By applying the "PickRandom" input of a logic_case entity in the Hammer World Editor, a CP, 5-CP, or Linear-type CP map becomes more exciting and adaptable.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Note.pngNote:This Wiki page is written for the game Team Fortress 2, but may be applicable in other Source games.


Randomizing control point owners is an option for Control Point map creators who would like to add unexpected elements to their styles of play.


How to

One way to factor random elements into a Control Point map is through the use of the logic_case entity and its PickRandom input.

To start, the map will need at least one capture point. Then add in the logic_case with an OnCase output set for each possible outcome. Under every OnCase output group, each targeted control point needs to receive two commands:

1) A SetOwner input, targeted at the team_control_point entity, to determine who the owner becomes in the chosen case.

Note.pngNote:Recall that in Team Fortress 2 the parameter override of an OnCase-SetOwner output has a key, where 0 sets the owner as neither team, 2 as red team, and 3 as blue team.

2) A Skin input, targeted at the prop_dynamic or the base entity, which tells that model to change its skin according to the new capture point owner.

Note.pngNote:Again recall that for the Team Fortress 2 capture point base, 0 sets the color to gray, 1 sets the color to red, and 2 sets the color to blue. If you do not wish to have a base on your control point, then you can ignore this output completely and refer to (1) alone.
Output Example.jpg

Example (See image at right): If there are two teams to differentiate between, 1 and 2, there are four owner outcomes: 1-1, 2-2, 1-2, and 2-1. Thus there would be four OnCase outcome sets. Because there are then two control points to randomize, each OnCase group consists of four outcomes, two for SetOwner inputs and two for Skin inputs.

{{note|If there are more than sixteen possible outcomes for the control point system and therefore more than sixteen necessary OnCase outputs in the logic_case, then a solution is to create two or more logic_case entities until the requisite number of OnCase output spaces is acquired. The next step would be to connect the multiple logic_case entities via another logic_case, which would include an OnCase-PickRandom output for each of the other randomizing logic case entities.

Note.pngNote:One may minimize the chances of any outcome by copying and pasting other OnCase groups into the logic_case randomizer system, thus diluting the probabilities by adding in more opportunities for the same outcome to occur.

Plugging into the randomizer

Obviously the randomization system is not going to function if it does not have an external entity to instigate randomization. There are two possibilities for this:

1) Use the OnRoundStart output of the cp_timer entity to randomize a point's owner at the beginning of a game:

My output named OnRoundStart, target entities named <<name of randomizing logic_case>>, via this input PickRandom

Note.pngNote:The cp_timer entity is at times temperamental with its inputs and may not function as desired.

2) Use the OnCapTeam1 and OnCapTeam2 outputs of the trigger_capture_area of one of the control points to instigate randomization when a team captures a specific point:

My output named OnCapTeam1, target entities named <<name of randomizing [[logic_case]>>, via this input PickRandom My output named OnCapTeam2, target entities named <<name of randomizing [[logic_case]>>, via this input PickRandom

Note.pngNote:Recall that the "fire once only" option for these outputs will prevent randomization from occurring throughout a given round.
Note.pngNote:If there are more than sixteen possible outcomes for the control point system and there is a principal randomizing entity for multiple other logic_case entities, then the designated target entity of the outputs should be that principal entity.