Verse Library verse

01 Device

Sets up a triggered device that awards a shield mushroom item to players when they step on it.

verse-library/mushroom/01-device.verse

# This is a comment. The game ignores it.
# It is for us to read.

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

Create_Mushroom_Grant := class(creative_device):
    # This is our main device.
    # It will grant the mushroom.

    # This is the Item Granter device.
    # Place one in your island and connect it here.
    # Set it to give a Shield Mushroom in its device properties.
    @editable
    item_granter : item_granter_device = item_granter_device{}

    # This is the trigger device.
    # Place one in your island and connect it here.
    # It fires when a player touches the device.
    @editable
    mushroom_trigger : trigger_device = trigger_device{}

    # OnBegin runs automatically when the game starts.
    # We use it to subscribe to the trigger's event.
    OnBegin<override>()<suspends> : void =
        # Tell the trigger to call our function when touched.
        # 'TriggeredEvent' fires and gives us the agent who touched it.
        mushroom_trigger.TriggeredEvent.Subscribe(OnMushroom_Touched)

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