using { /Fortnite.com/Devices } using { /Verse.org/Simulation } # This is our main script block. # It connects our devices. snack_machine := class(creative_device): # These properties are set in the UEFN editor. # Drag your Item Spawner device into MySpawner. # Drag your Switch device into MySwitch. @editable MySpawner : item_spawner_device = item_spawner_device{} @editable MySwitch : switch_device = switch_device{} # This is the main function. # It runs when the game starts. OnBegin() : void = # Wait for the switch to be turned on. # This is like waiting for the player to flip the switch. MySwitch.TurnedOnEvent.Await() # Start an infinite loop. # This keeps running forever. loop: # Wait for a tiny moment. # This gives the game time to catch up. # Without this, the game might freeze. Sleep(0.1) # Tell the spawner to drop an item. MySpawner.Enable() # The loop goes back to the top. # It waits again, then drops another item.