Verse Library verse

01 Fragment

Automatically strips a player inventory when they enter a downed state using device events.

verse-library/using-item-remover-devices-in-fortnite-creative/01-fragment.verse

# This script makes players drop loot when they go down.
# It's like a digital Item Remover, but written in code.

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

# We create a new "Actor" (a game object) that holds our logic.
# Think of an Actor as a container for devices and code.
actor LootDropTrap is Device()
{
    # This is a "Variable." 
    # In Fortnite terms, it's like a prop that changes state.
    # Here, we store a reference to the DBNO device.
    dbno_device: DBNODevice = DBNODevice{}

    # This is a "Function." 
    # A function is a reusable block of code that does something.
    # Think of it like a "Play Animation" action on a device.
    # We will call this function when the player goes down.
    OnPlayerDowned(player: Player) -> void
    {
        # This line is the "Action."
        # We are telling the player to drop their inventory.
        # It's the same as clicking "Remove Items" on the Item Remover device.
        player.RemoveItems()
        
        # Optional: Let's add some flavor!
        # We can print a message to the debug log.
        # This is like seeing a "Kill Feed" message, but for code.
        print("Loot stripped from ", player.GetName())

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