Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • API and SDK Questions /
avatar image
Question by John Peterson · Sep 20, 2017 at 09:50 PM · CloudScriptapis

Granting an item resurrected a previous instance of the item that had been deleted.

Title 44B1.

Dear PlayFab community,

I have been testing the Server API with CloudScript and the various inventory-management related functions. During my testing, I've been granting myself (via Game Manager) multiple instances of an item (Stacked/Durable), setting some CustomData, and deleting instances.

I came across something very strange this afternoon: I had zero instances of this item and went to grant myself an instance via Game Manager. When it granted the item, I noticed that the CustomData element was highlighted! Sure enough, when I examined the CustomData on this newly-granted item, it had some values from an earlier test.

I am concerned that when it granted the item, it recycled one of the previous instances that I had deleted. I want to make sure that when I grant an item, it will be brand new, with no lingering CustomData.

I notice a Revoke button in Game Manager. Instead of adjusting the count of an item with system.ModifyItemUses(), should I be somehow Revoking these items, instead?

Comment

People who like this

0 Show 0
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Brendan · Sep 20, 2017 at 11:23 PM

Thanks for calling this out - I've tested a number of different combinations of durables/consumables, both consuming them and revoking them. What I'm seeing is that if I revoke the item, it does look like the next time the player is granted that item, it's always a fresh stack - no carryover of CustomData. But if the item is consumed, there's a short window while the just-consumed stack is in the queue for cleanup in which, if you add another instance of that stackable item to the player, it's re-using the stack. So the count is correct, but the CustomData is carried over in that case. But that's a relatively short window of time, so you can't rely upon that - which makes it an inconsistent result. I've opened a bug on this, so that we get it fixed as soon as possible.

Comment
John Peterson

People who like this

1 Show 2 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image jwang · May 23, 2018 at 11:26 PM 0
Share

Hi there,

Just wanted to note that I've experienced the same issue.


Easy steps to reproduce:

- Award a character an item

- At a later point, set some custom data on the item instance awarded to the character. (e.g. 'equip' info)

- "Consume" the item.

- Shortyl after, award the character the same item again.

- Observe that the custom data from the previous item instance is set on the new item instance

My workaround for now is to have clients call a cloud script to consume items, rather than using the clientAPI. The cloudscript will then consume the item, and if the remaining uses would go to '0' it will clear the custom data prior to removal of the item. Not ideal, but it works.

avatar image Brendan ♦♦ jwang · May 24, 2018 at 06:33 AM 0
Share

As I said above, if the item has not been cleaned up after being consumed, it will be re-used. Your solution of clearing the Custom Data for the case where you're about to consume the last element from the item would work quite well for this case.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    3 People are following this question.

    avatar image avatar image avatar image

    Related Questions

    Advantages of CloudScript over Calling JavaScript from Node.js 1 Answer

    Having trouble using httpRequest to access PayPal API 1 Answer

    There is a problem with the certificate when using the container. 1 Answer

    How can I Remove member from Group/Clan using Cloudscript? 1 Answer

    Prevent the Users Unlink Accounts 1 Answer

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges