using { /Fortnite.com/Devices } using { /Fortnite.com/Characters } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # crafting_station is a Verse device you place in your level. # Wire CraftingButton and RewardSpawner to it in the UEFN editor. crafting_station := class(creative_device): # Drag the Conditional Button device into this slot in the editor. @editable CraftingButton : conditional_button_device = conditional_button_device{} # Drag the Item Spawner device into this slot in the editor. @editable RewardSpawner : item_spawner_device = item_spawner_device{} # OnBegin runs once when the game starts. OnBegin() : void = # Subscribe to the button's success event. # ButtonInteractedWithEvent fires only when ALL requirements are met. CraftingButton.ItemRemovedEvent.Subscribe(OnCraftingSuccess) # This is called when the Conditional Button fires its success event. # The Conditional Button already consumed the required items at this point # (assuming Consume Items is ON in the device settings). OnCraftingSuccess(Player : player) : void = # Spawn the reward item at the RewardSpawner's location. # The item_spawner_device does not take a player argument for SpawnItem; # it spawns at its world position and the player can walk over it. RewardSpawner.SpawnItem() # note: To spawn directly into a player's inventory, pair this with # a fort_character grant_item call once UEFN exposes that API fully.