question

Mihael Grilec avatar image
Mihael Grilec asked

ModifyItemUses on an item in character's inventory

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
},
10 |1200

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

brendan avatar image
brendan answered

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.

4 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.

mgambrell avatar image mgambrell commented ·

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!"

0 Likes 0 ·
brendan avatar image brendan mgambrell commented ·

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.

0 Likes 0 ·
mgambrell avatar image mgambrell brendan commented ·

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.

0 Likes 0 ·
Show more comments
office@gamednastudio.com avatar image
office@gamednastudio.com answered

I also need this. It's a shame that it's still not available :/

10 |1200

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

brendan avatar image
brendan answered

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.

10 |1200

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

office@gamednastudio.com avatar image
office@gamednastudio.com answered

But these are 3 API calls instead of 1, what about Cloud Script call limit?

10 |1200

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

brendan avatar image
brendan answered

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.

10 |1200

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

sevdanski avatar image
sevdanski answered

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.

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.

brendan avatar image brendan commented ·

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.

0 Likes 0 ·
sevdanski avatar image sevdanski brendan commented ·

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

0 Likes 0 ·
brendan avatar image brendan sevdanski commented ·

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.

0 Likes 0 ·
birbilemir avatar image
birbilemir answered

Well its still not completed awesome :)

10 |1200

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

Alex Ong avatar image
Alex Ong answered

Well its still not completed in 2021 June

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.