# 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(): 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 # settings inside UEFN — see the placement steps below. ItemGranter.GrantItem(Agent)