# This is our main script file.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
# We create a new creative_device type.
# Think of this as the "brain" of our kitchen.
magic_kitchen_script := class(creative_device):
# These are the devices we will use.
# A 'trigger' is the rug on the floor.
@editable
Trigger : trigger_device = trigger_device{}
# An 'item_granter' is the machine that holds the food.
@editable
ItemGranter : item_granter_device = item_granter_device{}
# This runs once when the game starts.
OnBegin<override>()<suspends>: void =
# We tell the trigger to watch for players.
# When a player enters, it calls 'OnTriggered'.
Trigger.TriggeredEvent.Subscribe(OnTriggered)
# This function runs when a player steps on the rug.
# 'agent' is the Verse type for the entity that activated the trigger.
OnTriggered(Agent : agent) : void =
# We cast the agent to a fort_character so we can find the player.
# note: GrantItem uses the agent directly; no ProduceItemTypes enum exists in public API.
if (FortCharacter := Agent.GetFortCharacter[]):
# item_granter_device.GrantItem takes the activating agent.
# The specific item (Pepper) is set in the Item Granter device
Verse Library
verse
01 Device
Grants items to players when they step onto a specified trigger volume.
verse-library/using-produce-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.