Verse Library verse

01 Fragment

Links a collectible orb pickup to a healing box activation for instant recovery.

verse-library/using-health-powerup-devices-in-fortnite-creative/01-fragment.verse

# This is a comment. It helps us remember what this code does.

# We make a new script. This is our magic spell.
My_Healing_Script := script() override {
    # This runs when the island starts.
    On_Start := func() override {
        # We find our glowing orb device.
        # It is named "Glowing_Orb" in our scene.
        orb := Scene.Find_actor_by_name("Glowing_Orb")
        
        # We find our healing box device.
        # It is named "Healer_Box" in our scene.
        healer := Scene.Find_actor_by_name("Healer_Box")
        
        # Now we connect them!
        # When the orb is picked up...
        orb.Pickup_Event.Subscribe(func(player : Player) {
            # ...give the player health via the healer.
            # We use the Heal function.
            healer.Trigger(player)
        })
    }
}

Comments

    Sign in to vote, comment, or suggest an edit. Sign in