Skip to content

UniqueEncounterData ​

Inherits: DatabaseResource < Resource

UniqueEncounterData defines both the behavior AND unique instance data for an encounter. This is both the template (formation, tactics) AND the specific placement (position, defeated state). Similar to how Trigger area works - combines definition and instance in one resource.

Properties ​

intmap_id0
Vector3world_positionVector3.ZERO
Vector3world_rotationVector3.ZERO
boolis_activetrue
Stringencounter_name"Unnamed Encounter"
boolauto_join_combattrue
floatauto_join_radius25.0
boolrespawnsfalse
intrespawn_delay60
SoundSourcecombat_source
Formationformation_typeFormation.NONE
floatmin_spacing_distance3.0
floatspacing_check_interval2.0
boolenforce_spacingtrue
GroupBehaviorgroup_behaviorGroupBehavior.BALANCED
intmax_simultaneous_attackers0
floatattack_rotation_delay1.5
Array[EncounterReaction]encounter_reactions[]

Variables ​

boolis_defeatedfalse
intlast_defeated_time0

Methods ​

floatget_formation_radius( group_size: int )
intget_max_attackers( group_size: int )
boolshould_enforce_spacing()
floatget_spacing_priority()
voidupdate_center( center: Vector3 )
Stringget_effective_display_name()
boolsave_to_disk()
voidmark_defeated()
boolcan_respawn()
voidreset_state()

Enumerations ​

enum Formation ​

Group formation types

  • NONE = 0 - No formation - entities act independently
  • CIRCLE_TARGET = 1 - Form circle around primary target
  • LINE_FORMATION = 2 - Form a line facing the enemy
  • SCATTER = 3 - Spread out to avoid AoE
  • DEFENSIVE_CLUSTER = 4 - Group together for mutual protection
  • FLANKING_WINGS = 5 - Split into two groups to flank

enum GroupBehavior ​

Group aggression levels

  • PASSIVE = 0 - Only defend, don't initiate attacks
  • CAUTIOUS = 1 - Take turns attacking, maintain spacing
  • BALANCED = 2 - Standard combat behavior
  • AGGRESSIVE = 3 - All attack simultaneously when possible
  • BERSERKER = 4 - Ignore formation and spacing, full assault

Property descriptions ​

int map_id = 0 ​

The map this encounter belongs to

Vector3 world_position = Vector3.ZERO ​

World position of this encounter

Vector3 world_rotation = Vector3.ZERO ​

World rotation of this encounter

Basic Properties

bool is_active = true ​

Whether this encounter is active (can be disabled by quests/events)

String encounter_name = "Unnamed Encounter" ​

Display name for this encounter (for debugging/editor)

bool auto_join_combat = true ​

Whether all children auto-join combat when any member enters combat

float auto_join_radius = 25.0 ​

Maximum distance from encounter center that entities can be and still auto-join

bool respawns = false ​

Does the group come back after it is defeated? Its dead members stand up again at their start and the encounter is ready to fight again

int respawn_delay = 60 ​

Seconds between the defeat of the whole group and its return (only when Respawns is on)

SoundSource combat_source ​

The music of the fight with this encounter (a track or a Combat Music Album). Empty = the zone's, then the world's. It wins over both while the party fights this encounter

Formation & Spacing

Formation formation_type = Formation.NONE ​

Formation type for this encounter

float min_spacing_distance = 3.0 ​

How far apart entities should try to maintain from each other (in meters)

float spacing_check_interval = 2.0 ​

How often to check and adjust spacing (in seconds)

bool enforce_spacing = true ​

Whether to enforce spacing during combat

Group Behavior

GroupBehavior group_behavior = GroupBehavior.BALANCED ​

Overall aggression level of the group

int max_simultaneous_attackers = 0 ​

Maximum number of entities that can attack simultaneously (0 = no limit)

float attack_rotation_delay = 1.5 ​

Delay between attack rotations when taking turns (for CAUTIOUS behavior)

Reaction System

Array[EncounterReaction] encounter_reactions = [] ​

Reactions that trigger based on encounter events

Variable descriptions ​

bool is_defeated = false ​

Whether this encounter has been defeated

int last_defeated_time = 0 ​

Timestamp of when this encounter was last defeated

Method descriptions ​

float get_formation_radius( group_size: int ) ​

Get formation radius based on group size

int get_max_attackers( group_size: int ) ​

Get the maximum number of attackers based on behavior and group size

bool should_enforce_spacing() ​

Check if spacing should be enforced based on behavior

float get_spacing_priority() ​

Get spacing priority (higher = more important to maintain spacing)

void update_center( center: Vector3 ) ​

Keeps the centre of the group (the average position of its NPCs; the Uniques list frames it)

String get_effective_display_name() ​

Get effective display name

bool save_to_disk() ​

Save this unique encounter data to disk

void mark_defeated() ​

Mark as defeated

bool can_respawn() ​

Check if encounter can respawn

void reset_state() ​

Reset encounter state (for respawn)