CAI_LeadGoal

From Source Entities
Jump to navigation Jump to search

Present in:
Css.pngCS:S
Dods.pngDOD:S
Hl2.pngHL2
Hl2-episodes.pngEp1&2
Hl2dm-custom.pngHL2:DM
P1.pngPortal
Tf2.pngTF2
Asw.pngASW
P2.pngPortal 2
Csgo.pngCS:GO

Code classes:

Ai goal lead.png

CAI_LeadGoal is a code class for entities that make 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.

Classnames:

  • ai_goal_lead

Flags[edit | edit source]

  • 1: No def success
  • 2: No def failure
  • 4: Use goal facing

Keyvalues[edit | edit source]

Target Entity (goal) <string>
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) <target_destination>
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 X 4) to avoid the leader ping-ponging.
Success Distance (SuccessDistance) <float>
Once the NPC has reached the goal, the player must be within this distance in order for the lead to be considered a success. If set to 0, it'll use the Lead Distance instead.
Run instead of Walk (Run) <boolean>
Should the NPC run instead of walk?
Retrieve player? (Retrieve) <boolean>
Should NPC run/walk to retrieve player? No means they will stand and wait.
Before Coming Back, Wait for Speech? (ComingBackWaitForSpeak) <boolean>
If the NPC wants to retrieve the player, should it finish speaking anything before beginning to walk back?
On Retrieve, Wait for Speech? (RetrieveWaitForSpeak) <boolean>
When the NPC has successfully retrieved the player, should it pause to say dialogue before they begin walking again?
Speak start greeting? (DontSpeakStart) <choices>
Speak start greeting?
  • 0: Yes
  • 1: No
Leading during combat? (LeadDuringCombat) <boolean>
Does NPC still try to lead during active combat?
  • 0: No. Stop to fight, resume leading when safe
  • 1: Yes, lead while fighting.
Gag leader? (GagLeader) <boolean>
Should the leader NPC be prevented from speaking?
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>
To do: Description.
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 TLK_LEAD_FAILURE 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.

Inputs[edit | edit source]

SetSuccess
Force the lead to be considered a success. Not required, use only if the standard code for detecting success does not meet your needs or fails for some reason.
SetFailure
Don't use. Using only reports that the input is not implemented.

Outputs[edit | edit source]

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).