Verse Library verse

01 Device

Continuously spawns creatures at set intervals using a loop, sleep timer, and spawner device.

verse-library/creature-spawner-device-design-examples-in-fortnite/01-device.verse

# This is a simple Verse script for a custom spawner
# It uses the Creature Spawner device to spawn a creature

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

# We create a new device type called "MyGhostFactory"
# This is like giving a new name to our tool
MyGhostFactory := class(creative_device):

    # We declare a reference to the Creature Spawner device.
    # You wire this up in the editor by selecting the device property.
    # note: creature_spawner_device is the real UEFN Verse type for the Creature Spawner device.
    @editable
    GhostSpawner : creature_spawner_device = creature_spawner_device{}

    # This is a "Device Event". It happens when the game starts.
    OnBegin<override>()<suspends> : void =
        # We tell the spawner to enable itself and begin spawning.
        # Enable() activates the device so it starts its work.
        GhostSpawner.Enable()

        # We keep track of how many creatures have spawned via events.
        var ActiveCount : int = 0

        # We loop forever, spawning a creature every 2 seconds.
        # This controls our spawn rate timing in Verse.
        loop:
            # Wait 2 seconds between each spawn attempt.

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