question

ProjectAether avatar image
ProjectAether asked

Revoke (remove) item question

hi i have a question how can i delete a item of a specific catalog like "weapons"

what i want is buy a weapon (catalog handguns) and then delete the previus weapon (same catalog)

i just want have 1 of these how can i do it ?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
JayZuo avatar image
JayZuo answered

As I understand it, you are using durable items for weapons in your catalog. And for a player, he can only have one weapon in his inventory. So, when the player buys a new weapon, you want to remove the previous weapon from his inventory. Do I understand it correctly?

If so, you can use a cloud script function to do this. When player wants to buy a weapon, you will call this function. In the function, you can check the player's inventory by using GetUserInventory method and then check all item instances to see if there is a weapon. If no, then give the weapon to the player. If there is already a weapon, then get the "ItemInstanceId" and give the new weapon to player and finally call RevokeInventoryItem with the "ItemInstanceId" you've got to remove the previous weapon from player's inventory.

3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ProjectAether avatar image ProjectAether commented ·

can you give me an exaple to make a function o revoke a item ? i know how to change statistics but via cloudscrip but not to revoke item please

0 Likes 0 ·
JayZuo avatar image JayZuo ♦ ProjectAether commented ·

In CloudScript, you can use something like the following to call server APIs.

server.RevokeInventoryItem({
    PlayFabId: currentPlayerId,
    ItemInstanceId: "xxx"
})

For more details, please see Writing custom CloudScript.

0 Likes 0 ·
ProjectAether avatar image ProjectAether JayZuo ♦ commented ·

Tnx dude im working on that!

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.