using { /Fortnite.com/Devices } using { /Verse.org/Simulation } using { /Fortnite.com/Characters } using { /Fortnite.com/Playspaces } using { /UnrealEngine.com/Temporary/Diagnostics } # This is our "Device" class. Think of it as the blueprint for our Crafting Pad. # Just like a Blueprint in UE, this defines what our object *is* and *does*. CrystalCraftingPad := class(creative_device): # Variables are like the stats on a piece of loot. They change during the game. # Here, 'RequiredCrystalCount' is how many crystals (gold) the player needs to craft. # Since Crystal is not a real Verse type, we track crafting cost as an int (e.g., gold bars). RequiredCrystalCount: int = 1 # This function runs when a player enters the trigger volume. # 'Agent' is the player who walked in. OnPlayerEnter(Agent: agent): void = # Step 1: Check if the agent is a valid fort_character. # This is like checking if the bus is actually flying before you jump out. if (Character := Agent.GetFortCharacter[]): # Step 2: Check the player's health as a stand-in for inventory check. # In real UEFN there is no HasItem API; we simulate the "has ingredient" check # by verifying the character is alive (MaxHealth > 0 means they are active). HasIngredients: logic = if (Character.GetHealth() > 0.0) then true else false # Step 3: Make a decision based on the result. # If HasIngredients is TRUE, we proceed. If FALSE, we do nothing. if (HasIngredients?): # Step 4: The Reward. # In real UEFN there is no RemoveItem/GiveItem on agent directly, # so we signal success by printing the reward message. # Remove the crystal. This is the "consumable" part. # The player loses the quartz (simulated here via Print). Print("Consuming 1 Quartz Crystal from inventory...") # Grant the reward. Let's give them a Storm Shield Detector as a reward. # In a real build, you might use an item granter device triggered here. Print("Storm Shield Detector granted as reward!") # Optional: Print a message to the player so they know it worked. # Think of this as the "Item Acquired" popup in the corner of your screen. Print("Crafting Successful! You forged a Storm Shield Detector.") else: # If they don't have the crystal, tell them to go get one. Print("You need a Quartz Crystal to craft here!")