Verse Library verse

03 Fragment

Executes reward logic by granting items to players and starting a countdown timer upon interaction.

verse-library/verse-devices-common-devices/03-fragment.verse

# The button hands us the player who pressed it, as an agent.
    OnRewardPressed(Player : agent) : void =
        # 1. Reward THAT player with the granter's item.
        PrizeGranter.GrantItem(Player)
        # 2. Put 30 seconds on the clock and start it.
        RoundTimer.SetActiveDuration(30.0)
        RoundTimer.Start()
        Print("Reward granted — round is on!")

Comments

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