Verse Library verse

01 Device

Implements a device that calculates destruction context and applies a speed boost to players or nearby entities.

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

# Import the necessary Verse libraries for game logic
using { /Fortnite.com/Devices }
using { /Fortnite.com/Teams }
using { /Verse.org/Simulation }

# Define a new Device. Think of this as creating a custom "brain" for our Nitro Barrel.
# The [Device] tag tells Unreal Engine this script controls a device in the editor.
NitroHunterDevice := class(creative_device):

    # This is a "Property". It's a setting you can change in the editor without rewriting code.
    # Imagine this like the "Range" slider on a Trap device.
    @editable
    BoostDuration : float = 5.0 # seconds

    # OnBegin runs when the game starts. We use it here to set up our logic.
    OnBegin<override>()<suspends>: void =

        # When the barrel breaks, we need to find out WHO broke it.
        # In Verse, we often look at the "Context" of the event.
        # However, for simplicity, let's just grant the boost to everyone nearby
        # or the player who triggered the destruction.

        # Let's get the Player who destroyed it. 
        # Note: In a real complex script, you'd pass the PlayerId through the event.
        # For this demo, we'll assume we want to boost the team that owns the island
        # or just trigger a visual effect. 

        # Here is how we might access the device's location to spawn an effect
        # or grant an item. But for pure speed, the Nitro Barrel device 
        # usually handles the movement buff internally!

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