CNPC_EnemyFinder

From Source Entities
Jump to navigation Jump to search

Present in:
Hl2.pngHL2
Hl2-episodes.pngEp1&2
Hl2dm-custom.pngHL2:DM
P1.pngPortal
Asw.pngASW
P2.pngPortal 2

CNPC_EnemyFinder is a code class in some Source games.

Classnames:

  • npc_enemyfinder - It looks for CBaseCombatCharacters that it hates and fires outputs when it finds and loses them. It will also relay info to its squad.

Flags[edit | edit source]

  • 65536: Check Visibility - Enemies must be clearly visible to be found. If not checked, the enemy finder sees though walls.
  • 131072: APC Visibility checks - To do: Code says this does nothing except nullify the free pass keyvalues?
  • 262144: Short memory - Doesn't appear to affect enemy memory or outputs.
  • 524288: Can be an enemy - Allows this entity to be considered an enemy by other combat characters.

Keyvalues[edit | edit source]

Start On (StartOn) <boolean>
Self-explanatory.
Field Of View (FieldOfView) <float>
The enemy finder's cone of vision. 1.0 = straight ahead, 0.0 = +/- 90 degrees, -1.0 = all directions.
Min Search Dist (MinSearchDist) <float>
Enemies must be this far away to be "spotted". If 0, no minimum.
Max Search Dist (MaxSearchDist) <float>
Enemies must be at least this close to be spotted. If 0, no maximum.
Player pass duration (freepass_duration) <float>
How long it takes the enemy finder to notice a target within it's area of vision. Targets who escape its sight before this time passes will never cause squad info to update or cause outputs to fire. Must be at least the time of a single tick (0.15 for HL2) to work correctly if using it.
Player pass move tolerance (freepass_movetolerance) <float>
If an enemy is currently unnoticed, how far they can move from the spot they were initially unnoticed at before being noticed by moving too much.
Player pass refill rate (freepass_refillrate) <float>
How quickly enemies "recover" peek time (duration) when they hide again. If duration is 5 and refill rate is a high number, enemies can peek indefinitely for four seconds at a time.
Player pass issue time (freepass_timetotrigger) <float>
If an enemy hides again for this long, their peek time recovers fully.
Player pass peek time (freepass_peektime) <float>
To do: Description.

Inputs[edit | edit source]

TurnOn
Tells the finder to look for enemies.
TurnOff
Tells the finder to stop looking for enemies.

Outputs[edit | edit source]

OnAcquireEnemies
Fires when the enemy finder acquires enemies.
OnLostEnemies
Fires when the enemy finder no longer has any enemies in sight.