question

tairos21 avatar image
tairos21 asked

How to use UpgradeFromItems on StartPurchase

Hello,

I'm trying to figure out what the parameter UpgradeFromItems (inside of an ItemPurchaseRequest) is for.

What I try to achieve is like a typical upgrade where you use 5 basic runes + 100 gold, and you get 1 advanced rune.

I'm using StartPurchase in order to do all in a single transaction with the server, so i can avoid interruptions by losing internet connection and causing an incomplete upgrade.

Any thoughts?

Thank you

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

It's a leftover from a previous revision of the purchasing code, and it was fairly narrow in terms of usage, as it was specific to a particular scenario. All it does is check that the number of items in the UpgradeFromItems array matches the quantity of the ItemId being purchased. What you're looking for is more of a crafting/alchemy system, which we have a backlog item for (https://community.playfab.com/idea/643/208258617-Crafting.html). Right now, you could do this using Cloud Script - get the player inventory, check that it has the items in question, then add the advanced rune and remove the basic runes+gold.

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

tairos21 avatar image tairos21 commented ·

Yeah I had some problems with the execution time with cloudscript, but i'll check it again.

Thanks for your reply

0 Likes 0 ·
Vovin Lonshin avatar image Vovin Lonshin commented ·

any update on this? is Cloud Script still the best way to do this?

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.