# We need to import the systems that handle items and players. # Think of this like grabbing your tools from the shed before starting work. using { /Fortnite.com/Devices } using { /Fortnite.com/Items } using { /Fortnite.com/Players } # This is our main script. It lives on the device. # 'This' refers to the device itself. dino_egg_crafter := class(creative_device) { # We need a reference to the Item Granter that gives the reward. # In UEFN, you link this in the editor, but in Verse, we assume # we have a way to find it. For this tutorial, let's assume # we are checking the player's inventory directly. # The main function that runs when the player presses the button. # 'Player' is the person who pressed it. OnPlayerActivate(Player : agent) : void = { # 1. CHECK: Does the player have a White Dino Egg? # We look at the player's inventory. # 'Has_Item' is a check, like looking in your pockets. # NOTE: Direct inventory checks and item consumption are not # available via a simple API in Verse/UEFN. In practice you # would wire up item_granter_device and trigger_device in the # editor. The logic below illustrates the lesson's intent. # 2. ACT: If they have it... # (Item presence check placeholder — wire devices in the editor) if (fort_player := Player as fort_playercharacter?) { # 3. CONSUME: Remove the egg from their inventory. # This is the magic part. The egg is gone. Poof. # 'Consume' takes the item type and the player. # (Handled via item_granter_device configured in editor) # 4. REWARD: Give them a Heal Egg. # 'Grant_Item' puts a new item into their inventory. # (Handled via item_granter_device configured in editor) # Optional: Send a message to the chat so they know it worked. # "Crafted a Heal Egg!" } else { # If they DON'T have the egg, tell them to go find one. # "You need a White Dino Egg!" } } }