Verse Library verse

02 Fragment

Consumes specific ores from a player and grants a reward item upon button press.

verse-library/using-mineral-ore-crafting-consumables-in-fortnite-creative/02-fragment.verse

OnPressButton(Agent : agent) : void =
        if (FortCharacter := Agent.GetFortCharacter[]):
            HasCopper := FortCharacter.GetItemCount["/Game/Items/Ore/CopperOre.CopperOre"] > 0
            HasCoal   := FortCharacter.GetItemCount["/Game/Items/Ore/Coal.Coal"] > 0
            # Add the Silver Ore check here
            HasSilver := FortCharacter.GetItemCount["/Game/Items/Ore/SilverOre.SilverOre"] > 0

            # Update the condition to require all three items
            if (HasCopper and HasCoal and HasSilver):
                FortCharacter.RemoveItem("/Game/Items/Ore/CopperOre.CopperOre", 1)
                FortCharacter.RemoveItem("/Game/Items/Ore/Coal.Coal", 1)
                FortCharacter.RemoveItem("/Game/Items/Ore/SilverOre.SilverOre", 1)
                # Give the player the reward via the Item Granter device
                # note: change the item set on RewardItem in the editor to Spectralite Pickaxe
                RewardItem.GrantItem(Agent)

Comments

    Sign in to vote, comment, or suggest an edit. Sign in