ai_goal_actbusy_queue

From Valve Developer Community
Jump to: navigation, search

ai_goal_actbusy_queue is a point entity available in the following Source Source games or engine branches:
Half-Life 2 Half-Life 2 and Alien Swarm Alien Swarm.

English (en)
Edit
This entity managed the food line in d1_trainstation_02.

It can do anything that an ai_goal_actbusy can do, except this entity is designed to order actbusy hints and NPCs in a queue. The queue can be moved forward, and when the first NPC in the queue leaves, it can be given orders.

Icon-Bug.pngBug:Hint activities must not require exiting, or the queue will freeze.
Icon-Bug.pngBug:Source 2006: Sometimes you want to switch between busy systems that you have, but direct call of it in your busy entity with OnNpcFinishedBusy->ForceNPCToActBusy works incorrectly and new one busy system npc grabbs extra npc from your queue.

You can't just use a small delay there, cause it still interrupts extra other npc from queue and npc, who finished his busy activity react immediately, causing whole queue to stuck by his movements, cause he didn't proceed to exit node, also, you can't use OnNpcLeft and OnNpcLeftQueue (it just won't work in this case).

Tip.pngTip:To avoid this you can use this workaround:
OnNPCFinishedBusy !activator AddOutput OnUser1 busy_relay:Trigger
OnNPCFinishedBusy !activator FireUser1 <delay:0.20>

In your logic_relay (busy_relay) you can set a delay to wait for npc before switching to other ai_goal_actbusy system like this:

OnTrigger actbusy_street_new ForceNPCToActBusy !activator <delay>

This entity is also in the code for Portal Portal 2. Its functionality is not guaranteed.


In code, it is represented by theCAI_ActBusyQueueGoalclass, defined in theai_behavior_actbusy.cppfile.

Keyvalues

Exit Node (node_exit) <targetname>
The name of the first node (info_node_hint or path_corner) the first NPC in the queue should head to when leaving the queue. Required.
Node 1 (node01) to Node 20 (node20) <targetname>
Used for defining the path of the queue, with info_node_hints. Node 1 is the front of the queue. The number of defined nodes defines the maximum number of NPCs queuing.
Must Reach Front (mustreachfront) <choices>
If true, an NPC must strictly be at Node 1 before being able to leave the queue.
  • 0: No
  • 1: Yes

AI_ActBusyGoal:

Search Range for Busy Hints (busysearchrange) <float>
Maximum distance between an actbusy hint and NPC for the NPC to consider it.
Visible Busy Hints Only (visibleonly) <boolean>
If set, an NPC will only consider actbusy hints in view when deciding which to use. Once the choice has been made it will not change, even if new hints become visible.
Actbusy Type (type) <choices>
Is this Actbusy part of combat? For use with Combat Safe Zone.
  • 0: Default (Standard)
  • 1: Combat
Allow actor to teleport? (alllowteleport) <boolean>
Sight Entity (seeentity) <targetname>
Optionally, if the Actor playing the ActBusy loses sight of this specified entity for an amount of time defined by Sight Entity Timeout, the specified entity will leave the ActBusy.
Note.pngNote:Only targetnames are allowed, not classnames!
Sight Entity Timeout (seeentitytimeout) <float>
Time in seconds to wait for an Actor to see the Sight Entity again before the entity may leave the ActBusy.
Sight Enemy Method (sightmethod) <choices>
How to determine if the Actor sees the Sight Entity.
  • 0: Default. LOS -and- Viewcone.
  • 1: LOS Only. Disregard Viewcone.
Combat Safe Zone (safezone) <targetname>
Specify a brush entity to act as a safe zone if Actbusy Type is set to Combat. If any enemies are in the safe zone, the actbusy will break.
Blank image.pngTodo: Will actors go back to the actbusy once enemies are dead? What if they leave the safe zone but are still alive?

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.

Base:
Name (targetname) <string>
The name that other entities use to refer to this entity.
Parent (parentname) <targetname>
Maintain the same initial offset to this entity. An attachment point can also be used if separated by a comma at the end. (parentname [targetname],[attachment])
Tip.pngTip:Entities transition to the next map with their parents
Tip.pngTip:phys_constraint can be used as a workaround if parenting fails.
Origin (X Y Z) (origin) <coordinates>
The position of this entity's center in the world. Rotating entities typically rotate around their origin.
Note.pngNote:Hammer does not move the entities accordingly only in the editor.
Pitch Yaw Roll (X Y Z) (angles) <angle>
This entity's orientation in the world. Pitch is rotation around the Y axis, yaw is the rotation around the Z axis, roll is the rotation around the X axis.
Note.pngNote:This works on brush entities, although Hammer doesn't show the new angles.
Classname (classname) <string> !FGD
Determines the characteristics of the entity before it spawns.
Tip.pngTip:Changing this on runtime still has use, like making matching an entry in S_PreserveEnts will persist the entity on new rounds!
Flags (spawnflags) <integer> !FGD
Toggles exclusive features of an entity, its specific number is determined by the combination of flags added.
Effects (effects) <integer> !FGD
Combination of effect flags to use.
Entity Scripts (vscripts) <scriptlist> (in all games since Left 4 Dead 2) (also in Team Fortress 2)
Space delimited list of VScript files (without file extension) that are executed after all entities have spawned. The scripts are all executed in the same script scope, later ones overwriting any identical variables and functions. Scripts executed on the worldspawn entity will be placed in root scope.
Think function (thinkfunction) <string> (in all games since Left 4 Dead 2) (also in Team Fortress 2)
Name of the function within this entity's script that'll be called automatically every 100 milliseconds, or a user-defined interval if the function returns a number. Avoid expensive operations in this function, as it may cause performance problems.
Lag Compensation (LagCompensate) <boolean> (in all games since Left 4 Dead 2) !FGD
Set to Yes to lag compensate this entity. Should be used very sparingly!

Inputs

MoveQueueUp
Moves all NPCs in the queue up one position, and sends the first NPC to the Exit Node.
PlayerStartedBlocking <float>
Tell the queue manager that the player has started blocking a specified point in the queue.
PlayerStoppedBlocking <float>
Tell the queue manager that the player has stopped blocking a specified point in the queue.

AI_ActBusyGoal:

ForceNPCToActBusy <string>
Format: <targetname> [hint node targetname] [teleport] [nearest] [$<custom activity or sequence>] [max time]
Force an NPC to act busy.
  • The targetname parameter specifies the name of the NPC(s).
  • The hint node targetname parameter specifies the name of the Hint node. Used to force an NPC to act busy on a specific node. If no hint node targetname is specified, it'll search for a random one.
  • If the teleport keyword is specified as a parameter, the NPC will teleport onto the actbusy node instead of navigating to it.
  • If the nearest keyword is specified as a parameter, the NPC will choose the nearest valid actbusy node, instead of choosing one randomly from all valid actbusy nodes.
  • The max time parameter specifies the maximum time to actbusy. If no max time is specified, it'll use the default. Specifying 0 as the max time will make the NPC(s) act busy until disturbed.
  • The $customactivityorsequence parameter specifies the name of a custom activity, prepended by a "$", that the NPC(s) will preform while navigating to the node, e.g. $ACT_RUN will make the NPC(s) run to the node. Sequence names can be used instead of activities.
ForceThisNPCToActBusy <targetname>
Force an specified NPC to act busy. If there are multiple NPCs with the same name, only one will be ordered.
ForceThisNPCToLeave <targetname>
Force an NPC to find an NPC exit point (HINT_NPC_EXIT_POINT hintnode) and vanish. Supports wildcards.
SetBusySearchRange <float>
Alters the Search Range for Busy Hints keyvalue for all actors.

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]

Base:
AddContext <string>
Adds to the entity's list of response contexts. See Context.
AddOutput <string>
Assigns a new keyvalue/output on this entity. For keyvalues, some rely on extra necessary code to be ran and won't work if its simply just changed through this input. There is a strict format that must be followed:
// Format of changing KeyValues: "AddOutput [key] [value]"
//// Raw text:
"OnUser1" "!self,AddOutput,targetname new_name"

// Format of adding an Output: "AddOutput {targetname}:{inputname}:{parameter}:{delay}:{max times to fire, -1 means infinite}"
//// Raw text:
"OnUser1" "!self,AddOutput,OnUser1:SetParent:!activator:0.0:-1"
// Arguments can be left blank, but the empty blank should still be contained.
//// Raw text:
"OnUser1" "!self,AddOutput,OnUser1:ClearParent::0.0:-1"
ClearContext
Removes all contexts from this entity's list.
ClearParent
Removes this entity from the the movement hierarchy, leaving it free to move independently.
FireUser1 to FireUser4
Fires the respectiveOnUseroutputs; see User Inputs and Outputs.
Kill
Removes this entity and any entities parented to it from the world.
KillHierarchy
Functions the same as Kill, although this entity and any entities parented to it are killed on the same frame, being marginally faster thanKillinput.
RemoveContext <string>
Remove a context from this entity's list. The name should match the key of an existing context.
SetParent <string>
Move with this entity. See Entity Hierarchy (parenting).
SetParentAttachment <string>
Change this entity to attach to a specific attachment point on its parent. The entity will teleport so that the position of its root bone matches that of the attachment. Entities must be parented before being sent this input.
SetParentAttachmentMaintainOffset <string>
As above, but without teleporting. The entity retains its position relative to the attachment at the time of the input being received.
Use  !FGD
Same as a player invoking +use; no effect in most cases.
DispatchResponse <string> !FGD
Dispatches a response to the entity. See Response and Concept.
DispatchEffect <string> (removed since Left 4 Dead) !FGD
Dispatches a special effect from the entity's origin; See also List of Client Effects. Replaced by the particle system since Left 4 Dead.
RunScriptFile <script> (in all games since Left 4 Dead 2) (also in Team Fortress 2)
Execute a VScript file from disk, without file extension. The script contents are merged with the script scope of the receiving entity.
RunScriptCode <string> (in all games since Left 4 Dead 2) (also in Team Fortress 2)
Execute a string of VScript source code in the scope of the entity receiving the input. String quotation may be needed when fired via console.
Icon-Bug.pngBug:In Hammer, using string arguments will corrupt the VMF file's structure, making the file unviewable for the next Hammer session.
Note.pngFix:Remove the string argument manually with a text editor.
Note.pngNote:Team Fortress 2 Backtick characters ` are replaced with quotation marks at runtime, allowing quotation marks to be used when normally not possible.
CallScriptFunction <string> (in all games since Left 4 Dead 2) (also in Team Fortress 2) !FGD
Calls a VScript function defined in the scope of the receiving entity.
TerminateScriptScope  (only in Team Fortress 2) !FGD
Destroys the script scope of the receving entity.
SetLocalOrigin <coordinates> (in all games since Alien Swarm) !FGD
Send this entity to a spot in the map. If the entity is parented to something, it will be offset from the parent by this amount.
SetLocalAngles <angles> (in all games since Alien Swarm) !FGD
Set this entity's angles.

Outputs

OnQueueMoved <integer>
Fired when the queue moves up. This output automatically puts the number of NPCs remaining in the queue into the parameter box for inputs, if the mapper does not override the parameter with something else.
OnNPCLeftQueue <targetname>
Fired when an NPC goes to the Exit Node. This output automatically puts the targetname of the NPC into the parameter box for inputs, if the mapper does not override the parameter with something else.
OnNPCStartedLeavingQueue <targetname>
Fired when an NPC is at Node 1. This output automatically puts the targetname of the NPC into the parameter box for inputs, if the mapper does not override the parameter with something else.

AI_ActBusyGoal:

OnNPCStartedBusy <targetname>
Fired when an NPC targeted by this entity starts an ActBusy animation sequence. This output automatically puts the targetname of the NPC into the parameter box for inputs, if the mapper does not override the parameter with something else.
OnNPCFinishedBusy <targetname>
Fired when an NPC targeted by this entity finishes an ActBusy animation sequence. This output automatically puts the targetname of the NPC into the parameter box for inputs, if the mapper does not override the parameter with something else.
OnNPCLeft <targetname>
Fired when an NPC targeted by this goal, ordered by the ForceThisNPCToLeave input, finishes its forced leave. This output automatically puts the targetname of the NPC into the parameter box for inputs, if the mapper does not override the parameter with something else.
OnNPCLostSeeEntity <targetname>
Fired when the NPC loses sight of the Sight Entity. This output automatically puts the targetname of the NPC into the parameter box for inputs, if the mapper does not override the parameter with something else.
OnNPCSeeEnemy <targetname>
Fired when this NPC leaves their ActBusy because they saw an enemy. This output automatically puts the targetname of the NPC (that left the actbusy, not the enemy) into the parameter box for inputs, if the mapper does not override the parameter with something else.

Base:

OnUser1 to OnUser4
These outputs each fire in response to the firing of the like-numbered FireUser1 to FireUser4 Input; see User Inputs and Outputs.

See also