# This is a comment! Verse ignores lines starting with #.
# We are making a "Snack Station"
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Verse.org/Random }
# 1. Define our "World"
# In Verse, every island script is a creative_device. We need to tell Verse
# which devices we are working with by declaring them as editable fields.
# Replace "snack_world" with whatever name you like for your device class.
snack_world := class(creative_device):
# 2. Define the Devices
# We need to link our Verse script to the physical devices in the level.
# "@editable" lets you assign the actual placed device in the UEFN editor.
# "button_device" is the button you placed. "granter_device" gives out loot.
@editable
button_device : button_device = button_device{}
@editable
granter_device : item_granter_device = item_granter_device{}
# 3. OnBegin runs once when the game starts.
# We use it to subscribe to the button's InteractedWithEvent so our
# handler fires every time a player presses the button.
OnBegin<override>()<suspends> : void =
button_device.InteractedWithEvent.Subscribe(OnButtonPressed)
Verse Library
verse
01 Device
Links editor devices to a Verse script and subscribes to interaction events.
verse-library/using-produce-consumables-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.