This article's documentation is for anything that uses the Source engine. Click here for more information.

ai_goal_lead

From Valve Developer Community
Jump to: navigation, search
English (en)Translate (Translate)
Class hierarchy
CAI_LeadGoal
CAI_GoalEntity
CBaseEntity
ai_behavior_lead.cpp
Ai goal lead.png

ai_goal_lead is a point entity available in all Source Source games except Left 4 Dead series Left 4 Dead series.

It makes an NPC attempt to lead the player to a target. If the player doesn't follow or lags behind, the NPC will wait for the player or attempt to "retrieve" them. This entity has many options to control its behavior, including extra Response System support. Good examples of its use are on Half-Life 2d2_coast_10 after killing the gunship, and on Half-Life 2d2_coast_11 when the vortigaunt tells the player to follow.


Flags

AI_LeadGoal:

  • 1: No def success
  • 2: No def failure
  • 4: Use goal facing
Todo: Clarify what these do?

Keyvalues

Name (targetname) <string>
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

AI_LeadGoal:

Target Entity (goal) <targetname>
The name of the entity that the NPC will lead the player to (i.e. an info_target).
Point to wait at if the target's not visible (WaitPointName) <targetname>
If the NPC loses line-of-sight to the player, it will return to this entity (i.e. an info_target).
Wait until player gets this close (WaitDistance) <float>
The player must be within this distance of the NPC before the NPC initially begins leading them.
Lead Distance (LeadDistance) <float>
The player is considered to be too far behind if they're beyond this distance. Past this distance, the leader will nag the player to hurry up.
Retrieve Distance (RetrieveDistance) <float>
The distance from the player that the NPC should return to when retrieving a lagging player. Must be between ('Lead Distance' + 24) and ('Lead Distance' * 4) to avoid the leader ping-ponging.
Success Distance (SuccessDistanc)) <float>
The distance from the player (to the NPC) that the player must be within for the Lead to succeed, once the NPC has reached the goal. If set to 0, it'll use the lead distance instead (for legacy support).
Run instead of Walk (Run) <choices>
Should the NPC run instead of walk?
  • 1: No
  • 2: Yes
Retrieve player? (Retrieve) <choices>
Retrieve player?
  • 1: No, just idle and wait
  • 2: Yes, move to retrieve
Before Coming Back, Wait for Speech? (ComingBackWaitForSpeak) <choices>
Before Coming Back, Wait for Speech?
  • 1: No, come back while speaking
  • 2: Yes, wait for speech to finish
On Retrieve, Wait for Speech? (RetrieveWaitForSpeak) <choices>
On Retrieve, Wait for Speech?
  • 1: No, start leading while speaking
  • 2: Yes, wait for speech to finish
Speak start greeting? (DontSpeakStart) <choices>
On Retrieve, Wait for Speech?
  • 1: No, don`t speak the greeting
  • 2: Yes, speak the greeting
Leading during combat? (LeadDuringCombat) <choices>
Leading during combat?
  • 1: No. Stop to fight, resume leading when safe
  • 2: Yes, lead while fighting.
Gag leader? (GagLeader) <choices>
  • 1: No. Speak lead concepts normally, respecting other lead speech settings.
  • 2: Yes, don't speak any lead concepts at all, overriding all other lead speech settings.
Attract player concept modifier (AttractPlayerConceptModifier) <string>
Appended to the keyvalues passed into the response rules when the TLK_LEAD_ATTRACTPLAYER concept is spoken.
Player wait over concept modifier (WaitOverConceptModifier) <string>
Appended to the keyvalues passed into the response rules when the TLK_LEAD_WAITOVER concept is spoken.
Arrival concept modifier (ArrivalConceptModifier) <string>
Appended to the keyvalues passed into the response rules when the TLK_LEAD_ARRIVAL concept is spoken.
Post-arrival concept modifier (PostArrivalConceptModifier) <string>
Confirm:Seems to not be fully implemented?
Success concept modifier (SuccessConceptModifier) <string>
Appended to the keyvalues passed into the response rules when the TLK_LEAD_SUCCESS concept is spoken.
Failure concept modifier (FailureConceptModifier) <string>
Appended to the keyvalues passed into the response rules when the lead_fail concept is spoken.
Coming Back concept modifier (ComingBackConceptModifier) <string>
Appended to the keyvalues passed into the response rules when the TLK_LEAD_RETRIEVE concept is spoken. Spoken as the NPC starts returning to the player to retrieve them.
Retrieve concept modifier (RetrieveConceptModifier) <string>
Appended to the keyvalues passed into the response rules when the TLK_LEAD_COMINGBACK concept is spoken. Spoken when NPC has finally reached the player to retrieve them.

AI_GoalEntity:

Actor(s) to affect (actor) <target_name_or_class>
The targetname or classname of any NPCs that will be included in this goal. Wildcards are supported.
Search Type (SearchType) <choices>
What the Actor(s) to affect keyvalue targets by.
  • 0: Entity Name
  • 1: Classname
Start Active (StartActive) <boolean>
Set if goal should be active immediately.

Inputs

AI_LeadGoal:

SetSuccess
Notify success of leading. Not required, use only if the standard code for detecting success does not meet your needs or fails.
SetFailure
Notify failure of leading.
Note.pngNote:Not implemented.

AI_GoalEntity:

Activate
Make the goal active if it wasn't already. NPCs will begin taking orders.
Deactivate
Make goal inactive.
UpdateActors  !FGD
Tell the goal entity to re-check Actor(s) to affect in case any disappeared, or any new NPCs spawned.[confirm]

Outputs

AI_LeadGoal:

OnArrival
Fired when NPC reaches the lead point. (Player may still be behind)
OnArrivalDone
Fired when NPC has played out any arrival speech.
OnSuccess
Fired when NPC achieves the goal.
OnFailure
Fired when NPC fails to achieve the goal.
OnDone
Fired when NPC completes behavior (any post-success or fail acting is complete).

See also