Skip to content

NPCs

For settings, see AI Settings

NPC Utils

void UpdateEnemyMemoryFromTeammates( entity guy )

void UpdateEnemyMemoryWithinRadius( entity guy, number radius )

void SetEnableNPCs( bool enabled )

void ToggleNPCPathsForEntity( entity ent, bool pathable )

Controls if ent is traversable by NPCs

void ToggleNPCPathsForEntityAtPosition( entity ent, vector pos, bool pathable )

void TransitionNPCPathsForEntity( entity ent, vector pos, bool b )

void SetVisibleEntitiesInConeQueriableEnabled( entity ent, bool enabled )

NPC Squads

void CreateNPCSquad( string name )

int GetNPCSquadSize( string name )

void SetNPCSquadMode( string name, number mode )

array ScriptGetNPCArrayBySquad( string name )

NPC Navigation Nodes

void NPCSetSearchPathUseDist( number distance )

float NPCGetSearchPathUseDist()

void NPCSetAimConeFocusParams( number a, number b )

void NPCSetAimPatternFocusParams( number a, number b )

void NPCSetReacquireParams( number a, number b )

void NPCSetSquadNoFlankThreshold( string a, number b, number c )

int GetNearestNodeToPos( vector pos )

Returns a node index

int GetBestNodeForPosInWedge( vector tPos, vector startPos, number yaw, number minFov, number maxFov, number fovPenalty, number some_index, number steps_maybe )

Returns a node index

vector GetNodePos( int nodeIndex )

int GetNodeCount()

bool GetNodeScriptData_Boolean( int nodeIndex, int otherNodeIndex )

void SetNodeScriptData_Boolean( int nodeIndex, int otherNodeIndex, bool value )

int GetAINScriptVersion()

bool NavMesh_IsUpToDate()

vector ornull NavMesh_ClampPointForAI( vector point, entity npc )

Clamps a goal point to the NavMesh for a given AI. Uses AIs hull size as test extents

vector ornull NavMesh_ClampPointForAIWithExtents( vector pointToClamp, entity contextAI, vector extents )

Clamps a goal point to the NavMesh for a given AI. As extents increase in size more possible clamp positions become available, but too large and the clamped position may be very far from the original point.

vector ornull NavMesh_ClampPointForHull( vector pointToClamp, int hull )

Clamps a goal point to the NavMesh for a given hull

vector ornull NavMesh_ClampPointForHullWithExtents( vector pointToClamp, int hull, vector extents )

Clamps a goal point to the NavMesh for a given hull. As extents increase in size more possible clamp positions become available, but too large clamped position may be very far from the original point.

array NavMesh_GetNeighborPositions( vector point, int hull_maybe, int nNodesToCheck_maybe )

Get nearby ground positions by following the NavMesh graph

array NavMesh_RandomPositions( vector startPos, int hull, int numPositionsRequested, float minDist, float maxDist )

Get n( < 64 ) ground positions around a spot within minDist and maxDist

array NavMesh_RandomPositions_LargeArea( vector startPos, int hull, int numPositionsRequested, float minDist, float maxDist )

Get up to n ground positions around a spot within minDist and maxDist. Gets center of random polygons.

bool NavMesh_IsPosReachableForAI( entity npc, vector point )

Checks if the npc can reach the position over graph

vector GetBoundsMin( int hull )

vector GetBoundsMax( int hull )

Skits

void SkitSetDistancesToClosestHarpoints()

array GetSkitNodeArray_NearPlayers()

Get skit nodes sorted by nearest to average player position with some randomization

array GetSkitNodeArray_NearHardpoints()

Get skit nodes sorted by nearest to hardpoints with some randomization

array GetSkitNodeArray_NearPos()

Get skit nodes sorted by nearest to pos with some randomization

Dangerous Areas

void AI_CreateDangerousArea( entity lifetimeEnt, entity weaponOrProjectile, float radius, int safeTeam, bool affectsNormalArmor, bool affectsHeavyArmor )

Create a known dangerous are that AI should avoid if necessary. The lifetime of the danger is tied to an entity

void AI_CreateDangerousArea_Static( entity lifetimeEnt, entity weaponOrProjectile, float radius, int safeTeam, bool affectsNormalArmor, bool affectsHeavyArmor, vector staticOrigin )

Same as AI_CreateDangerousArea except the origin is always in a single place

void AI_CreateDangerousArea_DamageDef( int damageDef, entity lifetimeEnt, int safeTeam, bool affectsNormalArmor, bool affectsHeavyArmor )

Create dangerous area using damage def

AIN

AIN on the valve wiki

bool AINFileIsUpToDate()

bool AINExists()

void SetAINScriptVersion( int version )

Spawners

array GetSpawnerArrayByClassName( string className )

Get array of spawners matching a class name

array GetSpawnerArrayByScriptName( string name )

Get array of spawners matching a script name

entity GetSpawnerByScriptName( string name )