Verse Library verse

01 Device

Damages players entering a specific volume by applying massive damage to their character, acting as a revenge trap.

verse-library/sources-panel/01-device.verse

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

# 1. Define our Trap Device
revenge_trap_device := class(creative_device):

    # This is the 'Target' zone. When a player enters, this triggers.
    # Wire this in UEFN to a Trigger device placed in your level.
    @editable
    TriggerDevice : trigger_device = trigger_device{}

    # 2. The Core Logic: Overlap via trigger_device
    # This function runs when an agent activates the TriggerDevice
    OnTriggered(Agent : ?agent) : void =
        # Check if the 'Agent' is a fort_character (i.e. has a game character)
        if (ActualAgent := Agent?, FortCharacter := ActualAgent.GetFortCharacter[]):
            # HERE IS THE KEY PART:
            # 'Agent' IS the Source of the overlap.
            # We don't need to look it up; it's right there!

            # Let's do something with the Source (the player character)
            # Eliminate them via damage — fort_character exposes Damage()
            FortCharacter.Damage(9999.0)

            # Optional: Print to console to prove we know who the Source is
            # In a real game, you'd probably send a message to the player's chat
            Print("Revenge Trap activated! Source was an agent.")

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