using { /Fortnite.com/Characters } using { /Fortnite.com/FortPlayerUtilities } using { /Fortnite.com/Devices } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # We define our crafting recipe here # This is like writing down the recipe on a card crafting_recipe := struct: Ingredient1 : int # item slot index tracked by your item_granter setup Ingredient2 : int RewardGranter : item_granter # the Item Granter device that holds the Primal Pistol # This is our main crafting table device # Wire IngredientGranter1 and IngredientGranter2 to item_granter devices # configured for Grub and Acorn respectively in the UEFN editor crafting_table_device := class(creative_device): # Place two Item Granter devices on the island and set one to Grub, # one to Acorn. Assign them here in the editor. @editable IngredientGranter1 : item_granter = item_granter{} @editable IngredientGranter2 : item_granter = item_granter{} # Place a third Item Granter set to Primal Pistol for the reward. @editable RewardGranter : item_granter = item_granter{} # Place a Conditional Button on the island and assign it here. @editable CraftButton : conditional_button_device = conditional_button_device{} OnBegin() : void = # Listen for the button's success event (all key items found) CraftButton.SuccessEvent.Subscribe(OnCraftRequested) # This function is called when the Conditional Button confirms # the player holds both key items OnCraftRequested(Agent : agent) : void = if (FortCharacter := Agent.GetFortCharacter[]): # HasIngredients check is handled by the Conditional Button # device in the editor — it unlocks only when both items # are present, so we go straight to crafting CraftItem(Agent) # This function checks the player's bag # It looks for the items in the recipe # Note: Verse has no direct inventory-query API; the Conditional # Button device performs the item check for us automatically. HasIngredients(Agent : agent) : logic = # Delegate the check to the Conditional Button's built-in # key-item validation — always returns true here because # SuccessEvent only fires after the check passes return true # This function gives the reward # It takes the item away and gives a new one CraftItem(Agent : agent) : void = # Remove the ingredients by granting count -1 via each granter's # PickupConsumedEvent; the Conditional Button consumes key items # automatically when SuccessEvent fires, so we only need to # grant the reward here # Note: item removal on SuccessEvent is handled by the # Conditional Button device's "Consume Key Items" setting in UEFN RewardGranter.GrantItem(Agent) # Show a message to the player if (FortCharacter := Agent.GetFortCharacter[], Player := player[Agent]): Print("Crafting Complete!") # visible in output log # Note: there is no player.ShowMessage API in Verse; # use a hud_message_device wired in the editor for on-screen text