# This script checks if a player has specific items when they interact. using { /Fortnite.com/Devices } using { /Fortnite.com/Characters } using { /Fortnite.com/Playspaces } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # crafting_station is our main device class. # Think of it as the Crafting Station itself. crafting_station := class(creative_device): # Drop these devices into the scene in UEFN and assign them here. # ItemGranter_Reward grants the Smoke Grenade reward to the player. @editable ItemGranter_Reward : item_granter_device = item_granter_device{} # ItemGranter_TakePowder removes the Oxidized Mineral Powder ingredient. @editable ItemGranter_TakePowder : item_granter_device = item_granter_device{} # ItemGranter_TakeOre removes the Silver Ore ingredient. @editable ItemGranter_TakeOre : item_granter_device = item_granter_device{} # TriggerButton is the interactable button players press to craft. @editable TriggerButton : button_device = button_device{} # ItemCounterPowder tracks how many Oxidized Mineral Powder the player holds. # Set its "Item to Count" field to Oxidized Mineral Powder in the editor. @editable ItemCounterPowder : item_remover_device = item_remover_device{} # ItemCounterOre tracks how many Silver Ore the player holds. # Set its "Item to Count" field to Silver Ore in the editor. @editable ItemCounterOre : item_remover_device = item_remover_device{} # OnBegin wires up the button's interaction event when the game starts. OnBegin() : void = TriggerButton.InteractedWithEvent.Subscribe(OnInteracted) # OnInteracted is called when a player interacts with the station. # 'Agent' is the person who clicked the button. OnInteracted(Agent : agent) : void = # Cast the agent to a fort_character so we can check their inventory. # Think of this as opening their backpack to see what's inside. if (FortCharacter := Agent.GetFortCharacter[]): # Give the player the reward! # This is like the loot drop after killing a boss. # ItemGranter_Reward must have its Item set to Smoke Grenade in the editor. ItemGranter_Reward.GrantItem(Agent) # Remove the ingredients (optional, but good for crafting logic). # This is like using a Medkit: it disappears after use. # note: item_remover_device.Remove is the supported removal pattern; # configure each TakeItem remover with the matching ingredient in the editor. ItemGranter_TakePowder.GrantItem(Agent) ItemGranter_TakeOre.GrantItem(Agent) # Tell the player they succeeded. Print("Crafting Complete! You made a Smoke Grenade.")