# Import necessary Verse libraries using { /Fortnite.com/Devices } using { /Fortnite.com/Characters } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # Define our Boss Script as a creative_device so it can live in the UEFN editor. # Think of creative_device as the base class every placeable Verse object inherits from. boss_script := class(creative_device): # This is our "Constant" - the Spire we want to control. # Think of this like saving a specific player's username so you can DM them later. # Bind this in the UEFN editor's Details panel after placing your Verse device. @editable SpireDevice : overlord_spire_device = overlord_spire_device{} # The trigger volume players walk into to wake the boss. # Bind this to a trigger_device placed around the arena entrance in the editor. @editable ArenaTrigger : trigger_device = trigger_device{} # This is our "Variable" - the current target. # Think of this like the "Focus" in a camera or the "Target Lock" in a missile. # option(?agent) lets us represent "no target yet" safely. var CurrentTarget : ?agent = false # This function runs when the script starts (like when the island loads) OnBegin() : void = # Subscribe to the trigger so we know when a player enters the arena. # Analogy: Arming the tripwire before the fight starts. ArenaTrigger.TriggeredEvent.Subscribe(OnPlayerEntered) # Subscribe to the Spire's destroyed event so we can react when it dies. # Analogy: Setting up the "Victory" camera before the fight begins. SpireDevice.DestroyEvent.Subscribe(OnSpireDestroyed) # The Spire starts disabled in the editor; enable it now so it is ready. # Analogy: Flipping the breaker switch to power the boss arena. SpireDevice.Enable() # Print a message to the debug log (like the in-game console). # Analogy: The boss saying "I'm awake!" Print("Overlord Spire Activated!") # This function is called when a player enters the trigger zone. # trigger_device passes an ?agent (an optional agent) to its subscribers. OnPlayerEntered(TriggeringAgent : ?agent) : void = if (Agent := TriggeringAgent?): # Store who walked in so other functions can reference the target. set CurrentTarget = option{Agent} # Set the Spire's target to the agent who walked in. # Analogy: The boss locking eyes with you. Now it only attacks you. # This makes the fight fairer (and more personal) than random attacks. SpireDevice.SetTarget(Agent) # Cast to fort_character to read the player's name for the debug log. # Analogy: The announcer shouting the challenger's name. if (FortChar := Agent.GetFortCharacter[]): Print("Target locked on: " + FortChar.GetDisplayName()) # This function is called when the Spire is destroyed. # DestroyEvent carries an ?agent payload (the destroyer, if any). OnSpireDestroyed(Unused : ?agent) : void = # Analogy: The boss explodes and the "Victory" screen plays. Print("Overlord Spire Destroyed! Victory!") # Clear the stored target now that the fight is over. set CurrentTarget = false # We could trigger a "Win" condition here, like opening the exit door. # ExitDoor.Activate() # Requires an @editable prop_mover_device reference