WiseNPC06: NPC Helicopter
This tutorial was originally created by wisemx. It was originally posted on SDKnuts.net.
Introduction
Events in this project:
- Helicopter takes off.
- Begins patrol of the area.
- Drops a single bomb.
- Begins shooting at Rebel Citizen.
- Citizen fires Rocket and destroys Chopper.
From my experience npc_helicopter takes trial and error to get it performing the way you want. On the other hand it’s loaded with options. With its extensive IO commands you have a lot of control over this beast. Experiment with the sample file below, add more inputs for it, get it to make a bombing run, etc.
Navigation for the npc_helicopter
is done with path_track and info_node_air entities. It has a nice AI system that will allow it to patrol the area where you place these entities. Navigation for the npc_citizen is done by placing info_node entities on the ground. Some of the aspects of the Chopper that I don’t cover in this project are the avoidance and target systems you can use.
Creation
In this project I simply added one path_track
gave it a name and then with it selected held ⇧ Shift and I would drag a clone to a new location. The process was repeated until all four were created then for the forth I added the name of the first path_track
as its Next Stop Target. The whole process only takes a few seconds. The
info_node_air
entities are placed randomly around the map to give the Chopper a running path away from the tracks. It will drift along the combination of these entities.
These are the properties for each of the entities used in this project.
npc_helicopter
:
- Name: heli01
- Flags: Loud Rotor wash sound, Helicopter lights, More aggressive attacks, Await input, Fall to ground, Long Visibility
My Output
Target Entity
Target Input
Parameter
Delay
Only Once
OnDamaged
heli01
Break
0.25
Yes
Once the Citizen fires a rocket at the Chopper, and hits it, the Chopper will break apart 0.25 seconds later. Remove this behavior for the normal effect; it will take around 20 rockets to destroy it. (Porter's note: Exactly what difficulty setting are you ON?)
npc_citizen
:
- Name: cit01
- Damage filter: damagefilter1
- Weapons: RPG
- Type: Rebel
- Model: Female 1
- Flags: Random Head, Not commandable, Random female head, Fall to ground, Long Visibility, Fade corpse
By adding this damage filter the Chopper will not be able to hurt our Citizen.
- Class: filter_damage_type
- Name: damagefilter1
- Filter mode: Allow entities that match criteria
- Damage type: GENERIC
Each of the key players in this project has an ai_relationship.
- Name: ai01, ai02 and ai03
- Subject: cit01, heli01 and heli01
- Target: heli01, cit01 and !player
- Disposition: Hate, Like and Neutral
- Radius for subject: 0
- Disposition priority: 100, 5 and 5
- Start active: No, Yes and Yes
- Reciprocal: No
To start all of the events a trigger_once is placed where the Player will spawn. (Porter's note: Uh. logic_auto?)
Notice that all of the work is done from this one trigger. The key is getting the timing right. By adding a few scripted sequences this scene could really come to life.
See also