GameSalad & Playfab: Store Items 2

Posted by

The integration file has a new home on Github. Please make sure you grab the latest version of the file before you continue.

In previous posts, I showed how to get the store items and virtual currency. In the final part of the store items posts, I’ll detail the steps to retrieve the user’s inventory and how to purchase an item.

To retrieve the player inventory create a table called “userInventory”. If you are using the default configuration you are going to need a table with 3 columns. All the columns should be text.

Screen Shot 2020-05-04 at 8.28.53 PM

You can change this as usual in the configuration but for now, the RemainingUses has to stay as column 3, and column 1 should be the ItemId. You can change the value of column 2 and add any columns you wish past column 3.

Here is what the default configuration looks like.

tableColumnsValues:[‘ItemId’,’DisplayName’,’RemainingUses’]
For this to work before you call the PlayFab “getTable” (detailed in a previous post) you will need to call this first. Otherwise, the PlayFab init call will not have anything to populate the table with.

Screen Shot 2020-05-04 at 5.01.20 PM

To purchase an item all you need to do is call TweetSheet behavior with the name of the id of the item. In my implementation, I dynamically determine this by actor properties that reference the store items table. The item has to be in the store items table for this to work.

Screen Shot 2020-05-04 at 5.21.09 PM

If it is successful, Playfab will update both the virtual currency amount and the inventory items and the integration file will make the appropriate updates to the tables of rows corresponding to those.

Created a short video to show it working:

 

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.