Verse Library verse

01 Device

Controls a fire volume device, allowing players to toggle its active state using a button.

verse-library/using-fire-volume-devices-in-fortnite-creative/01-device.verse

# We are bringing in the necessary device types from Fortnite's library.
# Think of this like loading the ammo before a fight.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }

# This is our main script. It's a creative_device, the standard base class
# for any Verse script you attach to a device on your island.
chaos_zone_manager := class(creative_device):

    # These @editable fields are the bridge between code and editor.
    # Drag your ChaosButton device into this slot in the Details panel.
    @editable
    ChaosButton : button_device = button_device{}

    # Drag your BurnZone Fire Volume device into this slot.
    @editable
    BurnZone : fire_volume_device = fire_volume_device{}

    # Track whether fire is currently active in the zone.
    # We start it as false — the zone begins safe.
    var FireIsOn : logic = false

    # OnBegin runs once when the game starts.
    # We use this to set the initial state and wire up the button event.
    OnBegin<override>()<suspends> : void =
        # Start with fire OFF in the zone.
        # It's like telling the bouncer: "Nobody lights matches today."
        BurnZone.Disable()

        # Print a message to the debug log so we know it worked.

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