Ai goal follow: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (removed {{DISPLAYTITLE}}, covered by the hl2 point template)
(updates)
Line 1: Line 1:
{{hl2 point|ai_goal_follow}}
{{lang|Ai goal follow}}
[[File:ai_goal_follow.png|left]]{{hl2 point|ai_goal_follow}} It makes the target [[NPC]]s follow another object or the player at a configurable distance. NPCs may react in some way if they can't path to their leader.


==Entity description==
{{note|NPCs do not intelligently follow their leader. They will simply walk or run depending on distance directly towards it. If the followers happen to block a path, they will not move out of the way and the leading NPC will eventually give up trying to path. (Depends on '''Formation'''.)}}
[[Image:ai_goal_follow.png|left]]Makes the target [[NPC]]s follow another object or the player at a configurable distance.{{clr}}


===Limitations and bugs===
{{code class|CAI_FollowGoal|ai_behavior_follow.cpp}}
* NPCs do not intelligently follow their target. They will instead walk or run depending on distance directly towards it.
 
* If NPCs are following another NPC and that NPC needs to get past them, they will not move out of the way and the leading NPC will eventually give up.
==ConVars/Commands==
* Keyvalues cannot be changed once the map has been compiled.
{{varcom|start}}
{{varcom|ai_debug_follow|0|01|Tells when an NPC is having trouble following their leader. Requires {{ent|developer|1}}. Does not function. {{confirm}}}}
{{varcom|ai_follow_use_points|1|01}}
{{varcom|ai_follow_use_points_when_moving|1|01}}
{{varcom|end}}


==Keyvalues==
==Keyvalues==
{{ScrollBox|title=Keyvalues|
{{KV|Actor(s) to affect (actor)|target_name_or_class|The name or class of the NPCs that will be following.}}
{{KV Targetname}}
{{KV|Target Entity (goal)|string|The name of the entity that the NPCs should follow. If this value is blank, NPCs will follow the player, if they are friendly towards them.}}
 
{{KV|Search Type (SearchType)|choices|How to search for the entities using the name specified in the '''Actor(s) to affect''' keyvalue.
{{KV|Actor(s) to affect|target_name_or_class|The name of the NPCs that will be following.}}
:*0: Entity Name ([[targetname]])
 
:*1: [[Classname]]}}
{{KV|Target Entity|string|The name of the entity that the NPCs should follow.
{{KV|Start Active (StartActive)|bool|Should this entity be active when the map begins?}}
:* If this value is blank, NPCs will follow the player if they are friendly towards him.}}
{{KV|Maximum State (MaximumState)|choices|The maximum state for NPCs to continue following.
 
:*0: Idle (stop following when NPC senses danger)
{{KV|Search Type|choices|How to search for the entities using the name specified in the ''actorname'' keyvalue. The ''Entity Name'' choice will make the engine search for a ''targetname'' of an entity, while the ''Classname'' choice will make it search for the name of an entity class (like ''npc_headcrab'').}}
:*1: Alert (stop following when combat arises)
:* 0 : Entity Name
:*2: Combat (never stop following)}}
:* 1 : Classname
{{KV|Formation (Formation)|choices|How close to the target the NPCs should follow.
 
:*0: Close circle
{{KV|Start Active|bool|Should this entity be active when the map begins?}}
:*1: Medium Circle
 
:*2: Wide circle
{{KV|Maximum State|choices|The maximum state for NPCs to continue following.}}
:*3: Sidekick
:* 0 : Idle
:*4: Vortigaunt
:* 1 : Alert
{{todo|What exactly do 3 and 4 do?}}}}
:* 2 : Combat
{{KV BaseEntity|base=1}}
 
{{KV|Formation|choices|How close to the target the NPCs should follow.}}
:* 0 : Close circle
:* 1 : Medium Circle
:* 2 : Wide circle
:* 3 : Sidekick
:* 4 : Vortigaunt  
}}


==Inputs==
==Inputs==
{{I Targetname}}
{{IO|OutsideTransition|since=EP1|Usually this is automatically done by a {{ent|trigger_transition}} when the map changes, but it can be done manually as well. It sends the entity into a "dormant" state where it is disabled even though the entity still ''thinks'' it is active. This is done in the case that the player decides to go back to a previous map, where the entity will then become non-dormant again.}}
 
<!--No, unlike NPCs this entity actually does NOT have a corresponding InsideTransition.-->
{{IO|Activate|Begin the follow behavior.}}
{{IO|Activate|Begin the follow behavior.}}
{{IO|Deactivate|Cease the following behavior.}}
{{IO|Deactivate|Cease the following behavior.}}
{{I BaseEntity|base=1}}


==Outputs==
==Outputs==
{{O Targetname}}
{{O BaseEntity}}


[[Category:AI]]
[[Category:AI]]
[[Category:Entities]]

Revision as of 11:45, 3 September 2018

English (en)Translate (Translate)
Ai goal follow.png

Template:Hl2 point It makes the target NPCs follow another object or the player at a configurable distance. NPCs may react in some way if they can't path to their leader.

Note.pngNote:NPCs do not intelligently follow their leader. They will simply walk or run depending on distance directly towards it. If the followers happen to block a path, they will not move out of the way and the leading NPC will eventually give up trying to path. (Depends on Formation.)
C++ In code, it is represented by theCAI_FollowGoalclass, defined in theai_behavior_follow.cppfile.

ConVars/Commands

Cvar/Command Parameters or default value Descriptor Effect
ai_debug_follow 0 0 disables, 1 enables Tells when an NPC is having trouble following their leader. Requires developer 1. Does not function. [confirm]
ai_follow_use_points 1 0 disables, 1 enables
Todo: Effect description.
ai_follow_use_points_when_moving 1 0 disables, 1 enables
Todo: Effect description.

Keyvalues

Actor(s) to affect (actor) ([todo internal name (i)]) <target_name_or_class>
The name or class of the NPCs that will be following.
Target Entity (goal) ([todo internal name (i)]) <string>
The name of the entity that the NPCs should follow. If this value is blank, NPCs will follow the player, if they are friendly towards them.
Search Type (SearchType) ([todo internal name (i)]) <choices>
How to search for the entities using the name specified in the Actor(s) to affect keyvalue.
Start Active (StartActive) ([todo internal name (i)]) <boolean>
Should this entity be active when the map begins?
Maximum State (MaximumState) ([todo internal name (i)]) <choices>
The maximum state for NPCs to continue following.
  • 0: Idle (stop following when NPC senses danger)
  • 1: Alert (stop following when combat arises)
  • 2: Combat (never stop following)
Formation (Formation) ([todo internal name (i)]) <choices>
How close to the target the NPCs should follow.
  • 0: Close circle
  • 1: Medium Circle
  • 2: Wide circle
  • 3: Sidekick
  • 4: Vortigaunt
Todo: What exactly do 3 and 4 do?


Inputs

OutsideTransition  (in all games since Half-Life 2: Episode One)
Usually this is automatically done by a trigger_transition when the map changes, but it can be done manually as well. It sends the entity into a "dormant" state where it is disabled even though the entity still thinks it is active. This is done in the case that the player decides to go back to a previous map, where the entity will then become non-dormant again.
Activate
Begin the follow behavior.
Deactivate
Cease the following behavior.


Outputs