WisePounder: Zombie Pounder
This tutorial was originally created by wisemx. It was originally posted on SDKnuts.net.
Events in this project:
- Zombie tries to break glass to get to Alyx.
- Glass breaks, Zombie attacks, Alyx shoots Zombie.
The Zombie isn’t really trying to get to Alyx, it just looks that way. When the map spawns I’m using ai_relationship entities and an npc_bullseye. It’s actually the invisible npc_bullseye
the Zombie hates.
There are three ai_relationship
entities in this project.
- Alyx likes the Zombie, until the glass breaks, then hates the Zombie.
- Zombie hates the
npc_bullseye
. - Zombie likes the Player.
They all start Active.
To get the Zombie to pound on the glass I used a scripted_sequence.
- Name: seq_pounder
- Target NPC: zombie_pounder
- Action Animation: WallPound
- Move to Position: Run
- Flags: Repeatable, Override AI
Because the WallPound animation is short I’ve used a logic_timer to replay the animation.
- Name: zombie_timer
- Start Disabled: Yes
- Use random time: No
- Refire interval: 1
My Output | Target Entity | Target Input | Parameter | Delay | Only Once | |
---|---|---|---|---|---|---|
OnTimer | glass_counter | Add | 1 | 0.00 | No | |
OnTimer | seq_pounder | BeginSequence | 0.50 | No |
Notice the logic_timer
adds a value to a math_counter. These are really simple to use if you give them a chance.
- Name: glass_counter
- Initial value: 0
- Min value: 0
- Max value: 3
My Output | Target Entity | Target Input | Parameter | Delay | Only Once | |
---|---|---|---|---|---|---|
OnHitMax | bigwindow | Break | 0.50 | Yes |
Experiment with the timing of the sequence and the Max value for the math_counter
to alter the effect.
When the map loads the Zombie is spawned and the logic_timer
is then activated 3 seconds later. This is done with a trigger_once.
My Output | Target Entity | Target Input | Parameter | Delay | Only Once | |
---|---|---|---|---|---|---|
OnTrigger | glass_pounder_spawn | Spawn | 0.00 | Yes | ||
OnTrigger | zombie_timer | Enable | 3.00 | Yes |
The Zombie is spawned by way of an npc_template_maker.
- Name: glass_pounder_spawn
- Start disabled: Yes
- Number of NPCs: 1
- Freq: 1
- Max live: 1
- Name of template NPC: zombie_pounder
- Radius: 256
My Output | Target Entity | Target Input | Parameter | Delay | Only Once | |
---|---|---|---|---|---|---|
OnSpawnNPC | seq_pounder | BeginSequence | 1.50 | Yes |
As you can see, from this npc_template_maker
the scripted_sequence
is first activated.
These are the properties for Alyx:
- Name: alyx01
- Weapon: Alyx Gun
- Flags: Gag, Fall to ground, Think outside PVS, Don’t drop weapons
Zombie:
- Name: zombie_pounder
- Flags: Gag, Fall to ground, Template NPC
As you can see from the image below there are a lot of entities used in this project.
It helps if you keep them tidy like the image above, as you add more and more NPC’s and sequences you don’t want to go crazy trying to figure out what you’ve done. The glass in this project is func_breakable_surf. Please refer to the project file below for properties and settings I didn't list on this page.