question

Jonathon Mckay avatar image
Jonathon Mckay asked

Remove all items from player's inventory

Since I'm testing some features, now my inventory is completely full and it's a huge pain to remove items one at a time. Is there any way to completely remove the entire player's inventory?

Thx

Player Inventory
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

·
Joshua Strunk avatar image
Joshua Strunk answered

Not with a single API call. You have a couple options.

1.) Switch to using characters more heavily(even if your game would only ever have one per user) and then build out CloudScript calls to quickly delete and create new characters. Depending on how much gameplay data you store in your characters this is the cleanest option to get back to a "clean build" on an account.

2.) CloudScript call could remove up to 9 items at a time. Server.GetUserInventory combined with Server. RevokeInventoryItem. This function could then be called from the game manager or through an external client. You would need to call it multiple times if a user has a large set of items and you might need to space those calls out.

You could also toy around with using the Admin api and build a custom account management tool but I think the above two methods would serve you better overall.

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.

Jonathon Mckay avatar image Jonathon Mckay commented ·

Thank you Joshua

1 Like 1 ·
Joshua Strunk avatar image Joshua Strunk Jonathon Mckay commented ·

No problem. I found big got ya with the character technique today.

If you do not set up a custom way of deleting characters through the server api and remove characters through the game manager all the items on the deleted character will be moved to the parent user account. This ends up flooding the user with the items and really just moves the problem around.

TL;DR Make sure if using characters to quickly reset items and stats you set up a CloudScript or other Server api call to delete the character with the move items flag set to false.

1 Like 1 ·
brendan avatar image brendan commented ·

One caution on this is that running a Cloud Script multiple times in a row, and in particular to call a Server API more times than is allowed within the limits, is risky. The limits are specifically designed to ensure that no one title can put excessive load on any component. If you need higher limits, you should be working with us on a custom agreement that covers your usage. Attempting to work around them runs the very real risk of getting the title throttled due to violation of our Fair Use policy.

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.