# Import the necessary Verse libraries for items and players using /Fortnite.com/Devices using /Fortnite.com/Items # Define our main device class # Think of this as the "Blueprint" for our Crafting Station class EggCraftingDevice(Device): # This is a "Variable". It's a container that holds the button we want to watch. # In game terms, it's like pointing a laser at the button you want to program. CraftButton: ButtonDevice = "CraftButton_1" # This is a "Function". It's a block of code that runs when something happens. # Specifically, this runs when the CraftButton is pressed. OnCraftButtonPressed := func(player: Player): # Check if the player has the required crafting material. # "Has_Item" is a function that returns true or false. # It's like checking if you have a key before opening a door. if (player.Has_Item("White_Dino_Egg_1")): # If the check passes, remove the Dino Egg (consume the material). # "Remove_Item" takes the item away from the player. player.Remove_Item("White_Dino_Egg_1", 1) # Then, give the player the reward: a Heal Egg. # "Grant_Item" adds the item to their inventory. player.Grant_Item("Heal_Egg_1", 1) # Optional: Send a message to the player so they know it worked. # "Show_Message" is like a text popup on their screen. player.Show_Message("Crafted a Heal Egg!") else: # If they don't have the Dino Egg, tell them to go find some. player.Show_Message("Need a White Dino Egg to craft!") # This is the "Event". It connects the button press to our function. # When the button is pressed, Verse calls OnCraftButtonPressed. # This is like a trigger wire connecting a sensor to a door. EggCraftingDevice.OnCraftButtonPressed = func(self: EggCraftingDevice, player: Player): self.CraftButton.OnPressed.Add(func(): self.OnCraftButtonPressed(player) )