I've been searching for a way to get the achievements by playerid but couldn't find anything.
It feels like it should be pretty obvious, am I missing something?
Thanks.
Best Answer
A
Alp Dogan Urut
said
over 6 years ago
I'm gonna answer my own question since I figured it out.
Hope this helps someone.
I created an event to get the achievements array with an attribute called "player_id".
Then I added following cloud code to return the achievements.
var playerId = Spark.getData().player_id
var player = Spark.loadPlayer(playerId)
var achievements = player.getAchievements()
Spark.setScriptData("achievements", achievements)
Yes you are correct here, you would use loadPlayer to get the achievements for the supplied playerID. For the current player you would use the following.
var ACH = Spark.getPlayer().getAchievements();
That should cover everything. If you have any further questions just let me know.
Thanks,
Liam
A
Alp Dogan Urut
said
over 6 years ago
Answer
I'm gonna answer my own question since I figured it out.
Hope this helps someone.
I created an event to get the achievements array with an attribute called "player_id".
Then I added following cloud code to return the achievements.
var playerId = Spark.getData().player_id
var player = Spark.loadPlayer(playerId)
var achievements = player.getAchievements()
Spark.setScriptData("achievements", achievements)
Alp Dogan Urut
Hi,
I've been searching for a way to get the achievements by playerid but couldn't find anything.
It feels like it should be pretty obvious, am I missing something?
Thanks.
I'm gonna answer my own question since I figured it out.
Hope this helps someone.
I created an event to get the achievements array with an attribute called "player_id".
Then I added following cloud code to return the achievements.
- Oldest First
- Popular
- Newest First
Sorted by Newest FirstCustomer Support
Hi Alp,
Yes you are correct here, you would use loadPlayer to get the achievements for the supplied playerID. For the current player you would use the following.
That should cover everything. If you have any further questions just let me know.
Thanks,
Liam
Alp Dogan Urut
I'm gonna answer my own question since I figured it out.
Hope this helps someone.
I created an event to get the achievements array with an attribute called "player_id".
Then I added following cloud code to return the achievements.
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics