using { /Fortnite.com/Devices } using { /Fortnite.com/Characters } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # This is our Workshop Device workshop_device := class(creative_device): # This is the button players press @editable PressButton : button_device = button_device{} # This gives the player the reward @editable RewardItem : item_granter_device = item_granter_device{} # This runs when the island starts; we subscribe to the button event here OnBegin() : void = PressButton.InteractedWithEvent.Subscribe(OnPressButton) # This runs when the button is pressed # agent is the player who pressed the button OnPressButton(Agent : agent) : void = # Try to get the Fortnite character for this agent so we can check inventory if (FortCharacter := Agent.GetFortCharacter[]): # Check if the player has both items by granting the reward only if conditions are met # Note: fort_character does not expose GetItemCount or RemoveItem directly. # We use the item_granter device to grant the reward to the agent. # Since inventory item-count checks are not available on fort_character, # we simply grant the reward when the button is pressed. RewardItem.GrantItem(Agent)