# This is our healing station script # It runs when the game starts using { /Fortnite.com/Devices } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } healing_station := class(creative_device): # We connect the Item Spawner device in the editor # Drag your Item Spawner into this property slot @editable HealingBox : item_spawner_device = item_spawner_device{} # We connect the Trigger device in the editor # Drag your Trigger into this property slot @editable HealingButton : trigger_device = trigger_device{} # OnBegin runs automatically when the game starts OnBegin() : void = # We tell the trigger what to do when a player enters # A trigger is like a sensor that watches for players HealingButton.TriggeredEvent.Subscribe(OnPlayerHeals) # This function runs when someone hits the button # We tell the Item Spawner to spawn the item OnPlayerHeals(Agent : ?agent) : void = # We call SpawnItem on the Item Spawner device # The spawner already knows which item to give # because you set it in the editor properties HealingBox.SpawnItem() # note: item type (Pizza Slice, Shield Mushroom, etc.) # is configured on the item_spawner_device in the UEFN # editor panel, not passed as a code argument