Verse Library verse

04 Device

Subscribes to and handles a custom event that triggers when a boss is defeated.

verse-library/verse-events-custom/04-device.verse

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

boss_arena := class(creative_device):

    BossDefeatedEvent : event(agent) = event(agent){}

    OnBegin<override>()<suspends> : void =
        BossDefeatedEvent.Subscribe(OnBossDefeated)

    # Your game logic calls this when the boss's health hits zero.
    DefeatBoss(Winner : agent) : void =
        Print("The boss is down!")
        BossDefeatedEvent.Signal(Winner)

    OnBossDefeated(Winner : agent) : void =
        Print("Victory! Rewarding the winner.")

Comments

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