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 ​
int | map_id | 0 |
Vector3 | world_position | Vector3.ZERO |
Vector3 | world_rotation | Vector3.ZERO |
bool | is_active | true |
String | encounter_name | "Unnamed Encounter" |
bool | auto_join_combat | true |
float | auto_join_radius | 25.0 |
bool | respawns | false |
int | respawn_delay | 60 |
SoundSource | combat_source | |
Formation | formation_type | Formation.NONE |
float | min_spacing_distance | 3.0 |
float | spacing_check_interval | 2.0 |
bool | enforce_spacing | true |
GroupBehavior | group_behavior | GroupBehavior.BALANCED |
int | max_simultaneous_attackers | 0 |
float | attack_rotation_delay | 1.5 |
Array[EncounterReaction] | encounter_reactions | [] |
Variables ​
bool | is_defeated | false |
int | last_defeated_time | 0 |
Methods ​
float | get_formation_radius( group_size: int ) |
int | get_max_attackers( group_size: int ) |
bool | should_enforce_spacing() |
float | get_spacing_priority() |
void | update_center( center: Vector3 ) |
String | get_effective_display_name() |
bool | save_to_disk() |
void | mark_defeated() |
bool | can_respawn() |
void | reset_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)