using { /Fortnite.com/Devices } using { /Unreal.com/Engine } using { /Verse.org/Sim } # This is our "Crafting Bench" entity. # Think of it as the physical table the player stands next to. actor CraftingBench : Actor() { # VARIABLES: The "Recipe" # These are constants because the recipe never changes for this bench. # Like a fixed storm timer, this is set once in the editor. const PartsNeeded : int = 3 const SacNeeded : int = 2 # The item we give back. # In a real game, this might be a weapon or a special consumable. const RewardItem : ItemId = "SpicyIceCreamCone" # EVENTS: The "Trigger" # This event fires when a player interacts with this bench. # It's like the "Start" button on a device, but triggered by player input. event OnInteract(InteractingPlayer : Player) -> () { # STEP 1: CHECK INVENTORY # We need to see what's in the player's hand/slots. # Think of this as pausing the game to open their inventory menu. player_inventory := InteractingPlayer.GetInventory() # Get the count of specific crafting items. # This is like counting how many gold bars you have. parts_count := player_inventory.GetItemCount("MechanicalParts") sac_count := player_inventory.GetItemCount("StinkSac") # STEP 2: THE LOGIC CHECK # Do they have enough? # If parts_count < 3, the condition is false. Game over. if (parts_count >= PartsNeeded and sac_count >= SacNeeded) { # STEP 3: THE TRADE (Cost) # Remove the items. This is like burning the wood to build the wall. # We remove more than needed just to be safe, or exactly what's needed. player_inventory.RemoveItem("MechanicalParts", PartsNeeded) player_inventory.RemoveItem("StinkSac", SacNeeded) # STEP 4: THE REWARD # Grant the new item. This is like the loot drop after a boss fight. player_inventory.GrantItem(RewardItem, 1) # Optional: Feedback! # You could add a sound or visual effect here. # For now, let's just print a message in the debug console. Print("Crafting Complete! Enjoy your spicy treat.") } else { # STEP 5: THE FAIL STATE # Not enough loot? Tell the player why. # This is like the "Insufficient Ammo" warning. if (parts_count < PartsNeeded) { Print("Need more Mechanical Parts!") } else { Print("Need more Stink Sacs!") } } } }