WiseNPC03: NPC Act busy with Sequence

From Valve Developer Community
Jump to navigation Jump to search


This tutorial was originally created by wisemx. It was originally posted on SDKnuts.net.

In this tutorial we are going to transition from a scripted_sequence directly into an ai_goal_actbusy. This project is an extension of WiseNPC01. I started with that vmf and added the ai_goal_actbusy, which will cause Alyx to kneel down. I used info_node entities in this one rather than the more advanced info_node_hint entities so the one info_node_hint in this tutorial will stand out. Both of these are nodes for ground based NPC’s and serve the same basic purpose however info_node_hint has many more features.

There are two series of sequences going on in this project:

  1. A sound is heard, Alyx runs across the screen, walks back then kneels down in front of a grave.
  2. A Nova Prospect soldier is pacing back-and-forth behind the grave.

I added an ai_relationship so Alyx and the Combine Soldier won’t fight.

  • Subject: combine01 (Name of the Combine Soldier)
  • Target: walking (Name of Alyx in this project)
  • Disposition: Neutral
  • Disposition Priority: 100
  • Start Active: Yes
  • Reciprocal: Yes

So we can get Alyx to kneel an ai_goal_actbusy entity was added.

  • Name: actbusy
  • Actor to affect: walking
  • Start Active: Yes
  • Search Type: Entity Name
  • Search range: 1200
  • Visible Busy Hints Only: No

One info_node_hint was placed under the last scripted_sequence.

  • Name: kneelhint
  • Hint: World: Act Busy Hint
  • Hint Activity: D1_C01a_Mary_kneel
  • Node FOV: 360 Degrees
  • Start Hint Disabled: No
  • Ignore Facing: Yes

When Alyx gets to the last scripted_sequence this Output is fired:

  My Output Target Entity Target Input Parameter Delay Only Once
Io11.png OnEndSequence actbusy ForceThisNPCToActBusy walking 0.00 No

The npc_combine_s pacing back-and-forth is done with two scripted_sequences. These Flags are checked on each of them: Repeatable, No Interruptions, Override AI.

The Target NPC for each of these is our npc_combine_s combine01.

Move to Position is Walk for both.

These are the two Outputs that make it work:

  My Output Target Entity Target Input Parameter Delay Only Once
Io11.png OnEndSequence combiness02 BeginSequence 0.00 No
Io11.png OnEndSequence combiness01 BeginSequence   0.00 No

On map spawn our logic_auto adds this Output to start the Soldier pacing:

  My Output Target Entity Target Input Parameter Delay Only Once
Io11.png OnMapSpawn combiness01 BeginSequence 0.00 No

This project was simple to create but has a lot going on now. Compile it and have a look.

See also