ReferenceVerse
Item Spawner
item spawner
Updated
item-spawner in ~90 seconds.A pirate steps on the sandy pit plate and a glowing gold coin instantly pops from the spawner.
The trigger device catches that footstep and passes the agent to your Verse handler, which then commands the item spawner device to drop the loot.
We wire the trigger device's event to a custom handler, unwrap the agent to prove they exist, and call SpawnItem on the spawner.
Reach for the item spawner device when you need code to dynamically drop weapons, keys, or coins into your arena.
arena_loot := class(creative_device):
@editable
Pad : trigger_device = trigger_device{}
@editable
Spawner : item_spawner_device = item_spawner_device{}
OnStepped(Agent : ?agent) : void =
if (A := Agent?):
Spawner.SpawnItem()
OnBegin<override>()<suspends>:void =
Pad.TriggeredEvent.Subscribe(OnStepped)
Build your own lesson with item-spawner
Generate a personalized, compile-checked lesson grounded in this exact reference.
Build a lesson →