Ai goal police

From Valve Developer Community
Revision as of 12:20, 7 July 2008 by Sithis (talk | contribs) (→‎Police Behavior: Behaviour Addition.)
Jump to navigation Jump to search

Template:Wrongtitle

Ai goal police.png

Makes a npc_metropolice guard ("police") an area against a target entity. If the target comes within range, the officer will chase it out of range - administering stunstick beatings if necessary. Note that it is not required for standard metrocop player provocation/chase behaviour.

Trigger it by sending a SetPoliceGoal input, with its targetname as a parameter.

This AI goal will override any AI relationships (so you will not have to use an ai_relationship to make the officer not attack the player just because npc_metropolice hates the player by default). However, behaviour is influenced by whether the "Gordon pre-criminal" global has been set.

Police Behavior

The officer will walk to his post (located in the very center of the guard post area) and stand there facing the direction specified.

If the specified police targets (NPCs or the player) enters the guard post area, the officer will be provoked.

If the officer doesn't have a stun stick, he will just give verbal warnings when provoked.

If the officer has a stun stick, he will also activate it to warn the target, and will suppress (beat) those who dares to get within his reach. (This does damage.)

Before activating his stunstick (if equipped, does not matter), the officer will push the player back a number of times before unholstering it, and finally activating it.

If provoked enough, the officer will finally (by default) leave his post to give chase to the target until its out of the guard post area, after which he will return to his post (if he can find his way back to it).

Knock Outs

The officer can also use his stun stick to knock a target (

Todo: Just the player?

) out in one hit if instructed to do so by the Knock-out target past crossing plane flag, or the EnableKnockOut input.

If the player is knocked out, the whole screen will turn white so the player can't see anything, but he can still move around just as normal, so this needs to be combined with sending the OnKnockOut output to other entities to be realistic. (In HL2, the player normally wakes up outside the guard post area, presumably having been carried there.)

Keyvalues

The guarding officer will turn to face this angle by default. The "crossing plane" runs 90 degress across this direction.
  • policeradius
<float> Radius to police - The radius of the guard post area. If a police target enters this area, the officer will be provoked.
  • policetarget
<target_destination> Target to police - Specifies what target to protect the area against. (You can set this to !player to make it guard the area against the player.) (Must be specified.)

Flags

  • 2 : Knock-out target past crossing plane
While the police target is behind the crossing plane (defined by the angles keyvalue) knock out will be enabled for the officer.
  • 4 : Do not leave post
The officer will not leave his post to chase the target, no matter how provoked he will be. This is very useful when guarding entrances, as the target may otherwise lure the officer away from it and then circle around him and get past him. (You can try this tactic in HL2 with the officer who wants you to put the can in the trash at the beginning of the d1_trainstation_02 map.)

Inputs

  • EnableKnockOut
Tells the goal to make the active policing NPC knock out its target.
  • DisableKnockOut
Stop the active policing NPC from trying to knock out its target.

Outputs

  • OnFirstWarning
Fires the first time a policing officer warns a target.
  • OnSecondWarning
Fires the second time a policing officer warns a target.
  • OnLastWarning
Fires when a policing officer warns a target for the last time.
  • OnSupressingTarget
Fires when a policing officer starts to suppress (ie. beat) a target.
  • OnKnockOut
Fires when a target has been knocked out.