Verse Library verse

01 Device

Spawns a particle effect at a player's location when they are eliminated.

verse-library/particle-spawn/01-device.verse

# We need these basic tools to talk to the game world
using { /Verse.org/Simulation }
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Game }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /UnrealEngine.com/Temporary/Diagnostics }

# This is our main script. Think of it as the "Game Rule" container.
# It holds the logic for what happens when players interact with the world.
my_particle_script := class(creative_device):

    # STEP 1: Define the "Loot" (The Particle Effect)
    # In Verse, we wire up devices in the editor's Details panel.
    # Place a vfx_spawner_device on your island and assign it here.
    # Replace 'vfx_spawner_device{}' by connecting the device in the Details panel.
    # note: Verse has no raw particle_system asset type at runtime; vfx_spawner_device
    # is the real API for spawning pre-configured particle effects in UEFN.
    @editable
    explosion_effect : vfx_spawner_device = vfx_spawner_device{}

    # STEP 2: The "Trigger" (Event Listener)
    # This function runs automatically when a player is eliminated.
    # It's like the "Elimination Notification" device in the editor, but in code.
    on_player_eliminated(result : elimination_result) : void =
        # Get the agent (player) who was eliminated.
        eliminated_agent := result.EliminatedCharacter

        # Get the location of the player who just died.
        # This is like grabbing the coordinates of the loot crate.

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