FakeAchievements is a Rain World helper which allows the creation of custom, Steam-like achievements that can be displayed anytime on screen.
To create an achievement follow these steps:
- Install the FakeAchievements mod
- Download and add the stripped dll to your project's referenced assemblies and add the mod as a dependency of your mod
- Create an
achievementsfolder in your mod's root folder - Create a new folder in that folder named after you achievement id
- Add a file named
image.pngin the folder (this will be your achievement icon) - And another file named
langs.json, this file will contain your achievement translations
- Use
achievements grant [achievement_id] [float delay = 0] [bool cosmeticOnly = false]command in the DevConsole mod console (for debbuging) - Use
AchievementsManager.GrantAchievement("your_achievement_id", [delay: 0f], [cosmeticOnly: false])in your mod's code to display the achievement
Note achievements are by default only ever displayed once; To allow an achievement to be displayed again:
- Use
achievements revoke [achievement_id]command in the DevConsole's mod console (for debugging) - Use
AchievementsManager.RevokeAchievement("your_achievement_id")in your mod's code to allow the achievement to be "unlocked" and displayed again
The full code of the examples below can be found on the example mod repository.
using FakeAchievements;
using BepInEx;
namespace YourModNamespace
{
[BepInPlugin("your_mod_id", "Your mod name", "0.1.0")]
class Plugin : BaseUnityPlugin
{
public void OnEnable()
{
On.Player.Die += Player_Die;
}
private void Player_Die(On.Player.orig_Die orig, Player self)
{
orig(self);
AchievementsManager.GrantAchievement("your_achievement_id");
// Or
AchievementsManager.GrantAchievement("your_mod_id/your_achievement_id");
}
}
}using FakeAchievements;
using BepInEx;
namespace YourModNamespace
{
[BepInPlugin("your_mod_id", "Your mod name", "0.1.0")]
class Plugin : BaseUnityPlugin
{
public void OnEnable()
{
On.Player.Die += Player_Die;
}
private void Player_Die(On.Player.orig_Die orig, Player self)
{
orig(self);
// This unlocks the achievement itself
AchievementsManager.GrantAchievement("your_achievement_id");
// Or
AchievementsManager.GrantAchievement("your_mod_id/your_achievement_id");
// This only displays the achievement without actually marking it as granted
AchievementsManager.GrantAchievement("your_mod_id/your_achievement_id", true);
// This displays the achievement after a brief delay of unlocking it
AchievementsManager.GrantAchievement("your_mod_id/your_achievement_id", 200);
// This "locks" / "revoke" the achievement, allowing it to be unlocked again
AchievementsManager.RevokeAchievement("your_achievement_id");
// Or
AchievementsManager.RevokeAchievement("your_mod_id/your_achievement_id");
}
}
}{
"english": {
"title": "You died :(",
"description": "My achievement description"
},
"french": {
"title": "Vous êtes mort :(",
"description": "La description de mon succés"
}
}If you want to reload the achievements at any time you can use:
- The
achievements reloadcommand in the DevConsole mod console AchievementsManager.LoadAchievements()