# This is our main script file
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Playspaces }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
# We create a new type of device called CrystalCraftingStation
CrystalCraftingStation := class(creative_device):
# This is the button the player clicks
@editable
my_button: button_device = button_device{}
# This is the spawner that gives the item
@editable
my_spawner: item_spawner_device = item_spawner_device{}
# This runs when the game starts
OnBegin<override>()<suspends>:void=
# Subscribe to the button's activation event.
# ActivatedEvent fires with the agent (player) who pressed it.
my_button.InteractedWithEvent.Subscribe(OnActivated)
# This function runs when the button is pressed
# agent is the player who clicked the button
OnActivated(Agent : agent) : void =
# Try to get the fort_character from the agent so we can check inventory
if (Character := Agent.GetFortCharacter[]):
# Spawn the reward item and give it to the player
my_spawner.SpawnItem()
Verse Library
verse
01 Device
Links a clickable button device to an item spawner, granting rewards to players upon interaction.
verse-library/using-crystal-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.