Sign In Register

How can we help you today?

Start a new topic
Answered

How to setup achievements with grouping?

i'm running to a little problem using grouping to setting up a list of achievements based on the same event, and the MonsterDefeated event has the following parameters:

  1. monsterLevel (number / max)
  2. monsterType (string / grouped)

where monsterType can be A, B, C, or D etc. i need one achievement for when a player defeats a level 10 monster of each type. i.e. monsterLevel == 10 && monsterType == X where each achievement has a different monsterType X. 


i can setup one leaderboard for each monsterType, and then setup one achievement for each leaderboard. however, i strongly suspect that with the sophisticated gamesparks achievement system, there must be a more elegant way of setting this up. much obliged.


Best Answer
Hey Hamlet,

You could get the script data from the event you are sending in and then use a switch-case to send off the different achievements. So you'd need an achievement for monster A,B,C,D

Then you get the string from script-data using something like....

var mType = Spark.getData().monsterType

then just give out the achievements.

switch(mType){
 
        case "A":
               Spark.getPlayer().addAchievement(monsterA_ach);
               break;
}

Does that sound like what you need?

Sean

 


Hi Hamlet,


Your setup seems great to me!

Have you considered Segments for this?


Thanks,


Oisin.

hi oisin, 


thanks for your suggestion, segment looks like a way to group users, but not a tool to group data for the same users. from my take on the documentation, it looks like the group settings is what i need, but there is just too little documentation/example on that for me to understand how to use it...


i'm afraid i still cannot get the setup to work. how do i setup the achievements as described above without having to setup one leaderboard for each monsterType? 

Answer
Hey Hamlet,

You could get the script data from the event you are sending in and then use a switch-case to send off the different achievements. So you'd need an achievement for monster A,B,C,D

Then you get the string from script-data using something like....

var mType = Spark.getData().monsterType

then just give out the achievements.

switch(mType){
 
        case "A":
               Spark.getPlayer().addAchievement(monsterA_ach);
               break;
}

Does that sound like what you need?

Sean

 

thanks sean, i believe, though, there is a much simpler way that doesn't require checking script data (checking with script data is in fact really hard to do because you can't control the execution order of the running total update and the check, unless you keep your own running totals too). 


one way that i have found to work (after hours upon hours of fiddling around), is to configure the leaderboard to partition by monster type, and then configure the achievement to use the said leaderboard, and filter trigger data by monterType = A, etc. 


this is in fact not that hard to figure out. where i got stuck was really setting up a running total of the count. as it turned out, the system could only count number type event parameters (which makes no sense, and conflicts with the documentation). anyway, your kind colleague has previously helped me sort this out over a support ticket. i'm including the information here in the hope that it might help fellow developers. cheers. :-)

Login to post a comment