Ai goal operator: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
(-added class hierarchy, cleanup)
 
Line 1: Line 1:
{{LanguageBar}}
{{LanguageBar}}
{{CD|CAI_OperatorGoal|file1=ai_behavior_operator.cpp}}
{{this is a|point entity|game=Half-Life 2 series|name=ai_goal_operator}}
{{this is a|point entity|game=Half-Life 2 series|name=ai_goal_operator}}
It indicates items in the world that some NPCs may operate upon.
It indicates items in the world that some NPCs may operate upon.
Line 5: Line 6:
{{stray ent|{{portal}}}}
{{stray ent|{{portal}}}}


{{code class|CAI_OperatorGoal|ai_behavior_operator.cpp}}
== Keyvalues ==
 
{{KV Targetname}}
==Keyvalues==
{{KV|Position entity|intn=target|target_destination|Name of the entity that the NPC should move to in order to perform the operation.}}
{{KV|Position entity (target)|target_destination|Name of the entity that the NPC should move to in order to perform the operation.}}
{{KV|Context target|intn=contexttarget|target_destination|(Optional) Name of an entity that the operator will use within context.}}
{{KV|Context target (contexttarget)|target_destination|(Optional) Name of an entity that the operator will use within context.}}
{{KV|Initial State|intn=state|choices|How the operated entity starts.
{{KV|Initial State (state)|choices|How the operated entity starts.
:*1: Not ready (closed, locked, etc)
:*1: Not ready (closed, locked, etc)
:*2: Ready (open and accessible)}}
:*2: Ready (open and accessible)}}
{{KV|How should NPC approach? (moveto)|choices|{{confirm|Not implemented?}}
{{KV|How should NPC approach?|intn=moveto|choices|{{confirm|Not implemented?}}
:*0: Don't approach
:*0: Don't approach
:*1: Walk
:*1: Walk
:*2: Run}}
:*2: Run}}
{{KV GoalEntity}}
{{KV GoalEntity}}
{{KV BaseEntity|base=1}}


==Inputs==
==Inputs==
{{IO|SetStateReady|Set the object's state to ''Ready''. Fire this input when the object has been unlocked/opened or otherwise made ready for interaction.}}
{{I|SetStateReady|Set the object's state to ''Ready''. Fire this input when the object has been unlocked/opened or otherwise made ready for interaction.}}
{{IO|SetStateFinished|Fire this input when the NPC has completed the interaction with this object.}}
{{I|SetStateFinished|Fire this input when the NPC has completed the interaction with this object.}}
{{I GoalEntity}}
{{I GoalEntity}}
{{I BaseEntity|base=1|prel4d=1}}


==Outputs==
==Outputs==
{{IO|OnBeginApproach|Fired when the NPC begins to approach the position.}}
{{O|OnBeginApproach|Fired when the NPC begins to approach the position.}}
{{IO|OnMakeReady|Fired when the item is ready to operate.}}
{{O|OnMakeReady|Fired when the item is ready to operate.}}
{{IO|OnBeginOperating|Fired when the NPC is ready to operate.}}
{{O|OnBeginOperating|Fired when the NPC is ready to operate.}}
{{IO|OnFinished|Fired when <code>SetStateFinished</code> is sent to the entity.}}
{{O|OnFinished|Fired when <code>SetStateFinished</code> is sent to the entity.}}
{{O BaseEntity}}


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

Latest revision as of 13:34, 25 September 2024

English (en)Translate (Translate)
C++ Class hierarchy
CAI_OperatorGoal
CAI_GoalEntity
CBaseEntity
C++ ai_behavior_operator.cpp

ai_goal_operator is a point entity available in Half-Life 2 series Half-Life 2 series. It indicates items in the world that some NPCs may operate upon.

Note.pngNote:This entity is also in the code for Portal. Its functionality is not guaranteed.


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

Position entity (target) <targetname>
Name of the entity that the NPC should move to in order to perform the operation.
Context target (contexttarget) <targetname>
(Optional) Name of an entity that the operator will use within context.
Initial State (state) <choices>
How the operated entity starts.
  • 1: Not ready (closed, locked, etc)
  • 2: Ready (open and accessible)
How should NPC approach? (moveto) <choices>
Confirm:Not implemented?
  • 0: Don't approach
  • 1: Walk
  • 2: Run

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

SetStateReady
Set the object's state to Ready. Fire this input when the object has been unlocked/opened or otherwise made ready for interaction.
SetStateFinished
Fire this input when the NPC has completed the interaction with this object.

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

OnBeginApproach
Fired when the NPC begins to approach the position.
OnMakeReady
Fired when the item is ready to operate.
OnBeginOperating
Fired when the NPC is ready to operate.
OnFinished
Fired when SetStateFinished is sent to the entity.