question

Ozan Yilmaz avatar image
Ozan Yilmaz asked

How can I implement these features in Playfab?

Hello everyone,

I have some question to implement some features in Playfab. Small code examples would be great for some answers.

1) How can make an e-mail & password system? How can I store their password as encrypted? Also, how can I make "forgot password" system?

I am thinking of releasing my game on multiple platforms, so that I don't want the players to start the game from the beginning when they switch platform.

2) The players can buy and sell weapons in the game. Should I mark them as Durable or Consumable?

3) How can I limit the both stackable and unstackable items? Can I get how many instance of an item the player has in the script and write a basic if statement?

In the game, some weapons are dual wielded. For those weapons, the player can buy the same weapon up to 2 times. I marked those weapons as stackable since I can read it easily and show the player, and I am thinking of writing a basic if statement by checking the weapon's custom data to see if it is dual wielded. If so, I will cancel the purchase process if the stackable amount is 2.

Same thing for the other weapons too. I want the players buy the other weapons once. I didn't marked them as stackable, and I am thinking of writing an if statement in the script.

4) The players can buy weapons in the game. After buying a weapon, the player can buy ammo for the weapon. Is there a way to implement this feature?

Every weapon has different ammo prices. Defining a new item wouldn't help my situation. It doubles the amount of item in the catalog.

I am thinking of defining ammo price in the custom data and when the player presses the buy button, I will check if the player has the weapon. If so, I'll read the custom data of the item to check the ammo price. This leads me to another question. Can I read custom data of an item in the script?



5) Is there a way to organize catalog items by their types?

Since I define all the weapons and their attachment in the same catalog, items look disorganized.

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

>> 1) How can make an e-mail & password system? How can I store their password as encrypted? Also, how can I make "forgot password" system?

PlayFab offers such e-mail & password system that you can utilize directly: LoginWithEmailAddress, you may also find this doc helpful: Login basics and best practices. For the “forgot password” system, you can utilize the account recovery email to do the job, here is doc: Using email templates to send an account recovery email.

>> 2) The players can buy and sell weapons in the game. Should I mark them as Durable or Consumable?

You can use the Trading system (currently in preview) PlayFab offers to implement this feature, please navigate to this link to learn about more: Trading quickstart. Durable or Consumable are item-specific attributes, which does not affect the trading system, therefore, you should mark them according to each item’s design, and, you may need to mark them as tradable.

>> 3) How can I limit the both stackable and unstackable items? Can I get how many instance of an item the player has in the script and write a basic if statement?

In your dual wield weapon case, you can call GetUserInventory to get the array of inventory items (Custom Data included) belonging to the player and check whether the stackable amount is 2 before performing the purchase process. For other weapons, the basic idea is similar.

>>4) The players can buy weapons in the game. After buying a weapon, the player can buy ammo for the weapon. Is there a way to implement this feature?

I don’t understand why doubling the amount of item in the catalog bothers you, could you please elaborate on that?

>>5) Is there a way to organize catalog items by their types?

You can use the “Filter” button on the top-right side of the catalog page to help you organize if that’s what you are talking about:


filter-button.png (15.6 KiB)
5 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.

Ozan Yilmaz avatar image Ozan Yilmaz commented ·

Thank you for the detailed answer.

I will give more details about the 4th question. Let's say there's a weapon called Weapon A in the store. The weapon's price is 500 and its ammo price is 100. In the game, if the player hasn't bought the weapon, I will show the weapon's price (which is 500). When the player buys the weapon, I will show the ammo price of the weapon (which is 100). In Playfab, I need to define those prices; however, I can only define 1 price for 1 item. My question is how can I implement this feature?

I am thinking of defining the ammo price in the custom data and read that data in the script (while checking if the player has already have the weapon itself). I am new to Playfab, so that I don't know if I can do that and how I can do that.

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan Ozan Yilmaz commented ·

If you define the ammo price in the custom data other than in the catalog as an item, you won't be able to use the powerful Economy system PlayFab offers to deal with ammo. Therefore, I would recommend that you define ammo as an item to better manage all the virtual items in your game. Or, you may need to consider building a separate system to deal with ammo, which might be a hassle since you'll need to subtract Virtual Currency to simulate purchase, change custom data to reflect new purchases, etc. manually.

0 Likes 0 ·
Ozan Yilmaz avatar image Ozan Yilmaz Citrus Yan commented ·

Thank you for the answer.

I will use custom data anyway because there is an item limit in my tier. I will try to decrease the virtual currency in the cloudscript.

0 Likes 0 ·
Show more comments
Ozan Yilmaz avatar image Ozan Yilmaz commented ·

For the 4th question, I have an item limit and there is a lot of guns in the game.

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.