WiseNPCrapjump: Police rappel and jump

From Valve Developer Community
Jump to: navigation, search

This tutorial was originally created by wisemx.

Ported from SDKnuts.net to VDC by: Peter [AGHL] 12:26, 23 Feb 2008 (PST)

Police rappel and jump
First Combine Police
Second Combine Police
Note:This is an extension of the WiseNPCrappel.

The sample file for this project, at the page bottom, illustrates:

  • Combine Police Rappels from ceiling then jumps down to join the attack.
  • Second Combine Police jumps down from above and begins to attack.

As you see there are two methods of getting NPC’s to jump down from heights illustrated in this project.

  • The first method is a scripted_sequence that begins when the rappelling Combine Police has completed its rappel.
  • The second method uses info_node_hint entities to get the Combine Police to jump down.

Both methods require some finessing. The NPC won’t jump down if it is too far and in the first method the animation is already set so you need to use landing points that match.

As you can see in this project I’ve created an electrical panel and a toolbox for the first Combine Police to jump down onto. These are brush based and work out well for a project like this.

For the second Combine Police that makes use of info_node_hint entities I’ve created a group for the hints this NPC will use. This is to keep the NPC from getting distracted.

The first method works much better as the info_node_hint method can easily be interrupted by other events in your project.

Note:The first Combine Police spawns with a point_template but not the second one. This is to illustrate how both methods can work either way. It is much more efficient to spawn your NPCs with templates when needed and then target them with the kill command once they are no longer needed. The template in this project could have handled both NPCs.

The first Combine Police

These are the setting for the first Combine Police.

npc_metropolice

{{entity-kvalue-start|npc_metropolice} |align="left" style="padding-left:10px; background: 262626; font-size:90%; border-left: thin solid grey;"|Name |align="left" style="padding-left:10px; background: 262626; font-size:90%; border-right: thin solid grey; padding-right:10px; "|Police01 |align="left" style="padding-left:10px; font-size:90%;"| |- |align="left" style="padding-left:10px; background: 262626; font-size:90%; border-left: thin solid grey;"|Waiting to rappel |align="left" style="padding-left:10px; background: 262626; font-size:90%; border-right: thin solid grey; padding-right:10px; "|Yes |align="left" style="padding-left:10px; font-size:90%;"| |- |align="left" style="padding-left:10px; background: 262626; font-size:90%; border-left: thin solid grey;"|Weapons |align="left" style="padding-left:10px; background: 262626; font-size:90%; border-right: thin solid grey; padding-right:10px; "|SMG1 |align="left" style="padding-left:10px; font-size:90%;"| |- |align="left" style="padding-left:10px; background: 262626; font-size:90%; border-left: thin solid grey;"|Number of manhacks |align="left" style="padding-left:10px; background: 262626; font-size:90%; border-right: thin solid grey; padding-right:10px; "|None |align="left" style="padding-left:10px; font-size:90%;"| |- |align="left" style="padding-left:10px; background: 262626; font-size:90%; border-left: thin solid grey;"|Pistols start drawn |align="left" style="padding-left:10px; background: 262626; font-size:90%; border-right: thin solid grey; padding-right:10px; "|No |align="left" style="padding-left:10px; font-size:90%;"| |- |colspan="2" style="border-top: thin solid grey;"| || |}

Flag Comments
Checkbox-on.png Simple cops
My output Target entity Target input Parameter Delay Only once Comments
Entity-output-icon.png OnRappelTouchdown police01_jumpss BeginSequence 0.25 Yes
point_template
Class: point_template
Keyvalues Comments
Name police01_template
Template 1 police01
Flag Comments
Checkbox-on.png Preserve entity names
scripted_sequence
Class: scripted_sequence
Keyvalues Comments
Name police01_jumpss
Target NPC police01
Action Animation canal1jump1
Move to Position Run
Flag Comments
Checkbox-on.png No interruptions
Checkbox-on.png Override AI
My output Target entity Target input Parameter Delay Only once Comments
Entity-output-icon.png OnEndSequence police01_ai RevertRelationship
trigger_once

This trigger_once starts the events into place.

Class: trigger_once
Keyvalues Comments
Start disabled No
Flag Comments
Checkbox-on.png Clients
My output Target entity Target input Parameter Delay Only once Comments
Entity-output-icon.png OnTrigger police01_template ForceSpawn 1.0 Yes
Entity-output-icon.png OnTrigger police02_ss BeginSequence 1.0 Yes
Entity-output-icon.png OnTrigger police01 BeginRappel 1.5 Yes
ai_relationship

The ai_relationship is used to keep the first Combine Police from shooting until it has jumped down. The second Combine Police will shoot at will and still jump down.

Note:The scripted_sequence will revert the initial relationship when the sequence has completed.
Class: ai_relationship
Keyvalues Comments
Name police01_ai
Subjects !player
Disposition Like
Start Active Yes
Reciprocal No

On the ground level for the first Combine Police I’ve placed one info_node but even this isn’t needed as its motions are all scripted up until the point where the NPC begins to attack. The effect I’ve created for this NPC is a spot it will jump down to and defend.

The second Combine Police

These are the properties for the second Combine Police.

npc_metropolice
Class: npc_metropolice
Keyvalues Comments
Name Police02
Hint Group jump02
Waiting to rappel No
Weapons Pistol
Number of manhacks None
Pistols start drawn Yes
Flag Comments
Checkbox-on.png Allowed to respond to thrown objects
Checkbox-on.png Fall to Ground
info_node_hint

The info_node_hint entities under and in front of this NPC.

Class: info_node_hint
Keyvalues Comments
Hint Override jump permission
Start disabled No
Hint Group jump02
scripted_sequence

The scripted_sequence used for this NPC.

Note:The flags are very important for our second NPC
Class: scripted_sequence
Keyvalues Comments
Name police02_ss
Target NPC police02
Move to position Run
Flag Comments
Checkbox-on.png No Interruptions
Checkbox-on.png Override AI
Checkbox-on.png Priority Script


See Also