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<override>()<suspends> : 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.
Verse Library
verse
01 Device
Manages UEFN conditional button and item spawner devices to automate crafting reward distribution.
verse-library/using-crafting-items-in-fortnite-creative/01-device.verse
Sign in free to read the full source 🌴
This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.