question

me-3 avatar image
me-3 asked

Question on how you would add player data to a user on the first time they receive a particular item via cloudscript

Hello,

Apologies if this question may seem basic, I am really new to PlayFab but I was wondering how one would accomplish this? An example/use-case is if a player obtained the item "characterKnight", and on the first time obtaining this then the following playerdata would be added to the user: "characterKnight_Level", "characterKnight_EXP", "characterKnight_Class", etc...

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

·
Citrus Yan avatar image
Citrus Yan answered

You can use Rules to achieve this: create a Rule to fire off an Action based on the “player_inventory_item_added” event (it’s triggered when an item is granted to a player). The Action could be the execution of a custom CloudScript function, which does the following:

  1. Check whether the item is received for the first time.
  2. If it’s received for the first time, add the Player Data for the player, else do nothing.

For more details about Rules, PlayStream events and CloudScript, please check out these docs:

Actions & Rules - PlayFab | Microsoft Docs

PlayStream - PlayFab | Microsoft Docs

CloudScript - PlayFab | Microsoft Docs

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.