Skip to main content

Nightmaremonkeybrain

Based on game build 714014 | Last updated: 2026-02-27

Overview

This brain component defines the behavior tree for the Nightmare Monkey boss entity. It orchestrates high-priority panic responses to threats like electric fences and damage triggers, followed by weapon equipping and combat engagement. When not engaging, it defaults to wandering within a limited radius of its designated "home" location. The brain integrates with DST’s behavior system (behaviours/wander, behaviours/chaseandattack) and braincommon utilities to manage prioritized logic.

Usage example

This brain is typically attached to the Nightmare Monkey entity during prefab instantiation and activated automatically via the AddBrain function in DST’s entity system. Manual usage is unnecessary in most cases.

-- Example of attaching this brain to a custom boss entity (rare, usually handled in prefab)
inst:AddBrain("nightmaremonkeybrain")
-- The brain’s behavior tree is initialized automatically upon first activation

Dependencies & tags

Components used:

  • equippable: checked via IsEquipped() to avoid redundant equipping.
  • inventory: used via Equip(weapon) to equip combat tools.
  • knownlocations: used via GetLocation("home") to fetch the wander target location.

Tags: None identified.

Properties

PropertyTypeDefault ValueDescription
MAX_WANDER_DISTnumber10Maximum distance (in world units) the entity will wander from its home location.
MAX_CHASE_TIMEnumber60Maximum duration (in seconds) the entity will continue chasing a target.
MAX_CHASE_DISTnumber40Maximum distance (in world units) at which the entity will still engage chasing a target.

Main functions

OnStart()

  • Description: Initializes the behavior tree root node with prioritized behaviors: panic response (highest priority), weapon equipping and attack sequence, and finally wandering. Called once when the entity’s brain is started (e.g., on first spawn or state change).
  • Parameters: None.
  • Returns: nil.
  • Error states: None documented; assumes required components (inventory, knownlocations, equippable) are present on self.inst. Behavior tree construction may fail if required behavior classes (e.g., Wander, ChaseAndAttack) are missing or misconfigured.

Events & listeners

None identified.