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

Ai goal follow: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (WisdomBot moved page Ai goal follow to Ai goal follow/en: Moved to {{Multipage}} compliant page name. This action was perfomed by a bot under supervision.)
mNo edit summary
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{langsp}}
{{LanguageBar}}
{{Underlinked|date=January 2024}}
{{This is a|point entity|name=ai_goal_follow|sprite=1|except=Left 4 Dead series}}
{{CD2|CAI_FollowGoal|file1=ai_behavior_follow.cpp}}


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


{{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'''.)}}
{{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'''.)}}
This entity is not in {{l4d}} {{l4d2}}.
{{code class|CAI_FollowGoal|ai_behavior_follow.cpp}}


==ConVars/Commands==
==ConVars/Commands==
{{varcom|start}}
{{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_debug_follow|0|01|Tells when an NPC is having trouble following their leader. Requires {{cmd|developer|1}}. Does not function. {{confirm}}}}
{{varcom|ai_follow_use_points|1|01}}
{{varcom|ai_follow_use_points|1|01}}
{{varcom|ai_follow_use_points_when_moving|1|01}}
{{varcom|ai_follow_use_points_when_moving|1|01}}
Line 18: Line 15:


==Keyvalues==
==Keyvalues==
{{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|Formation (Formation)|choices|How close to the target the NPCs should follow.
{{KV Targetname}}
{{KV|Target Entity|intn=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|Formation|intn=formation|choices|How close to the target the NPCs should follow.
:*0: Close circle
:*0: Close circle
:*1: Medium Circle
:*1: Medium Circle
:*2: Wide circle
:*2: Wide circle
:*3: Sidekick
:*3: Sidekick (mostly same as Medium Circle, but a bit looser range (120 to 160 [[unit]]s) and tries to keep [[LOS]] to the follow target. Used by [[Alyx]] for the majority of '''[[Episode Two|EP2]]''')
:*4: Vortigaunt
:*4: Vortigaunt (mostly same as Sidekick, but operates more freely in combat (can chase enemies within a larger range from the follow target). Used by the Lone [[Vortigaunt|Vort]] in '''EP2''')
{{todo|What exactly do 3 and 4 do?}}}}
}}
{{KV GoalEntity}}
{{KV GoalEntity}}
{{KV BaseEntity|css=1}}


==Inputs==
==Inputs==
{{IO|OutsideTransition|since=EP1|nofgd=1|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 may still ''think'' 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 and ensure NPCs continue to follow. Only available for the HL2 Episodes and Portal.}}
{{I|OutsideTransition|since=EP1|nofgd=1|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 may still ''think'' 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 and ensure NPCs continue to follow. Only available for the HL2 Episodes and Portal.}}
<!--No, unlike NPCs this entity actually does NOT have a corresponding InsideTransition.-->
<!--No, unlike NPCs this entity actually does NOT have a corresponding InsideTransition.-->
{{I GoalEntity}}
{{I GoalEntity}}
{{I BaseEntity|prel4d=1}}


==Outputs==
[[Category:AI]]
{{O BaseEntity}}

Latest revision as of 03:03, 4 April 2025

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

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

C++ class hierarchy
CAI_FollowGoal defined in C++ ai_behavior_follow.cpp
CAI_GoalEntity
CBaseEntity


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

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

Name (targetname) <string>[ Edit ]
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

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.
Formation (formation) <choices>
How close to the target the NPCs should follow.
  • 0: Close circle
  • 1: Medium Circle
  • 2: Wide circle
  • 3: Sidekick (mostly same as Medium Circle, but a bit looser range (120 to 160 units) and tries to keep LOS to the follow target. Used by Alyx for the majority of EP2)
  • 4: Vortigaunt (mostly same as Sidekick, but operates more freely in combat (can chase enemies within a larger range from the follow target). Used by the Lone Vort in EP2)

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

OutsideTransition  (in all games since Half-Life 2: Episode One) !FGD
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 may still think 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 and ensure NPCs continue to follow. Only available for the HL2 Episodes and Portal.

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]