Tutorials
Metrocop
Ah, the lovely npc_metrocop, oppressing people and kicking dogs, and his lovely ai_goal_police.
You'd think the two would go hand in hand, that you could just give the npc_metrocop an ai_goal_police to police, and all would be well. He'd be standing there, happily pushing you away and occasionally beating you with a stunstick.
You'd be wrong. They're awkward little buggers. In fact, if you want your npc_metrocop to push the player, as they do in the initial levels of HL2, he doesn't even need an ai_goal_police.
I'll explain.
ai_goal_police gives an npc_metrocop a certain area to guard. When the target enters this area, the npc_metrocop will issue up to three warnings, telling the target to halt. Then, they'll commence the beatings, chasing the target if possible.
I have not found any way, however, to allow the npc_metrocop to still push the player away from himself whilst still within the confines of an ai_goal_police.
To set up your ai_goal_police:
name is whatever you wish to call your ai_goal_police. This is needed.
parent can be left blank.
pitch yaw roll (Y Z X) should be set to the direction you wish the npc_metrocop to face.
radius can either be set here, or dragged out using the helpers. This is the area the npc_metrocop will police.
target is the target you wish to police. If you want to police the player, as you most likely will, set it to !player.
To get your ai_goal_police working, you need a few more entities. Obviously, you need an npc_metrocop with a suitable name. You can set the flags on this npc_metrocop however you wish; I'd advise only arming him with a stunstick, however.
You also need a trigger_once of some description. To create this, make a brush through which the player or target can walk. I'd suggest using the trigger texture for this, so you can easily see it when editing. Tie the brush to trigger_once, and set an OnTrigger output to target the npc_metrocop, with the TargetInput of SetPoliceGoal with the Parameter of the ai_goal_police's name.
I'd recommend also sending DisableKnockOut to the npc_metrocop.
Finally, you'llll need an env_global or two. You'll need to set at least one to have the Global State to Set of Gordon Pre-Criminal, with Initial State equalling On and the flag Set Initial State also on.
If you wish, you can also add an env_global set to Gordon is Invulnerable, depending on whether you actually want him to be beaten to death or not.
Compile and run; when the target moves through the trigger_once, the npc_metrocop will walk to the ai_goal_police and face the direction specified. When the target moves within the radius, the npc_metrocop will threaten it. When the target gets close enough, the npc_metrocop will hit it, and follow if you have allowed it
Noctu
