Sign In Register

How can we help you today?

Start a new topic
Answered

How to store player skill & how persistent is script data?

Heya,


I've been scratching my head a bit regarding player skill. Matchmaking requires me to pass through a skill level for the player, but you'd think this would be something tied to the player object not something I have to manually pass through. In Cloud Code, the getPlayer() object even has a skill variable, but it's not passed through with a AccountDetailsRequest. 


My guess is that the skill variable in Cloud Code is populated via the skill passed in with a match making request... which means the player skill is something I have to store and manage on my own, which is perfectly fine. 


Which brings me to my next question - how persisted is ScriptData? The documentation says that it persist through the lifetime of the player. Does this mean it's stored across session or is a lifetime just the session, after which the ScriptData gets destroyed?


Best regards,

Damir H.


Best Answer

Hey Damir, 


player.scriptData is only ever removed manually. It stays persistent on the player's database. If you think of the player as an entry in a huge database named Players, then scriptData will be a JSON object in that entry. You can place data inside that object and it will stay there and can be retreived through cloud code or accountDetails request. 


So it's not limited to sessions. It remains active as long as you dont remove it. There is also privateData which works exactly the same way but you can't retrieve it using accountDetails request, only through cloud code.


Hope this helps,

Omar


Answer

Hey Damir, 


player.scriptData is only ever removed manually. It stays persistent on the player's database. If you think of the player as an entry in a huge database named Players, then scriptData will be a JSON object in that entry. You can place data inside that object and it will stay there and can be retreived through cloud code or accountDetails request. 


So it's not limited to sessions. It remains active as long as you dont remove it. There is also privateData which works exactly the same way but you can't retrieve it using accountDetails request, only through cloud code.


Hope this helps,

Omar


1 person likes this

That is perfect, thank you very much.

Login to post a comment