question

Pat avatar image
Pat asked

Removing an item from a character

I am creating a crafting system and was wondering what would be the best way to remove an item from the characters inventory? The character has the ingredients in the inventory and I want to replace the ingredients with the item that the character creates. Would I just do a cloudscript call to revoke the item?

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

·
brendan avatar image
brendan answered

So, what you have in mind is a crafting system, then - N items/virtual currencies in and M items/VCs out?

The way to do this would indeed be with Cloud Script.

Removing items/VC

If you want to revoke the items, the RevokeInventoryItem call does take an optional CharacterId, which would be the way to do this. If, however, you want to change the usage count on the item (consume a use from it), you should use ConsumeItem, which also takes an optional CharacterId. For VC, you would use SubtractCharacterVirtualCurrency, since this is a character we're talking about.

Adding items/VC

To add items, use GrantItemsToCharacter. Stackable items will automatically stack with the existing item stack, if there is one. And for VC, it's AddCharacterVirtualCurrency.

10 |1200

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

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.