Can a ModifyItemUses call be used to modify item uses in the character inventory?
The call fails with "InvalidItemProperties: Unable to find item with id 3510550183672790558". I'm doing this call from cloudscript:
server.ModifyItemUses({
PlayFabId: currentPlayerId,
ItemInstanceId: "13AD7DC8C97EB66E",
UsesToAdd: -1
});
A users character has an inventory item with the same ItemInstanceId.
This is the item's definition:
{
"ItemId": "extra_gold",
"ItemClass": "perk",
"CatalogVersion": "perks",
"DisplayName": "Bonus Gold",
"Description": "Cha-ching! More gold when a monster drops dead!",
"VirtualCurrencyPrices": null,
"RealCurrencyPrices": null,
"Tags": [],
"CustomData": "{\"extra_gold\":\"1\"}",
"Consumable": {
"UsageCount": 1,
"UsagePeriod": 1,
"UsagePeriodGroup": "perk"
},
"Container": null,
"Bundle": null,
"CanBecomeCharacter": false,
"IsStackable": false,
"IsTradable": false,
"ItemImageUrl": null
},
Answer by Brendan · Jan 12, 2016 at 12:28 AM
Not currently, but it would make sense for us to update this API call the same way we updated ConsumeItem, back when we added Characters to the service. Thanks for calling this out - I'll enter a work item to get this added. We'll update this thread when this has been done. In the near-term, you could either use ConsumeItem from the Client, or move the item from the Character to the User, and then back after the modify call.
I want this too...
Using playfab is like playing a scratch-off lottery game. "Scratch off one of these obvious functionalities to see if it exists or not! See if you can cobble together a working algorithm from one of the existing functionalities you uncover!"
We do have a pretty broad range of functionality, so it can be confusing working out the best way to implement features. Whenever you have questions on the best approach to a particular gameplay design, the best thing to do is to post a question detailing the question from a top-down approach - that is, what is the actual experience for the player? That way, we can work with you to come up with the best technical solution.
I wish I could work that way. Unfortunately, composing a question I'm happy with is usually equivalent to answering it myself. I don't think I would need guidance through the minefield of not-implemented-yets and on-the-client-but-not-the-servers and on-the-servers-but-not-the-clients if there weren't so many mines.
Answer by office@gamednastudio.com · Apr 22, 2016 at 08:07 PM
I also need this. It's a shame that it's still not available :/
Answer by Brendan · Apr 23, 2016 at 02:02 AM
We'll add this as soon as we can. Again, for now the workaround would be to use ConsumeItem from the Client API set, or to move the item from the Character to the User, modify the item usage count, and move it back.
Answer by office@gamednastudio.com · Apr 23, 2016 at 09:36 AM
But these are 3 API calls instead of 1, what about Cloud Script call limit?
Answer by Brendan · Apr 23, 2016 at 10:21 AM
Yes, that is one of the reasons we want to provide a way to directly change the uses remaining on a character item as soon as we can. For now, it does mean needing to use ConsumeItem, which is a single API call, or else move the item to the player, change the uses, then move it back, which would be three.
Answer by Sevdanski · Nov 17, 2018 at 12:35 AM
This is really frustrating.
I just want to be able to give characters x number of stackable items. I am already having to jump the the hoop of
- loading the inventory
- figuring out which items they don't have then granting the ones they don't (just so I can get an instance id)
- use a combination of the inventory and the add items results to find the instance ids
- loop over all of the items that I want to give the character ModifyItemUses
Now I am finding that it doesn't work because I have to jump through another hoop of moving the items to the main character and back again? And it has been this way for over 2 years?
This is just adding yet another possible fail point. I can easily see some value being off and now a players items are in limbo in some other place.
I am going to have to seriously consider dropping multiple characters from our project as this just doesn't seem feasible. Its a shame because I have put a lot of effort into this.
This is actually one of the reasons we're moving to the new commerce model we mentioned in the blog post (https://blog.playfab.com/blog/upcoming-roadmap-2018-q4-oct-dec-edition). That system will also support a complete UGC service which will also give you the option to let players sell their UGC for real-world money.
Thanks for the response Brendan - as usual you guys are on top of things.
I know you guys don't like to give out dates but the blog posts states that you are hoping to have it out by December - is that still looking likely?
I only ask because I have to make some decisions about my game and I can hold off for a few weeks, but if it is going to be much longer than that then I need to start looking at alternatives
Cheers,
Andrew
Actually, we really like giving out dates. Because if we can, that means we're on track to completion of the feature by when we're saying. When we don't, it's because we can't guarantee the date. So if we arbitrarily picked what we thought was reasonable and then missed it, we're letting down people who may have taken a dependency on that date.
The Commerce model will be in preview in December. General Availability will be in Q1.