Verse Library verse

01 Device

Defines a trap device with editor-configurable damage, delay, and sound settings.

verse-library/fortnite-making-class-attributes-editable-in-uefn/01-device.verse

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

# This is our "Blueprint" for the Revenge Trap.
# The <public> tag means this device can be placed in the world.
revenge_trap_device<public> := class<concrete>(creative_device):
    # --- EDITABLE ATTRIBUTES ---
    # These are the variables that will show up in the editor panel.
    # The @editable tag is the magic sauce.

    @editable
    DamageAmount : float = 50.0 # Default damage, like a standard shotgun blast
    
    @editable
    TriggerDelay : float = 1.5  # Seconds before the trap goes off
    
    @editable
    TrapSound : string = "Explosion" # The sound effect to play

    # --- GAME LOGIC ---
    # This runs when the game starts.
    OnBegin<override>()<suspends>: void = 
        # We grab the player who triggered the trap (we'll assume a trigger zone for simplicity)
        # In a real scenario, you'd bind this to a specific trigger event.
        # For this demo, we just log the settings to prove they are readable.
        
        # This line prints to the debug console what the current settings are.
        # You can change the values in the editor, push, and see this print change!

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