Panic
Based on game build 714014 | Last updated: 2026-03-03
Overview
Panic is a behaviour node that implements a simple flee-or-scare reaction: the entity moves in a randomly chosen direction, pauses briefly, then picks a new direction and repeats. It extends BehaviourNode and integrates into the DST behaviour tree system, primarily for use by passive or non-combat creatures during high-stress events (e.g., lightning strikes, predator encounters). It directly consumes the locomotor component to drive motion.
Usage example
local inst = CreateEntity()
inst:AddComponent("locomotor")
inst:AddComponent("behaviourtree")
inst.components.behaviourtree:PushNode("panic")
Dependencies & tags
Components used: locomotor
Tags: None identified.
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
waittime | number | 0 | Timestamp when the current movement phase ends and a new direction will be selected. |
Main functions
Visit()
- Description: The core behaviour node callback executed each tick. On first visit (
status == READY), it immediately selects a new direction and entersRUNNINGstate. On subsequent ticks, it waits untilwaittimehas passed before selecting a new direction, and then pauses viaSleep. - Parameters: None.
- Returns: Nothing.
PickNewDirection()
- Description: Sets a new random movement direction (0–360 degrees) and schedules the next direction change ~0.25–0.5 seconds in the future.
- Parameters: None.
- Returns: Nothing.
Events & listeners
- Pushes: None.
(Note: Thelocomotor:RunInDirectioncall internally fires alocomoteevent on the entity, butPanicitself does not fire custom events.)