Verse Library verse

04 Device

Connects a button, item granter, and timer to automatically grant rewards and start a round when pressed.

verse-library/verse-devices-common-devices/04-device.verse

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }

reward_station := class(creative_device):

    @editable
    RewardButton : button_device = button_device{}

    @editable
    PrizeGranter : item_granter_device = item_granter_device{}

    @editable
    RoundTimer : timer_device = timer_device{}

    OnBegin<override>()<suspends> : void =
        RewardButton.InteractedWithEvent.Subscribe(OnRewardPressed)

    OnRewardPressed(Player : agent) : void =
        PrizeGranter.GrantItem(Player)
        RoundTimer.SetActiveDuration(30.0)
        RoundTimer.Start()
        Print("Reward granted — round is on!")

Comments

    Sign in to vote, comment, or suggest an edit. Sign in