Verse Library verse

01 Fragment

Dynamically sets the cooldown duration for a healing cactus device at match load.

verse-library/using-healing-cactus-devices-in-fortnite-creative/01-fragment.verse

# 1. IMPORTS: Bringing in the tools we need.
# 'using' is like grabbing a tool from your inventory.
# We need the 'Devices' toolkit to talk to game objects.
using { /Fortnite.com/Devices }

# 2. THE SCRIPT CLASS: This is the blueprint for our logic.
# Think of this as the instruction manual for your island.
# 'healing_cactus_controller' is just a name we made up.
# It must be 'public' so UEFN knows to run it.
word healing_cactus_controller is
    # 3. VARIABLES: Storing our settings.
    # 'cooldown_time' is a variable that holds a number (float).
    # We set it to 30.0 seconds. You can change this number!
    cooldown_time: float = 30.0

    # 4. INITIALIZATION: What happens when the island starts.
    # 'OnWorldLoaded' is an Event. It’s like the Battle Bus door opening.
    # The code inside runs exactly once when the match begins.
    OnWorldLoaded() is
        # Find the cactus in the Scene Graph.
        # We look for an entity (device) named "BigHealCactus".
        # If it doesn't exist, this might crash, so be careful with names!
        cactus := GetWorld().FindDevice<HealingCactusDevice>("BigHealCactus")

        # Check if we actually found the cactus.
        # This is like checking if your loot box actually has loot in it.
        if (cactus is not None)
            # 5. MODIFYING STATE: Changing the cactus's behavior.
            # We access the 'Cooldown' property of the device.
            # This is like reaching into the device's settings menu via code.

Sign in free to read the full source 🌴

This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.

Sign in with Discord

Comments

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