Stalker Minionbrain
Based on game build 714014 | Last updated: 2026-03-03
Overview
StalkerMinionBrain defines the behavior tree logic for stalker minions (typically summoned by a Stalker boss). These minions cease active movement and remain stationary (StandStill) while their parent stalker entity is alive and within tracking range. Once the stalker dies, a short delay is triggered, after which the minion begins to wander (Wander) before self-terminating by killing itself via the health component. The behavior tree prioritizes panic response first, followed by leash enforcement, then idle/stalking conditions, and finally delayed self-destruction.
Usage example
local inst = CreateEntity()
inst:AddComponent("health")
inst:AddComponent("entitytracker")
inst.brain = inst:AddBrain("stalker_minionbrain")
-- The brain is initialized automatically on add via BrainManager
Dependencies & tags
Components used: entitytracker, health
Tags: None identified.
Properties
No public properties.
Main functions
OnStart()
- Description: Initializes and sets the behavior tree root node, which orchestrates the minion’s AI logic: panic response, leash tracking, waiting near the stalker, wandering after stalker death, and self-killing.
- Parameters: None.
- Returns: Nothing.
- Error states: Assumes
entitytrackerandhealthcomponents are attached; no explicit validation is performed.
GetTarget(inst) (local)
- Description: Retrieves the stalker entity tracked by the
entitytrackercomponent. - Parameters:
inst(Entity) — the minion entity instance. - Returns: The stalker entity if present, otherwise
nil. - Error states: Returns
nilif no entity named"stalker"exists in the tracker.
GetTargetPos(inst) (local)
- Description: Returns the current world position of the stalker target, or
nilif no target exists. - Parameters:
inst(Entity) — the minion entity instance. - Returns:
Vectorposition ornil. - Error states: Returns
nilifGetTarget(inst)returnsnil.
ShouldDie(self) (local)
- Description: Determines whether the minion should proceed to self-termination based on a randomized delay timer after the stalker’s death.
- Parameters:
self— the brain instance. - Returns:
trueif the delay period has elapsed and the minion should kill itself; otherwisefalse. - Error states: Initializes a random delay (
1or3seconds plus random jitter) only on first call; subsequent calls compare current time against computedself.delay.
Events & listeners
None identified.