Achievements
Achievements are a great way to reward players for completing specific tasks or reaching certain milestones in your game.
In EOS, achievements are attached to a specific statistic and can be used to reward players for their progress in the game.
Creating new achievements
-
Go to the EOS Developer Portal (opens in a new tab) and log in with your Epic Games account.
-
Click on the Achievements tab on the left side of the screen, under the Game Services section.
- Click on the + New Achievement button to create a new achievement. Now, it will ask you to select a Stat Name and Stat Value.
- After providing the Stat Name and Stat Value, you can now create the achievement.
Although, you will have to pass additional parameters like Achievement Name, Achievement Description, Achievement Icon etc to create the achievement.
Updating player achievements
The updates to the achievements are done automatically when you update the statistic value. The achievement will automatically unlock when the player reaches the required value of the statistic.
Retrieving player achievements
To retrieve the player's achievements, you can use the Get EIK Achievements
node. This node allows you to get the achievement data for the local player.
Cannot view the code? Click here (opens in a new tab)
Retrieving more information about an achievement
The above function will return the achievement data for the local player which contains the ID of the achievement and it's progress which is not enough to display the achievement in the game.
To get more information about the achievement like the Achievement Name, Achievement Description, Achievement Icon etc, you can use the Get EIK Achievement Definition
node.
Cannot view the code? Click here (opens in a new tab)
Unlocking an achievement
After the player has completed the task or reached the milestone required for the achievement, it will automatically unlock. There is a callback that you can use to check if the achievement has been unlocked + the overlay will also be displayed in the game.
That is it! You have successfully created, updated, and retrieved achievements for the player in your game.