You can use this function to send your achievements to the chosen leaderboard and achievement service. On Android you will need the the ID of the achievement as a string (this is the unique achievement ID that got assigned when you set up the achievement), while on all other platforms you supply the achievement name as a string, and then you give the percentage that you have completed towards getting the achievement (0 - None, 100 - Completed). The function will trigger a Social Asynchronous Event where the returned async_load DS map will have the following key/value pairs:
- "type" - This is the type of event that has been fired, which will be the string "achievement_post_result" for this function.
- "id" - This is the ID of the event, and, for this function, it will return a GML constant GooglePlayServices_EVENT_ID_POST_ACHIEVEMENT.
- "achievement_id" - This is the unique ID of achievement that has been updated.
- "status" - This will be 1 if the achievement was updated successfully, or 0 if the request failed
achievement_post(achievement, percent)
Argument | Description |
---|---|
achievement | The name/ID of the achievement. |
percent | The percentage of the achievement completed. |
N/A
if achievement_available() achievement_post(global.Achievement[0], 100);
The above code checks to see if the chosen leaderboard and achievement service is available and if so it posts an achievement.