Verse Library verse

02 Standalone

Connects a trigger volume to an elimination manager to automatically process enemy eliminations and trigger loot drops.

verse-library/elimination-manager-device/02-standalone.verse

# LootGoblin.v
# Using Verse to trigger an Elimination Manager on kill.

# 1. IMPORT THE NECESSARY MODULES
# "using" brings in the tools we need.
using /Fortnite.com/Devices
using /Fortnite.com/GameFramework

# 2. DEFINE THE CLASS
LootGoblinController := class:
    # We need a reference to the Elimination Manager device.
    # This is a "Variable" that will hold the device.
    ManagerDevice: elimination_manager_device

    # We also need a way to know when a kill happens.
    # We'll use a simple trigger volume for this demo.
    KillTrigger: trigger_volume_device

    # 3. THE INITIALIZATION FUNCTION
    # This runs when the island starts.
    Initialize := function ():
        # Connect our KillTrigger's "OnEntered" event to our function.
        # An "event" is a signal. "OnEntered" fires when a player walks in.
        KillTrigger.OnEntered += HandleKillEvent

    # 4. THE HANDLER FUNCTION
    # This function runs when the event fires.
    HandleKillEvent := function (trigger: trigger_volume_device, actor: actor):
        # Check if the actor is an enemy (e.g., a Fiend).
        # We use "if" to check a condition.

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