using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
# This is our main script.
# It runs when the game starts.
MyScript := class(creative_device):
# Wire these device references in the UEFN Details panel.
@editable
CraftingButton : button_device = button_device{}
@editable
MainDoor : prop_mover_device = prop_mover_device{}
@editable
RewardBox : item_granter_device = item_granter_device{}
# OnBegin runs automatically when the game starts.
OnBegin<override>()<suspends> : void =
# Subscribe to the button's InteractedWithEvent.
# This calls OnPressed whenever a player presses the button.
CraftingButton.InteractedWithEvent.Subscribe(OnPressed)
# This function runs when the button is pressed.
# The button_device passes the agent (player) who pressed it.
OnPressed(Agent : agent) : void =
# Cast the agent to a fort_character so we can use inventory tools.
if (Character := Agent.GetFortCharacter[]):
Verse Library
verse
01 Device
Grants crafted items and animates a door when a player interacts with a button device.
verse-library/using-twine-crafting-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.