Reference Verse compiles

is-player-alive: Checking Who's Still Standing at the Lagoon

Your pirate lagoon has a hidden treasure chest — but only living players should be able to claim the reward. The 'is-player-alive' pattern in UEFN combines a `trigger_device` (to detect who stepped on the dock plate) with a `hud_message_device` (to flash a cel-shaded status banner) so you always know whether the agent who fired the event is still in the fight. This article walks you through every method and event on both devices, grounded in a real sunny-cove scenario.

Updated Examples verified on the live UEFN compiler

Overview

Fortnite islands are full of moments where you need to know whether the player who just did something — stepped on a pressure plate, swam through a cove gate, landed on a clifftop — is still alive before you reward or punish them. UEFN does not expose a single is_player_alive device; instead, you compose two devices that are already in your Creative inventory:

  • trigger_device — fires TriggeredEvent when an agent steps on it, and exposes methods like Enable, Disable, SetMaxTriggerCount, and SetResetDelay so you control exactly when and how many times it can fire.
  • hud_message_device — pushes a cel-shaded banner to one player's screen (or all players) via Show(Agent, Message), Hide, SetText, and ClearAllMessages.

Together they let you build a dock pressure-plate that checks whether the triggering player is alive (by successfully casting them to fort_character and reading their health) and then flashes the right message — "Treasure Claimed! ☀️" or "You must be alive to claim this!" — directly on their HUD.

Reach for this pattern whenever you need per-player conditional logic gated on survival state: capture-the-flag pickups, boss-room entry checks, end-of-round reward gates, or any mechanic where only living players should progress.

API Reference

player

Full public surface, resolved verbatim from the live Epic digest (Verse.digest.verse). Inherited members are merged from agent.

player<native><public> := class<unique><persistent><module_scoped_var_weak_map_key><epic_internal>(agent):

trigger_device

Used to relay events to other linked devices.

Full public surface, resolved verbatim from the live Epic digest (Fortnite.digest.verse). Inherited members are merged from trigger_base_device.

trigger_device<public> := class<concrete><final>(trigger_base_device):

Events (subscribe a handler to react):

Event Signature Description
TriggeredEvent TriggeredEvent<public>:listenable(?agent) Signaled when an agent triggers this device. Sends the agent that used this device. Returns false if no agent triggered the action (ex: it was triggered through code).

Methods (call these to make the device act):

Method Signature Description
Trigger Trigger<public>(Agent:agent):void Triggers this device with Agent being passed as the agent that triggered the action. Use an agent reference when this device is setup to require one (for instance, you want to trigger the device only with a particular agent.
Trigger Trigger<public>():void Triggers this device, causing it to activate its TriggeredEvent event.
Enable Enable<public>():void Enables this device.
Disable Disable<public>():void Disables this device.
SetMaxTriggerCount SetMaxTriggerCount<public>(MaxCount:int):void Sets the maximum amount of times this device can trigger. * 0 can be used to indicate no limit on trigger count. * MaxCount is clamped between [0,20].
GetMaxTriggerCount GetMaxTriggerCount<public>()<transacts>:int Gets the maximum amount of times this device can trigger. * 0 indicates no limit on trigger count.
GetTriggerCountRemaining GetTriggerCountRemaining<public>()<transacts>:int Returns the number of times that this device can still be triggered before hitting GetMaxTriggerCount. Returns 0 if GetMaxTriggerCount is unlimited.
SetResetDelay SetResetDelay<public>(Time:float):void Sets the time (in seconds) after triggering, before the device can be triggered again (if MaxTrigger count allows).
GetResetDelay GetResetDelay<public>()<transacts>:float Gets the time (in seconds) before the device can be triggered again (if MaxTrigger count allows).
SetTransmitDelay SetTransmitDelay<public>(Time:float):void Sets the time (in seconds) which must pass after triggering, before this device informs other external devices that it has been triggered.
GetTransmitDelay GetTransmitDelay<public>()<transacts>:float Gets the time (in seconds) which must pass after triggering, before this device informs other external devices that it has been triggered.

hud_message_device

Used to show custom HUD messages to one or more agents.

Full public surface, resolved verbatim from the live Epic digest (Fortnite.digest.verse).

hud_message_device<public> := class<concrete><final>(creative_device_base):

Events (subscribe a handler to react):

Event Signature Description
ShowMessageEvent ShowMessageEvent<public>:listenable(agent) Called when a Message has been Shown on-screen. Returns an Agent if it was Shown on a specified Agent's screen.
HideMessageEvent HideMessageEvent<public>:listenable(agent) Called when a Message has been Hidden on-screen. Returns an Agent if it was Hidden from a specified Agent's screen.
ClearAllMessagesEvent ClearAllMessagesEvent<public>:listenable(agent) Called when all queued Messages from all players that are affected by this HUD Message Device have been cleared.

Methods (call these to make the device act):

Method Signature Description
Show Show<public>(Agent:agent):void Shows the currently set HUD Message on Agents screen. Will replace any previously active message. Use this when the device is setup to target specific agents.
Show Show<public>():void Shows the currently set Message HUD message on screen. Will replace any previously active message.
Hide Hide<public>():void Hides the HUD message.
Hide Hide<public>(Agent:agent):void Hides the currently set HUD Message on Agents screen. Use this when the device is setup to target specific agents.
Show Show<public>(Agent:agent, Message:message, ?DisplayTime:float Displays a Custom message to a specific Agent that you define.Setting DisplayTime to 0.0 will display the HUD message persistently.If not defined, or less than 0.0 the message will show for the time set on the device.
Show Show<public>(Message:message, ?DisplayTime:float Displays a Custom message that you define for all PlayersSetting DisplayTime to 0.0 will display the HUD message persistently.If not defined, or less than 0.0 the message will show for the time set on the device.
SetDisplayTime SetDisplayTime<public>(Time:float):void Sets the time (in seconds) the HUD message will be displayed. 0.0 will display the HUD message persistently.
GetDisplayTime GetDisplayTime<public>()<transacts>:float Returns the time (in seconds) for which the HUD message will be displayed. 0.0 means the message is displayed persistently.
SetText SetText<public>(Text:message):void Sets the Message to be displayed when the HUD message is activated. Text is clamped to 150 characters.
ClearAllMessages ClearAllMessages<public>():void Clears all queued Messages from all players that are affected by this HUD Message Device.

Walkthrough

Scenario — The Lagoon Treasure Dock

You have a sun-drenched pirate lagoon. A wooden dock juts out over turquoise water. At the end of the dock sits a glowing treasure chest. A pressure plate (trigger_device) is buried under the chest. When a player steps on it:

  1. The Verse device checks whether the triggering player is alive (health > 0 via fort_character).
  2. If alive → show a golden "Treasure Claimed! ☀️" banner, disable the trigger so no one else can grab it, then re-enable after a delay.
  3. If eliminated (spectating) → show a red "You must be alive to claim this!" banner and leave the trigger active.

The trigger is set to reset every 10 seconds so the chest can respawn for the next player.

using { /Fortnite.com/Characters }
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }

# Localized message helpers — Verse requires `message` type, not raw strings
ClaimedMsg<localizes>(S : string) : message = "{S}"
DeniedMsg<localizes>(S : string) : message = "{S}"

lagoon_treasure_dock := class(creative_device):

    # ── Editable device references ──────────────────────────────────────────
    # Drag your trigger_device (the dock pressure plate) here in the Details panel
    @editable
    DockPlate : trigger_device = trigger_device{}

    # Drag your hud_message_device here — set it to target Specific Player in device settings
    @editable
    StatusHUD : hud_message_device = hud_message_device{}

    # ── Lifecycle ───────────────────────────────────────────────────────────
    OnBegin<override>()<suspends> : void =
        # Allow the plate to fire at most once per 10-second window, then reset
        DockPlate.SetMaxTriggerCount(0)   # 0 = unlimited total triggers
        DockPlate.SetResetDelay(10.0)     # 10-second cooldown between triggers

        # How long the HUD banner stays on screen (3 seconds)
        StatusHUD.SetDisplayTime(3.0)

        # Subscribe — handler is called every time an agent steps on the plate
        DockPlate.TriggeredEvent.Subscribe(OnDockStepped)

    # ── Event handler ───────────────────────────────────────────────────────
    # TriggeredEvent sends ?agent — we must unwrap the option before using it
    OnDockStepped(MaybeAgent : ?agent) : void =
        if (A := MaybeAgent?):
            # Try to cast the agent to fort_character to read health
            if (FortChar := A.GetFortCharacter[]):
                Health := FortChar.GetHealth()
                if (Health > 0.0):
                    # Player is alive — show the golden success banner
                    StatusHUD.Show(A, ClaimedMsg("Treasure Claimed! ☀️"))
                    # Briefly disable the plate so no one double-triggers
                    DockPlate.Disable()
                    # Re-enable after the reset delay fires (handled by device)
                    DockPlate.Enable()
                else:
                    # Player is eliminated/spectating — deny them
                    StatusHUD.Show(A, DeniedMsg("You must be alive to claim this!"))
            else:
                # Agent is not a fort_character (e.g., NPC edge case) — deny
                StatusHUD.Show(A, DeniedMsg("You must be alive to claim this!"))

Line-by-line explanation

Lines What's happening
ClaimedMsg / DeniedMsg Verse's Show(Agent, Message) requires a message type. These <localizes> helpers wrap a plain string into the correct type.
@editable DockPlate Declares the trigger so UEFN can wire it to the physical dock plate prop in the scene. Without @editable, the device reference is just a default empty object.
SetMaxTriggerCount(0) 0 means unlimited total triggers — the plate can fire forever, just gated by the reset delay.
SetResetDelay(10.0) After each trigger, the plate waits 10 seconds before it can fire again.
StatusHUD.SetDisplayTime(3.0) The banner stays on screen for 3 seconds before auto-hiding.
DockPlate.TriggeredEvent.Subscribe(OnDockStepped) Registers our handler. Every step on the plate calls OnDockStepped.
if (A := MaybeAgent?) TriggeredEvent sends ?agent (an option). We must unwrap it — if no agent triggered it (e.g., triggered via code), MaybeAgent is false and we skip.
A.GetFortCharacter[] Extension method from /Fortnite.com/Characters. Returns the fort_character interface, or fails if the agent has no character (eliminated players in spectate may still fire events).
FortChar.GetHealth() Returns a float. Greater than 0.0 means the player is alive.
StatusHUD.Show(A, ClaimedMsg(...)) Shows a custom message on that specific player's HUD only.
DockPlate.Disable() / Enable() Prevents a second trigger during the reward moment, then immediately re-arms (the SetResetDelay governs the actual cooldown).

Common patterns

Pattern 1 — Broadcast a message to ALL players when the plate fires

Sometimes you want the whole island to see who claimed the treasure. Use the no-argument Show(Message) overload and ClearAllMessages to wipe previous banners first.

using { /Fortnite.com/Characters }
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }

BroadcastMsg<localizes>(S : string) : message = "{S}"

lagoon_broadcast_claim := class(creative_device):

    @editable
    DockPlate : trigger_device = trigger_device{}

    @editable
    GlobalHUD : hud_message_device = hud_message_device{}

    OnBegin<override>()<suspends> : void =
        GlobalHUD.SetDisplayTime(5.0)
        DockPlate.TriggeredEvent.Subscribe(OnClaimed)

    OnClaimed(MaybeAgent : ?agent) : void =
        # Wipe any leftover messages from previous claims
        GlobalHUD.ClearAllMessages()
        if (A := MaybeAgent?):
            if (FortChar := A.GetFortCharacter[]):
                if (FortChar.GetHealth() > 0.0):
                    # Show to EVERY player on the island
                    GlobalHUD.Show(BroadcastMsg("A pirate claimed the lagoon treasure! ☀️"))

Pattern 2 — Limit the plate to exactly 3 triggers, then lock it permanently

Use SetMaxTriggerCount and GetTriggerCountRemaining to build a "first three players win" mechanic.

using { /Fortnite.com/Characters }
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }

RemainingMsg<localizes>(S : string) : message = "{S}"

lagoon_limited_chest := class(creative_device):

    @editable
    DockPlate : trigger_device = trigger_device{}

    @editable
    CountHUD : hud_message_device = hud_message_device{}

    OnBegin<override>()<suspends> : void =
        # Only the first 3 living players can claim — clamped to [0,20]
        DockPlate.SetMaxTriggerCount(3)
        DockPlate.SetResetDelay(1.0)
        CountHUD.SetDisplayTime(4.0)
        DockPlate.TriggeredEvent.Subscribe(OnLimitedClaim)

    OnLimitedClaim(MaybeAgent : ?agent) : void =
        if (A := MaybeAgent?):
            if (FortChar := A.GetFortCharacter[]):
                if (FortChar.GetHealth() > 0.0):
                    Remaining := DockPlate.GetTriggerCountRemaining()
                    CountHUD.Show(A, RemainingMsg("Claimed! {Remaining} chest(s) left!"))

Pattern 3 — Programmatically fire the trigger from code and hide the HUD

Sometimes you want to fire the trigger via Verse (not a player stepping on it) — for example, when a round timer expires. Use Trigger() (no-agent overload) and Hide to clean up the HUD.

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }

lagoon_round_end := class(creative_device):

    @editable
    RoundEndTrigger : trigger_device = trigger_device{}

    @editable
    RoundHUD : hud_message_device = hud_message_device{}

    OnBegin<override>()<suspends> : void =
        # Show a persistent countdown banner (DisplayTime 0.0 = never auto-hide)
        RoundHUD.SetDisplayTime(0.0)
        RoundHUD.Show()

        # Simulate a 30-second round, then fire the trigger from code
        Sleep(30.0)

        # Trigger with no agent — TriggeredEvent will send false for MaybeAgent
        RoundEndTrigger.Trigger()

        # Hide the persistent banner now that the round is over
        RoundHUD.Hide()
        RoundHUD.ClearAllMessages()

Gotchas

1. TriggeredEvent sends ?agent, not agent — always unwrap

TriggeredEvent is typed listenable(?agent). Your handler must accept ?agent and unwrap it with if (A := MaybeAgent?) before passing it to any API that expects a plain agent. Skipping the unwrap is a compile error.

2. message is not a string — use <localizes> helpers

hud_message_device.Show(Agent, Message) and SetText(Text) both require a message type. There is no StringToMessage function. Declare a top-level helper:

MyLabel<localizes>(S : string) : message = "{S}"

Then call StatusHUD.Show(A, MyLabel("Hello!")). Passing a raw string literal directly will fail to compile.

3. SetMaxTriggerCount is clamped to [0, 20]

Values above 20 are silently clamped to 20. Use 0 for unlimited. If you need more than 20 discrete trigger events, manage a counter in Verse yourself.

4. GetTriggerCountRemaining returns 0 when the limit is unlimited

If GetMaxTriggerCount() returns 0 (unlimited), then GetTriggerCountRemaining() also returns 0 — not infinity. Check GetMaxTriggerCount() first if you need to distinguish "unlimited" from "exhausted".

5. Disable / Enable are instant — they don't respect SetResetDelay

Calling Disable() immediately prevents the trigger from firing. SetResetDelay only governs the automatic cooldown between natural player-triggered fires. If you Disable() then Enable() in the same frame, the reset delay timer does not run — the plate is immediately live again.

6. GetFortCharacter[] is a failable expression — use [] not ()

The [] suffix marks a failable call in Verse. It must appear inside an if (or another failable context). Writing A.GetFortCharacter() will not compile; write A.GetFortCharacter[] inside if (FortChar := A.GetFortCharacter[]): instead.

7. int and float do not auto-convert

GetHealth() returns float. Comparing it to an integer literal like 0 will fail. Always write 0.0 for float comparisons.

Guides & scripts that use player

Step-by-step tutorials that put this object to work.

Build your own lesson with player

Generate a personalized, step-by-step lesson plan built around this object — grounded in this exact reference and our compile-verified knowledge base.

Build a lesson →