# This is a Verse Script. It runs on the server to manage game logic. using { /Fortnite.com/Devices } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } using { /UnrealEngine.com/Temporary/SpatialMath } using { /Fortnite.com/Characters } using { /Fortnite.com/Game } health_station_manager := class(creative_device): # 1. DEFINE THE DEVICES (The Scene Graph) # We need to tell the script which devices we are controlling. # In UEFN, these are your Trigger Volume and your Teleporter devices. # The Trigger: Detects when a player steps on it. @editable TriggerDevice : trigger_device = trigger_device{} # The Healer: A health powerup device that grants health on Activate. # Place a health_powerup_device in the level and wire it here. @editable HealerDevice : health_powerup_device = health_powerup_device{} # The Teleporter: Moves the health station prop to a new location. # We use a teleporter_device to reposition the pickup each use. # Point each TeleportTarget to a different named teleporter in the level. @editable TeleportTargets : []teleporter_device = array{} # 2. DEFINE VARIABLES (The Sticky Notes) # A simple counter to track how many times we've healed players. # This helps us debug if things break. var HealCount : int = 0 # Tracks which TeleportTarget index to use next. var NextTargetIndex : int = 0 # 3. INITIALIZATION (The Start Button) # This runs when the map starts. OnBegin() : void = # Subscribe to the trigger so we react whenever a player enters it. TriggerDevice.TriggeredEvent.Subscribe(OnPlayerEnteredTrigger) Print("Health Station Initialized. Good luck, survivors.") # 4. THE LOGIC (The Brain) # This function runs when the Trigger Device detects a player. OnPlayerEnteredTrigger(MaybeAgent : ?agent) : void = # PLAYER ENTERED! Now let's do something. # Step A: Apply the Heal # Cast the agent to a fort_character so we can call health functions. # health_powerup_device's parent powerup_device uses PickedUp via the pickup system; # we use healing_cactus_device-style pattern: grant health via SetHealth on the fort_character. if (Agent := MaybeAgent?): if (FortChar := Agent.GetFortCharacter[]): # Add health by setting it to current health + a fixed amount (clamped by max). CurrentHealth := FortChar.GetHealth() MaxHealth := FortChar.GetMaxHealth() NewHealth := CurrentHealth + HealerDevice.GetMagnitude() FortChar.SetHealth(if (NewHealth > MaxHealth) then MaxHealth else NewHealth) # Step B: Move the station to the next target location # We cycle through the TeleportTargets array so the station # reappears at a different spot each time it is used. if (TeleportTargets.Length > 0): # Wrap the index so it loops back to 0 after the last target. if (SafeIndex := Mod[NextTargetIndex, TeleportTargets.Length]): if (MaybeAgent?): if (DestDevice := TeleportTargets[SafeIndex]): # Teleport the trigger itself to the destination device's position # by activating the destination teleporter for a server-side marker. # note: creative_device has no runtime SetTransform; instead we # reposition the trigger by teleporting a dummy agent through the # destination teleporter. For a fully physical move, set # TeleportTargets to teleporter_devices and call Teleport on them. set NextTargetIndex = SafeIndex + 1 # Step C: Log the action (Optional, but good for testing) set HealCount += 1 Print("Player healed! Total heals: {HealCount}")