Verse Library verse

03 Device

Commands an NPC spawner to run incremental survival waves as enemies are eliminated.

verse-library/verse-npc-spawner-waves/03-device.verse

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

# SPAWNER WAVES — a survival horde driven by the NPC Spawner device.
#
# The npc_spawner_device is the front door to putting characters in your world
# from Verse. You pick WHO it spawns in the editor (its NPC Character Definition);
# Verse decides WHEN and HOW MANY. Here a button starts a wave, the device fires
# SpawnedEvent for every character it creates, EliminatedEvent every time one
# falls, and when the whole wave is down we roll the next one — bigger each time.
wave_horde_device := class(creative_device):

    # Drop your NPC Spawner here. Choose its character (zombie, husk, custom) in
    # the editor — Verse just commands the spawns.
    @editable
    Spawner : npc_spawner_device = npc_spawner_device{}

    # Press to begin the horde.
    @editable
    StartButton : button_device = button_device{}

    # How many enemies the FIRST wave spawns. Each wave adds one more.
    @editable
    FirstWaveSize : int = 3

    # Which wave we're on (0 = not started).
    var WaveNumber : int = 0

    # How many of the current wave are still alive.

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