Verse Library verse

01 Device

Toggles a ghost bridge prop visibility on button press, automatically hiding it after five seconds.

verse-library/building-structures-and-galleries-on-your-island/01-device.verse

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

# This script controls the bridge
bridge_script := class(creative_device):

    # This is the Button device linked in the editor Details panel
    @editable
    Button : button_device = button_device{}

    # This is the prop device representing the "Ghost" bridge placed in the editor
    # Use a 'prop_manipulator_device' to show/hide a placed prop
    @editable
    GhostBridge : prop_manipulator_device = prop_manipulator_device{}

    # This is the function that runs when the game starts
    OnBegin<override>()<suspends>: void =
        # Subscribe to the button's InteractedWithEvent so we react when pressed
        Button.InteractedWithEvent.Subscribe(OnButtonPressed)

    # This runs when the button is pressed
    # agent is the player who pressed the button
    OnButtonPressed(Agent : agent): void =
        # Show the bridge prop and re-enable its collision
        GhostBridge.Enable()
        # Wait 5 seconds, then hide the bridge again
        # Remove the two lines below if you want the bridge to stay forever
        spawn { WaitAndHide() }

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