Encounters reference
The encounter and ability rotation components, the built-in encounter actions, phases and rotation entries, and the base class for actions of your own. For how to use it, see Encounters.
VtEncounter
Component. Add it with Add Component → Vantage → Encounters → VtEncounter.
A scripted fight placed in the scene: starts when challengers come close or a boss is engaged, runs actions as the boss’s health crosses phase thresholds, resets everything when the challengers wipe or leave, and pays out when every boss dies.
Inspector fields
Participants
| Field | Type | Default | Range | Description |
|---|---|---|---|---|
Bosses (bosses) |
VtUnit[] | Empty | Units that must die to win. The first living one drives the phases. | |
Spawners (spawners) |
VtMobSpawner[] | Empty | Spawners for adds. Spawn actions refer to them by index. Cleared on reset. |
Pull and reset
| Field | Type | Default | Range | Description |
|---|---|---|---|---|
Start Radius (startRadius) |
float |
10 | ≥ 0 | Challengers inside this radius start the fight. 0 = only engaging a boss starts it. |
Leash Radius (leashRadius) |
float |
40 | ≥ 0 | The fight resets when no challenger is inside this radius. 0 = any distance; only a wipe resets. |
Reset Delay Seconds (resetDelaySeconds) |
float |
5 | ≥ 0 | Seconds without challengers before the reset. |
Respawn Spawners On Reset (respawnSpawnersOnReset) |
bool |
Off | Fill the add spawners again on reset instead of leaving them empty. |
Script
| Field | Type | Default | Range | Description |
|---|---|---|---|---|
Phases (phases) |
VtEncounterPhase[] | Empty | Stages entered as the phase boss’s health falls. List them from highest threshold to lowest. | |
On Start (onStart) |
VtEncounterAction[] | Empty | Run when the fight starts. | |
On Reset (onReset) |
VtEncounterAction[] | Empty | Run after the fight resets. | |
On Complete (onComplete) |
VtEncounterAction[] | Empty | Run when every boss is dead. |
Victory
| Field | Type | Default | Range | Description |
|---|---|---|---|---|
Completion Rewards (completionRewards) |
VtQuestReward[] | Empty | Granted to every challenger inside the leash radius when the fight is won. A pet’s reward goes to its owner. | |
Despawn Adds On Complete (despawnAddsOnComplete) |
bool |
On | Clear remaining adds when the fight is won. | |
Complete Once (completeOnce) |
bool |
On | Stay completed after a win. Uncheck for an encounter that can be pulled again once its bosses are back. |
Scripting API
| Member | Description |
|---|---|
VtEncounterState State { get; } |
Where the fight is. |
int CurrentPhaseIndex { get; } |
Index of the last phase entered, or -1. |
float ElapsedSeconds { get; } |
Seconds since the fight started; 0 while idle. |
VtUnit PhaseBoss { get; } |
The boss that drives phases and actions: the first living boss, or null. |
event Action<VtEncounter> OnStarted |
Fires when the fight starts. |
event Action<VtEncounter, int> OnPhaseEntered |
Fires when a phase is entered, with its index. |
event Action<VtEncounter> OnReset |
Fires after the fight reset. |
event Action<VtEncounter> OnCompleted |
Fires when every boss is dead, after rewards are granted. |
event Action<VtEncounter, string> OnMessage |
Fires with a localized line from a message action. Show it as a boss yell or banner. |
event Action<VtEncounter, string> OnBroadcast |
Fires with a message action’s key or text before it is localized. Replication sends this so every client shows the line in its own language. |
void SetRandom(IVtRandom random) |
Replace the random source used for random-challenger targets. |
void Tick(float deltaTime) |
Advance the fight. Authority only. |
bool StartEncounter() |
Start the fight now. False when it is not idle or every boss is dead. |
bool ResetEncounter() |
Put everything back as it was at the pull. False when the fight is not active. |
VtMobSpawner GetSpawner(int index) |
The spawner at index in spawners, or null. |
void CollectChallengers(List<VtUnit> results, float radius) |
Fill results with living units hostile to the bosses within radius of the encounter. A radius of 0 means any distance. |
void ResolveTargets(VtEncounterTarget target, List<VtUnit> results) |
Fill results with the units target names. |
void ApplyTrackedBuff(VtUnit unit, VtBuffDefinition buff, float duration) |
Apply buff to unit and remember it so a reset removes it. |
void Broadcast(string keyOrText) |
Raise OnMessage with keyOrText localized. |
void ApplyStateFromNet(VtEncounterState newState, int phaseIndex, float elapsedSeconds) |
Mirror the authority’s fight without raising events, for a client that joins mid-fight. Used by replication on clients; refused on the authority. |
void ApplyEventFromNet(VtEncounterEvent change, int phaseIndex) |
Mirror a change in the authority’s fight and raise the matching event: OnStarted, OnPhaseEntered, OnReset or OnCompleted. Runs no actions and grants nothing. Used by replication on clients; refused on the authority. |
void ApplyMessageFromNet(string keyOrText) |
Raise OnBroadcast and OnMessage for a line the authority broadcast, localized here. Used by replication on clients; refused on the authority. |
VtAbilityRotation
Component. Add it with Add Component → Vantage → AI → VtAbilityRotation. Adds VtUnit automatically.
Makes an AI unit cast abilities on its own. Each decision it walks the entries in priority order and casts the first one whose health window, interval, cooldown and target all allow it. Attached by VtUnit when the definition’s ability rotation is not empty; works alongside VtHostileAi, which picks the target and keeps the basic attack going.
Inspector fields
| Field | Type | Default | Range | Description |
|---|---|---|---|---|
Entries (entries) |
VtRotationEntry[] | Empty | Abilities in priority order. The first one that is ready, inside its health window and with a target is cast. | |
Think Interval (thinkInterval) |
float |
0.25 | ≥ 0.05 | Seconds between rotation decisions. |
Scripting API
| Member | Description |
|---|---|
event Action<VtAbilityDefinition, IVtAttackable> OnRotationCast |
Fires after a rotation cast succeeded: (ability, target or null). |
void Initialize() |
Cache siblings, size the interval timers and grant every rotation ability. Safe to call again after changing entries. |
void SetRandom(IVtRandom random) |
Replace the random source used by random-target entries. |
void Tick(float deltaTime) |
Advance one decision step. Authority only. |
VtCastAbilityEncounterAction
Asset. Create it with Create → Vantage → Encounters → Actions → Cast Ability. Inherits VtEncounterAction.
Encounter action: the phase boss casts an ability at once, at the boss, its target, its top threat or a random challenger. Uses the ability’s normal checks except the cast bar, so a phase opener fires on the frame the phase begins. All-challenger targets cast at each in turn and stop at the first refusal, for example a cooldown.
Inspector fields
| Field | Type | Default | Description |
|---|---|---|---|
Ability (ability) |
VtAbilityDefinition | None | Ability the boss casts. Granted if the boss lacks it. |
Target (target) |
VtEncounterTarget | BossTarget |
Who the ability is cast at. |
Scripting API
| Member | Description |
|---|---|
override void Execute(VtEncounter encounter, VtUnit boss) |
Have boss cast ability at once at every unit target names, granting the ability first when the boss lacks it. Stops at the first refused cast. |
VtApplyBuffEncounterAction
Asset. Create it with Create → Vantage → Encounters → Actions → Apply Buff. Inherits VtEncounterAction.
Encounter action: apply a buff, such as an enrage on the boss or a debuff on every challenger. The encounter remembers it and removes it on reset.
Inspector fields
| Field | Type | Default | Range | Description |
|---|---|---|---|---|
Buff (buff) |
VtBuffDefinition | None | Buff to apply. Required. | |
Target (target) |
VtEncounterTarget | Boss |
Who receives it. | |
Duration Override (durationOverride) |
float |
0 | ≥ 0 | Duration override in seconds. 0 = the buff’s own duration. |
Scripting API
| Member | Description |
|---|---|
override void Execute(VtEncounter encounter, VtUnit boss) |
Apply buff to every unit target names, for the override duration or the buff’s own. A reset removes it again. |
VtSpawnEncounterAction
Asset. Create it with Create → Vantage → Encounters → Actions → Spawn Adds. Inherits VtEncounterAction.
Encounter action: fill or clear one of the encounter’s add spawners, chosen by its index in VtEncounter.spawners.
Inspector fields
| Field | Type | Default | Range | Description |
|---|---|---|---|---|
Spawner Index (spawnerIndex) |
int |
0 | ≥ 0 | Index of the spawner in the encounter’s Spawners list. |
Despawn (despawn) |
bool |
Off | Clear the spawner instead of filling it. |
Scripting API
| Member | Description |
|---|---|
override void Execute(VtEncounter encounter, VtUnit boss) |
Fill the spawner at spawnerIndex, or clear it when despawn is on. Does nothing when the index is out of range. |
VtInvulnerableEncounterAction
Asset. Create it with Create → Vantage → Encounters → Actions → Set Invulnerable. Inherits VtEncounterAction.
Encounter action: make the boss, or every boss, invulnerable or vulnerable, for “kill the adds first” phases. A reset always clears it.
Inspector fields
| Field | Type | Default | Description |
|---|---|---|---|
Invulnerable (invulnerable) |
bool |
On | Invulnerable when checked, vulnerable when not. |
All Bosses (allBosses) |
bool |
Off | Apply to every living boss instead of the phase boss only. |
Scripting API
| Member | Description |
|---|---|
override void Execute(VtEncounter encounter, VtUnit boss) |
Make the phase boss, or every living boss with allBosses, invulnerable or vulnerable as invulnerable says. |
VtMessageEncounterAction
Asset. Create it with Create → Vantage → Encounters → Actions → Message. Inherits VtEncounterAction.
Encounter action: broadcast a line through VtEncounter.OnMessage, localized, for boss yells and phase banners. With postToChat on, the line is also sent on the Npc chat channel to every chat component in range, which carries it to networked clients.
Inspector fields
| Field | Type | Default | Range | Description |
|---|---|---|---|---|
Text (text) |
string |
Empty | Line or localization key. | |
Post To Chat (postToChat) |
bool |
On | Also send the line on the Npc chat channel, spoken by the boss. | |
Chat Radius (chatRadius) |
float |
0 | ≥ 0 | World units around the encounter the chat line reaches. 0 = the encounter’s leash radius. |
Scripting API
| Member | Description |
|---|---|
override void Execute(VtEncounter encounter, VtUnit boss) |
Broadcast text through the encounter and, with postToChat on, say it on the Npc chat channel as the boss. |
VtSetTimeEncounterAction
Asset. Create it with Create → Vantage → Encounters → Actions → Set Time Of Day. Inherits VtEncounterAction.
Encounter action: move the scene clock to a time of day, for a boss that summons the night. With skipForward on, the clock runs forward to the target so every phase and day change in between fires; off, it jumps there directly. Does nothing without a VtWorldClock.
Inspector fields
| Field | Type | Default | Range | Description |
|---|---|---|---|---|
Time Of Day (timeOfDay) |
float |
0 | 0 to 1 | Target time of day. 0 = midnight, 0.5 = noon, 0.75 = 18:00. |
Skip Forward (skipForward) |
bool |
On | Run the clock forward to the target instead of jumping, so skipped phases and days still fire. |
Scripting API
| Member | Description |
|---|---|
override void Execute(VtEncounter encounter, VtUnit boss) |
Move the scene clock to timeOfDay, running forward or jumping as skipForward says. |
VtEncounterPhase
Serializable class.
A stage of an encounter entered when the phase boss’s health falls to a fraction of its maximum. Authored inline on VtEncounter.phases in descending order.
Inspector fields
| Field | Type | Default | Range | Description |
|---|---|---|---|---|
Name (name) |
string |
Empty | Label for logs and your UI. | |
Hp Fraction (hpFraction) |
float |
0.5 | 0 to 1 | Entered once the boss’s health is at or below this fraction of maximum. |
Actions (actions) |
VtEncounterAction[] | Empty | Run in order when the phase is entered. |
VtRotationEntry
Serializable class.
One line of an ability rotation: which ability, at whom, inside which health window, and how often. Authored on VtUnitDefinition.abilityRotation in priority order.
Inspector fields
| Field | Type | Default | Range | Description |
|---|---|---|---|---|
Ability (ability) |
VtAbilityDefinition | None | Ability to cast. Granted automatically. | |
Target (target) |
VtRotationTarget | CurrentTarget |
Who the ability is cast at. | |
Min Hp Fraction (minHpFraction) |
float |
0 | 0 to 1 | Cast only while the unit’s health is at least this fraction of maximum. |
Max Hp Fraction (maxHpFraction) |
float |
1 | 0 to 1 | Cast only while the unit’s health is at most this fraction of maximum. 0.3 = an enrage below 30%. |
Interval Seconds (intervalSeconds) |
float |
0 | ≥ 0 | Seconds between uses on top of the ability’s own cooldown. 0 = the cooldown alone. |
Only In Combat (onlyInCombat) |
bool |
On | Cast only while the unit has a target. Uncheck for buffs or summons used out of combat. |
VtEncounterAction
Abstract asset base. Shipped subclasses: VtApplyBuffEncounterAction, VtCastAbilityEncounterAction, VtInvulnerableEncounterAction, VtMessageEncounterAction, VtSetTimeEncounterAction, VtSpawnEncounterAction.
Abstract authored step of an encounter: something that happens when the fight starts, a phase begins, the fight resets or it is won. The built-ins cast an ability, apply a buff, spawn or clear adds, toggle invulnerability and broadcast a line. A custom step is one subclass.
Scripting API
| Member | Description |
|---|---|
abstract void Execute(VtEncounter encounter, VtUnit boss) |
Run the step. boss is the phase boss and may be null once every boss is dead. Runs on the authority only. |
Enums
VtEncounterState
Lifecycle of a VtEncounter.
| Value | Description |
|---|---|
Idle |
Waiting to be pulled. |
Active |
The fight is on. |
Completed |
Every boss died. Stays here unless the encounter repeats. |
VtEncounterTarget
Who an VtEncounterAction acts on.
| Value | Description |
|---|---|
Boss |
The boss that drives the phases: the first living boss. |
BossTarget |
The boss’s current combat target. |
TopThreat |
The top of the boss’s threat table. |
RandomChallenger |
One random challenger within the leash radius. |
AllChallengers |
Every challenger within the leash radius. |
AllBosses |
Every living boss. |
VtEncounterEvent
A change in a fight, as replicated to clients.
| Value | Description |
|---|---|
Started |
The fight started. |
PhaseEntered |
A phase was entered. |
Reset |
The fight reset. |
Completed |
Every boss died. |
VtRotationTarget
Who a VtRotationEntry casts at.
| Value | Description |
|---|---|
CurrentTarget |
The unit’s current combat target. |
Self |
The unit itself. |
TopThreat |
The top entry of the unit’s threat table. |
RandomHostileInRange |
A random hostile unit within the ability’s range. |