Verse Library verse

01 Device

Uses a creature placer device to spawn monsters when a player enters a trigger zone.

verse-library/using-creature-placer-devices-in-fortnite-creative/01-device.verse

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

# This is our "Summoner" script.
# It listens for a player to enter the zone.

summoner_device := class(creative_device) {
    # This is our "Reference" to the Creature Placer.
    # Think of this as writing down the Creature Placer's phone number.
    # We will drag the Creature Placer device into this slot in the editor.
    @editable
    CreatureToSpawn: creature_placer_device = creature_placer_device{}

    # This is the main function that runs when the device starts.
    # It waits for a player to enter the trigger volume, then spawns the creature.
    OnBegin<override>()<suspends>: void = {
        # Wait for the event to happen.
        # This pauses the code until a player steps in the zone.
        # (In a real project you would hook up a trigger_volume_device here.)

        # Now that a player is here, let's spawn the monster!
        # We call the Spawn() function on our CreatureToSpawn reference.
        # This is like picking up the phone and dialing the number.
        CreatureToSpawn.Spawn()

        # Optional: Log a message to the console to prove it worked.
        Print("Monster Spawned! Run!")
    }
}

Comments

    Sign in to vote, comment, or suggest an edit. Sign in