Verse Library verse

01 Device

Subscribes to reboot van events and logs a message whenever a teammate is revived.

verse-library/using-reboot-van-spawner-devices-in-fortnite-creative/01-device.verse

# This is a simple script for a Reboot Van
# It reacts when a player uses the van

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

# A Verse device that listens for reboot van activity
reboot_van_manager := class(creative_device):

    # Bind to the reboot van spawner placed in the level
    @editable
    RebootVan : reboot_van_spawner_device = reboot_van_spawner_device{}

    # Called automatically when the game starts
    OnBegin<override>()<suspends> : void =
        # Subscribe to the built-in event fired when a teammate is rebooted
        RebootVan.ReboottedEvent.Subscribe(OnPlayerRebooted)
        # note: ReboottedEvent triggers after a player is successfully
        # revived at the van; it receives the rebooted agent as its argument

    # Runs each time a player is revived at the van
    OnPlayerRebooted(Agent : agent) : void =
        Print("Teammate Revived!")
        # note: Print() writes to the UEFN output log; use
        # a hud_message_device bound via @editable to show
        # on-screen text to players at runtime

Comments

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