# 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() : 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. Sleep(2.0) # Spawn one creature at the spawner's location. # Spawn() triggers the device to produce one creature. GhostSpawner.Spawn() # Check how many creatures are active. # If we have reached 5, pause spawning until numbers drop. # note: SpawnedEvent is the real event on creature_spawner_device. set ActiveCount = ActiveCount + 1 if (ActiveCount >= 5): # Wait until at least one creature is eliminated before continuing. GhostSpawner.EliminatedEvent.Await() set ActiveCount = ActiveCount - 1 # We print a message to help us debug. Print("The Ghost Factory is now open!")