Ai ally manager: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
 
(logical ent, activator/acllers)
 
(41 intermediate revisions by 17 users not shown)
Line 1: Line 1:
ai_ally_manager
{{CD|CAI_AllyManager|file1=ai_allymanager.cpp}}
{{this is a|logical entity|name=ai_ally_manager|game=Half-Life 2 series|sprite=1}} It monitors the number and type of {{ent|npc_citizen}} allies and responds accordingly. When this entity receives a <code>Replenish</code> [[input]], it will count the number of allies and send [[output]]s based on how many allies are needed to match this entity's [[keyvalue]]s. Also fires an output when all allies and/or all medics are dead.


AI Ally Manager
{{Note|<br/>
*Outputs can be used for purposes aside from spawning more NPCs.
*More than one <code>ai_ally_manager</code> can exist.
*Won't count more than 10 allies.
}}


KEYS
{{stray ent|{{portal}}}}


Name targetname <target_source> The name that other entities refer to this entity by.


Maximum number of allies maxallies <integer>
==ConVars/Commands==
{{varcom|start}}
{{varcom|ai_ally_manager_debug|0|01|Periodically prints the count of allies and medics to the console. Requires {{cmd|developer|1}}.}}
{{varcom|end}}


Maximum number of medics maxmedics <integer>
==Keyvalues==
{{KV Targetname}}
{{KV|Maximum number of allies|intn=maxallies|int|Maximum number of allies.}}
{{KV|Maximum number of medics|intn=maxmedics|int|Maximum number of allies that are medics.}}


==Inputs==
{{I|SetMaxAllies|param=int|Set maximum number of allies.}}
{{I|SetMaxMedics|param=int|Set maximum number of medic allies.}}
{{I|Replenish|Spawn more allies as requested by the keyvalues.}}


INPUTS
==Outputs==
{{O|OnZeroAllies|ac-is-this=1|Fired when there are no more allies.}}
{{O|OnZeroMedicAllies|ac-is-this=1|Fired when there are no more medics left.}}
{{O|SpawnAlly0|to=SpawnAlly9|ac-is-this=1|Fired when allies 0 to 9 spawn.}}
{{O|SpawnMedicAlly|ac-is-this=1|Fired when a medic ally spawns.}}


Kill Removes this entity from the world.
[[Category:AI]]
 
KillHierarchy Removes this entity and all its children from the world.
 
AddOutput <string> Adds an entity I/O connection to this entity. Format: <output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire (-1 == infinite)>. Very dangerous, use with care.
 
FireUser1 Causes this entity's OnUser1 output to be fired.
 
FireUser2 Causes this entity's OnUser2 output to be fired.
 
FireUser3 Causes this entity's OnUser3 output to be fired.
 
FireUser4 Causes this entity's OnUser4 output to be fired.
 
SetMaxAllies <integer> Set maximum number of allies
 
SetMaxMedics <integer> Set maximum number of medic allies
 
Replenish Replenish player allies
 
 
OUTPUTS
 
OnUser1 Fired in response to FireUser1 input.
 
OnUser2 Fired in response to FireUser2 input.
 
OnUser3 Fired in response to FireUser3 input.
 
OnUser4 Fired in response to FireUser4 input.
 
SpawnMedicAlly Spawn Medic Ally
 
SpawnAlly0 Spawn Ally 0
 
SpawnAlly1 Spawn Ally 1
 
SpawnAlly2 Spawn Ally 2
 
SpawnAlly3 Spawn Ally 3
 
SpawnAlly4 Spawn Ally 4
 
SpawnAlly5 Spawn Ally 5
 
SpawnAlly6 Spawn Ally 6
 
SpawnAlly7 Spawn Ally 7
 
SpawnAlly8 Spawn Ally 8
 
SpawnAlly9 Spawn Ally 9
 
OnZeroAllies Fires when there are no more allies
 
OnZeroMedicAllies Fires when there are no more allies

Latest revision as of 05:36, 28 May 2025

C++ Class hierarchy
CAI_AllyManager
CBaseEntity
C++ ai_allymanager.cpp
Ai ally manager.png

ai_ally_manager is a logical entity available in Half-Life 2 series Half-Life 2 series. It monitors the number and type of npc_citizen allies and responds accordingly. When this entity receives a Replenish input, it will count the number of allies and send outputs based on how many allies are needed to match this entity's keyvalues. Also fires an output when all allies and/or all medics are dead.

Note.pngNote:
  • Outputs can be used for purposes aside from spawning more NPCs.
  • More than one ai_ally_manager can exist.
  • Won't count more than 10 allies.
Note.pngNote:This entity is also in the code for Portal. Its functionality is not guaranteed.


ConVars/Commands

Cvar/Command Parameters or default value Descriptor Effect
ai_ally_manager_debug 0 0 disables, 1 enables Periodically prints the count of allies and medics to the console. Requires developer 1.

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

Maximum number of allies (maxallies) <integer>
Maximum number of allies.
Maximum number of medics (maxmedics) <integer>
Maximum number of allies that are medics.

Inputs

SetMaxAllies <integerRedirectInput/integer>
Set maximum number of allies.
SetMaxMedics <integerRedirectInput/integer>
Set maximum number of medic allies.
Replenish
Spawn more allies as requested by the keyvalues.

Outputs

OnZeroAllies
!activator = !caller = this entity
Fired when there are no more allies.
OnZeroMedicAllies
!activator = !caller = this entity
Fired when there are no more medics left.
SpawnAlly0 to SpawnAlly9
!activator = !caller = this entity
Fired when allies 0 to 9 spawn.
SpawnMedicAlly
!activator = !caller = this entity
Fired when a medic ally spawns.