ReferenceVerse

Is Player Alive

is player alive

Updated

A hidden chest at the Code Pyramid bursts open the moment an explorer steps on the rune plate—but only if they're still alive to claim it.

The trigger device catches the player's step, and we peek at their fort character's health to make sure it's above zero.

We subscribe to the trigger event, safely unwrap the player and their character in one line, and check that health is greater than zero before granting the item.

Reach for this health check whenever your island needs to verify a player is truly alive before handing out loot or starting a mechanic.

pyramid_guard := class(creative_device):
    @editable Plate : trigger_device = trigger_device{}
    @editable Granter : item_granter_device = item_granter_device{}
    OnStepped(Agent : ?agent) : void =
        if (A := Agent?, P := player[A], Char := P.GetFortCharacter[]):
            if (Char.GetHealth() > 0.0):
                Granter.GrantItem(A)
    OnBegin<override>()<suspends>:void =
        Plate.TriggeredEvent.Subscribe(OnStepped)

Build your own lesson with is-player-alive

Generate a personalized, compile-checked lesson grounded in this exact reference.

Build a lesson →