Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Neikke on March 09, 2018, 09:06:55 AM

Title: How to create Achievements for Score and Money earned
Post by: Neikke on March 09, 2018, 09:06:55 AM
Hi,

I have infinite runner with Score and Coin count, so I wanted to ask what would be the correct approach (from Playmaker perspective) to make a logic which would trigger a command for Steamwork's "Unlock Achievement" action. And also how would I make it so that it's not triggered every time I collect the same amount of score or coins. How would you recommend setting it up? Thanks a lot in advance!
Title: Re: How to create Achievements for Score and Money earned
Post by: Fat Pug Studio on March 09, 2018, 10:48:48 AM
Let's say you have "collect 500 coins" achievement. Besides having a resettable counter for current coins collected, you nees to have a total collected coins counter (that should be permanently stored via easy save or playerprefs) and a listener that will trigger the achievement once you get over 500 coins. The thing that will prevent from activating the achievement every time is a simple bool that will check if the achievement is unlocked every time the number of coins is checked. So you need a list of achievements with a bool attached. Best way is to make a hashtable of bool values where the key would be achievement name and bool is true/false (locked/unlocked) which is also permanently saved.