question

Pat avatar image
Pat asked

character help

So i have a few questions about characters with Playfab. So I have the player able to purchase a character and create it but my question is where can i save stats like health, mana, attack power, etc. Do I add custom fields in the Attributes and save them there or is there an easier way? What is the purpose of the character then?

Also is there a way to delete items from a player? I see I can revoke them but they are still there in the players inventory.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

Characters are objects within the player record which can have their own distinct statistics, inventory, and virtual currency. So yes, you could store health, mana, etc. for the Characters a player has there.

When an item is revoked from the player's inventory, it is removed and will no longer appear in the results of any inventory API call. You will see them still in the Game Manager at the moment, as that listing includes historical items (items previously in the inventory) for customer support purposes. That way, your CSRs can tell if a player had an item in his inventory and has used it up, for instance (with consumables). We are planning on providing an alternative way to know the history on the player, at which time we'll remove those historical items from that display.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Pat avatar image
Pat answered

Ah ok. How would I add statistics to players character then?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

http://api.playfab.com/Documentation/Server/method/UpdateCharacterStatistics

or

http://api.playfab.com/Documentation/Client/method/UpdateCharacterStatistics

 

We recommend using the Server API version in a Cloud Script, so that you can do cheat-checking (boundary checks, time checks, etc.)

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Pat avatar image
Pat answered

So I tried to use the client one, since at the moment I am just testing things out, The UpdateCharacterStatistics isn't showing up with Unity. Is there something I am suppose to add?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

Which version are you using? Searching the current version in GitHub, I am seeing the API call in the Client API file, so it's possible you just need to update.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Pat avatar image
Pat answered

OK, updated the API and now getting an error with the PlayFabHTTP

"Assets/PlayFabSDK/Internal/PlayFabHTTP.cs(176,41): error CS0029: Cannot implicitly convert type `PlayFab.PlayFabError' to `PlayFab.PlayFabError'"

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Pat avatar image
Pat answered

Ok, fixed the error. I had a PlayFabErrors.cs file and after deleting it it went a way. But now I get a ServiceUnavailable error when running the code in unity. When I try to do through the documents it just hangs up.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

That's odd. Can you provide the full error details from the test?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Pat avatar image
Pat answered

Got an error: ServiceUnavailable
UnityEngine.Debug:Log(Object)
CharacterManager:OnError(PlayFabError) (at Assets/_Scripts/CharacterManager.cs:246)
PlayFab.Internal.ResultContainer`1:HandleResults(CallRequestContainer, Delegate, ErrorCallback, Action`2) (at Assets/PlayFabSDK/Internal/ResultContainer.cs:86)
PlayFab.<UpdateCharacterStatistics>c__AnonStorey92:<>m__B4(CallRequestContainer) (at Assets/PlayFabSDK/Public/PlayFabClientAPI.cs:1725)
PlayFab.CallRequestContainer:InvokeCallback() (at Assets/Plugins/PlayFabErrors.cs:248)
PlayFab.Internal.<MakeRequestViaUnity>c__Iterator0:MoveNext() (at Assets/PlayFabSDK/Internal/PlayFabHTTP.cs:252)

 

this is the full error from the log

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

Thanks - when we test this in Postman, everything seems to work fine. Can you give us the PlayFab ID of the user in your test, as well as the Character ID and the specifics on the stats you're trying to set?

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.