WiseNPCrappel

From Valve Developer Community
Revision as of 16:27, 17 February 2008 by Plykkegaard (talk | contribs) (Added category)
Jump to navigation Jump to search

NPC police pappel

Note.pngNote:This is part of a series of tutorials on NPC’s.
Rapelling

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

  1. Player spawns in cement room with hole in ceiling.
  2. Combine Police rappels from hole.
  3. 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.

  1. 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.
  2. You don’t need the aiscripted_schedule. But it is a simple addition creating a much better effect.

The simple method is to:

  1. Place an npc_metropolice entity in the map where you want it to rappel from.
  2. Set the property Waiting to rappel to Yes.
  3. From any other entity, like a trigger, send the command BeginRappel.

Using the simple method requires that you hide the npc_metropolice until its time to rappel.

In this project the trigger_once is used to spawn the npc_metropolice by way of a npc_template_maker.

Class: trigger_once

  • Start disabled: No
  • Flags:
  • Clients: Checked
  • Output:
  • OnTrigger, rappel1maker, Spawn

Class: npc_template_maker

  • Name: rappel1maker
  • Start disabled: Yes
  • Num of NPCs: 1
  • Frequency: 1
  • Max live NPCs: 1
  • Name of template NPC: rappel1
  • Output: OnSpawnNPC, rappel1, BeginRappel, 0.25

Class: npc_metropolice

  • Name: rappel1
  • Waiting to Rappel: Yes
  • Weapons: SMG1
  • Number of Manhacks: None
  • Pistol starts Drawn: Yes
  • Flags:
  • Simple cops, Checked
  • Fall to ground, Checked
  • Template NPC, Checked
  • Output:
  • OnRappelTouchdown, rappel1ss, StartSchedule, 0.0

Class: aiscripted_schedule

  • Name: rappel1ss
  • Target NPC: rappel1
  • 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 thë 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.

Wrap up

There’s a lot more you can do, hopefully this article have stimulated your imagination.

Credits