Verse Library verse

01 Device

Activates warning VFX, waits asynchronously, and detonates explosives upon trigger activation.

verse-library/using-explosive-devices-in-fortnite-creative/01-device.verse

# SmartBomb.verse
# A script that turns a barrel into a timed explosive trap

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

# This is the main "Actor" class for our trap.
# Think of this as the blueprint for our Smart Bomb.
smart_bomb_device := class(creative_device):

    # These are the "Components" we need to make it work.
    # We'll assign these in the editor later.
    MyExplosiveDevice: explosive_device = explosive_device{}
    vfx_creator: vfx_creator_device = vfx_creator_device{}
    trigger_zone: trigger_device = trigger_device{}

    # This function runs when the device is placed in the world.
    OnBegin<override>()<suspends>: void = 
        # 1. Listen for players entering the trigger zone.
        # "TriggeredEvent" is the event (the input).
        # We bind our custom function "StartDetonation" to it.
        trigger_zone.TriggeredEvent.Subscribe(Start_Detonation)

    # This function is called when the trigger is activated.
    Start_Detonation(triggered_agent: ?agent): void =
        # 2. Visual Warning: Play the "Bubbling" VFX on the barrel.
        # We assume the barrel has a VFX Creator attached or we spawn one.
        # For simplicity, let's just signal the VFX device to play a "Warning" effect.
        vfx_creator.Begin()

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