Verse Library verse

02 Fragment

Activates a prop mover when players enter a volume, then resets after a cooldown delay.

verse-library/using-farm-galleries-in-fortnite-creative/02-fragment.verse

# Define the script. 'scriptable' means it can be attached to devices.
script BarnTrapScript is scriptable
    # These are "Bindings." 
    # They let you drag and drop devices from the Outliner into this script.
    # This is how we connect the Scene Graph to our code.
    trigger_volume: Trigger Volume = Trigger Volume'None'
    prop_mover: Prop Mover = Prop Mover'None'
    
    # Variable: A simple on/off switch.
    # False means the trap is ready. True means it's cooling down.
    trap_ready: bool = true
    
    # Event: This function runs automatically when a player enters the volume.
    # 'server' means this logic runs on the game server, not just on your computer.
    @event
    OnBegin() is server
        # We need to listen for the 'Entered' event on the trigger.
        # This is like setting up a microphone.
        trigger_volume.EnteredEvent.Bind(OnPlayerEntered)
    
    # This function is called when the 'Entered' event fires.
    OnPlayerEntered(player: Player) is server
        # Check if the trap is ready.
        if trap_ready == true
            # Set trap to not ready (cooldown starts).
            trap_ready = false
            
            # Activate the Prop Mover.
            # This is like flipping the switch on a device.
            prop_mover.Activate()

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