# This is our crafting station script using { /Fortnite.com/Devices } using { /Fortnite.com/Characters } using { /Fortnite.com/FortPlayerUtilities } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # We create a new device called "CraftingStation" crafting_station := class(creative_device): # This is the button that checks the items # We link it to the Conditional Button in the editor @editable my_button : conditional_button_device = conditional_button_device{} # This is the item we give to the player when the recipe is complete # We link it to an Item Granter in the editor @editable my_granter : item_granter_device = item_granter_device{} # This is the item remover for the first ingredient (Herb) # Set its item type to Herb in the editor, quantity 1 @editable herb_remover : item_remover_device = item_remover_device{} # This is the item remover for the second ingredient (Wheat) # Set its item type to Wheat in the editor, quantity 1 @editable wheat_remover : item_remover_device = item_remover_device{} # When the game starts, we get ready OnBegin() : void = # We connect the button's ItemRemovedEvent to our function. # The conditional_button_device fires ItemRemovedEvent when # its built-in item conditions are all satisfied. # Configure the required items (Herb x1, Wheat x1) directly # in the Conditional Button's Details panel in the editor. my_button.ItemRemovedEvent.Subscribe(OnCraft) # This function runs when the button's conditions are met. # It receives the agent (player) who pressed the button. OnCraft(InAgent : agent) : void = # Remove the ingredient items from the player's inventory. # Each item_remover_device is pre-configured in the editor # to remove one copy of its assigned item from the activating player. herb_remover.Remove(InAgent) wheat_remover.Remove(InAgent) # Give the player their crafted item via the Item Granter. my_granter.GrantItem(InAgent) # Print a message to the log for debugging. # note: agent has no direct Print method; cast to fort_character for display, # or use a hud_message_device for on-screen feedback instead. Print("Yum! You made Meat!")