Sign In Register

How can we help you today?

Start a new topic
Answered

Best way to clear a players inventory?

I'm testing some virtual good operations, and need a way to erase the users inventory, and re-grant these items.  The best way I was able to figure out through the forums and API was through a cloud event "InventoryClear":


var player = Spark.getPlayer();
var myGoods = new SparkRequests.AccountDetailsRequest().Send().virtualGoods;
for(var i in myGoods){
    player.useVGood(i, myGoods[i], "Test Purge");
}

 Is this indeed the best way to do this?  Is there a built in way to purge the users inventory?  Thank you.


Best Answer

Hi Brett,


There is no default method for wiping a players Inventory of Virtual Goods, the way you are currently doing it would appear to be the quickest way to achieve this.

   

You can also do this manually in the Manage Screen. If you navigate there and click on the player search, find the player you are looking for and click edit on them you will be able to remove them there. Check the images below for reference.


Find the player you want to edit.


Here you can remove Virtual Goods, Achievements and edit a users Currency.


Hope that helps, if you have any further questions just let me know.


Thanks,

Liam

1 Comment

Answer

Hi Brett,


There is no default method for wiping a players Inventory of Virtual Goods, the way you are currently doing it would appear to be the quickest way to achieve this.

   

You can also do this manually in the Manage Screen. If you navigate there and click on the player search, find the player you are looking for and click edit on them you will be able to remove them there. Check the images below for reference.


Find the player you want to edit.


Here you can remove Virtual Goods, Achievements and edit a users Currency.


Hope that helps, if you have any further questions just let me know.


Thanks,

Liam


1 person likes this
Login to post a comment