WiseNPCrappel: NPC police rappel
This tutorial was originally created by wisemx. It was originally posted on SDKnuts.net.
The sample file for this project, at the page bottom, illustrates:
- Player spawns in cement room with hole in ceiling.
- Combine police rappels from hole.
- Once on ground begins attacking player.
These are very simple to setup in your maps.
I’m doing more in this project than is necessary.
- You don’t have to spawn the NPC with an
npc_template_maker
. Using one however is better on performance and keeps the NPC hidden until needed. - You don’t need the
aiscripted_schedule
. But it is a simple addition creating a much better effect.
The simple method is to:
- Place an
npc_metropolice
entity in the map where you want it to rappel from. - Set the property Waiting to rappel to Yes.
- From any other entity, like a trigger, send the input
BeginRappel
.
Using the simple method requires that you hide the npc_metropolice
until its time to rappel.
Contents
Entities
In this project the trigger_once
is used to spawn the npc_metropolice
by way of an npc_template_maker
.
trigger_once
Class: trigger_once | ||
Keyvalues | Comments | |
Start disabled | No | |
Flag | ||||
Clients | ||||
My output | Target entity | Target input | Parameter | Delay | Only once | Comments | ||
OnTrigger | rappel1maker | Spawn | ||||||
npc_template_maker
Class: npc_template_maker | ||
Keyvalues | Comments | |
Start disabled | Yes | |
Num of NPCs | 1 | |
Frequency | 1 | |
Max live NPCs | 1 | |
Name of template NPC | rappel1 | |
My output | Target entity | Target input | Parameter | Delay | Only once | Comments | ||
OnSpawnNPC | rappel1 | BeginRappel | 0.25 | |||||
npc_metropolice
Class: npc_metropolice | ||
Keyvalues | Comments | |
Waiting to Rappel | Yes | |
Weapons | SMG | |
Number of manhacks | None | |
Pistols start drawn | Yes | |
Flag | ||||
Clients | ||||
Simple cops | ||||
Fall to ground | ||||
Template NPC | ||||
My output | Target entity | Target input | Parameter | Delay | Only once | Comments | ||
OnRappelTouchdown | rappel1ss | StartSchedule | 0.0 | |||||
aiscripted_schedule
Class: aiscripted_schedule | ||
Keyvalues | Comments | |
Name | rappel1ss | |
AI state to set | Set state to COMBAT | |
Schedule to run | Set enemy to Goal Entity AND Run to Goal Entity | |
Interruptability | Damage or Death | |
Goal entity | !player | |
Setup in Hammer
In the image below you can see the npc_metropolice
waiting to rappel, and the trigger_once
that will begin the rappel.
I’ve placed info_node
entities on the ground in random spots to give the NPC Police walking hints.
That’s all there is to it. Give them enough room to rappel and they can drop off ledges, from planes or out of holes in the ceiling.