Class BossScript
ScriptableObject that defines a boss encounter's phases and timed mechanics. Assign to BossScript to make an NPC a scripted boss.
The AIController evaluates the boss script every tick:
- Checks health against phase thresholds.
- On phase change, applies overrides (behavior tree, attacking state, ability rotation) and spawns adds.
- Ticks all active timed mechanics and force-activates abilities or spawns when timers fire.
Example setup:
Phases:
[0] HP ≥ 70% — default behavior
[1] HP < 70% — spawn 2 adds, switch to Phase2 behavior tree
[2] HP < 40% — enrage: switch to melee attacking state
Timed Mechanics:
Meteor — every 30s, force-cast AbilityTemplate #5
Summon — every 60s, spawn skeleton prefab (only in phase 1)
[CreateAssetMenu(fileName = "New Boss Script", menuName = "FishMMO/Character/NPC/AI/Boss Script")]
public class BossScript : ScriptableObject
- Inheritance
-
ObjectScriptableObjectBossScript
- Inherited Members
-
ScriptableObject.SetDirty()ScriptableObject.CreateInstance<T>()Object.GetEntityId()Object.GetInstanceID()Object.GetHashCode()Object.InstantiateAsync<T>(T)Object.InstantiateAsync<T>(T, Transform)Object.InstantiateAsync<T>(T, Vector3, Quaternion)Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion, Transform)Object.Instantiate(Object)Object.Instantiate(Object, Scene)Object.Instantiate<T>(T, InstantiateParameters)Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)Object.Instantiate(Object, Transform)Object.Instantiate<T>(T)Object.Instantiate<T>(T, Vector3, Quaternion)Object.Instantiate<T>(T, Vector3, Quaternion, Transform)Object.Instantiate<T>(T, Transform)Object.Destroy(Object)Object.DestroyImmediate(Object)Object.DontDestroyOnLoad(Object)Object.DestroyObject(Object)Object.FindObjectsOfType<T>()Object.FindObjectsByType<T>(FindObjectsSortMode)Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)Object.FindObjectOfType<T>()Object.FindFirstObjectByType<T>()Object.FindAnyObjectByType<T>()Object.FindFirstObjectByType<T>(FindObjectsInactive)Object.FindAnyObjectByType<T>(FindObjectsInactive)Object.FindObjectsByType<T>()Object.FindObjectsByType<T>(FindObjectsInactive)Object.ToString()Object.nameObject.hideFlags
Fields
Phases
Ordered boss phases. Must be sorted from highest health threshold to lowest. Phase 0 is the opening phase.
[Tooltip("Ordered phases (highest HP threshold first).")]
public List<BossPhase> Phases
Field Value
ResetOnLeash
When true, the boss fully heals and resets phases when leashing back home.
[Tooltip("Heal and reset phases when the boss leashes.")]
public bool ResetOnLeash
Field Value
TimedMechanics
Timed mechanics that fire at regular intervals during the encounter.
[Tooltip("Timed abilities / spawns that fire at regular intervals.")]
public List<BossTimedMechanic> TimedMechanics