Ai goal follow: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (css)
(removed MaximumState because i could not locate it in any code sources)
Line 1: Line 1:
{{lang|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.
[[File:ai_goal_follow.png|left]]{{base 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.


{{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'''.)}}


{{stray ent|{{css}}}}
This entity is not in {{l4d}} {{l4d2}}.


{{code class|CAI_FollowGoal|ai_behavior_follow.cpp}}
{{code class|CAI_FollowGoal|ai_behavior_follow.cpp}}
Line 16: Line 16:


==Keyvalues==
==Keyvalues==
{{KV|Actor(s) to affect (actor)|target_name_or_class|The name or class of the NPCs that will be following.}}
{{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|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.
:*0: Entity Name ([[targetname]])
:*1: [[Classname]]}}
{{KV|Start Active (StartActive)|bool|Should this entity be active when the map begins?}}
{{KV|Maximum State (MaximumState)|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)}}
{{KV|Formation (Formation)|choices|How close to the target the NPCs should follow.
{{KV|Formation (Formation)|choices|How close to the target the NPCs should follow.
:*0: Close circle
:*0: Close circle
Line 33: Line 24:
:*4: Vortigaunt
:*4: Vortigaunt
{{todo|What exactly do 3 and 4 do?}}}}
{{todo|What exactly do 3 and 4 do?}}}}
{{KV GoalEntity}}
{{KV BaseEntity|base=1|css=1}}
{{KV BaseEntity|base=1|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.}}
{{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.}}
<!--No, unlike NPCs this entity actually does NOT have a corresponding InsideTransition.-->
<!--No, unlike NPCs this entity actually does NOT have a corresponding InsideTransition.-->
{{IO|Activate|Begin the follow behavior.}}
{{I GoalEntity}}
{{IO|Deactivate|Cease the following behavior.}}
{{I BaseEntity|base=1|prel4d=1}}
{{I BaseEntity|base=1|prel4d=1}}


Line 46: Line 37:


[[Category:AI]]
[[Category:AI]]
[[Category:Half-Life 2 Entities]]
[[Category:Alien Swarm Entities]]

Revision as of 07:45, 14 September 2018

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

Template:Base 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.)

This entity is not in Left 4 Dead Left 4 Dead 2.

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

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

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]


Outputs