Achievements
Make your mod's achievements - what unlocks each (a stat the game counts, or a counter of your own your Lua scripts and Blueprints feed), secret ones, icons, and how the pop-up and the page look under the Original interface, the Remastered Interface and NorrathUI. The Achievements module and achievements.toml.
The game has no achievements of its own. Mods make them: each enabled mod's achievements add up, and the pause menu shows an Achievements page ("Achievements 3 / 12", the highlighted one's icon and description under the list) as soon as any enabled mod defines one. Unlocking one shows a pop-up at the top of the screen.
Achievements are this machine's player's, kept in achievements.ini in the game's user data folder. Once unlocked
they stay unlocked, even if the mod is turned off and on again.
Edit them in the Achievements module (Scripts, Text & Audio section), which writes gamedata/achievements.toml.
The example-achievements mod is a complete example (see Examples).
Making one
In the Achievements module, New adds an achievement. Its id is how players' unlocks are kept: never rename it
once the mod is published, and start it with your mod's name (mymod_first_blood) so another mod's can't collide.
| Key | |
|---|---|
name |
The name shown on the page and in the pop-up |
description |
What to do, shown under the page's list |
stat |
What unlocks it: a stat the game counts, a counter of your own, or empty for one only a script unlocks |
goal |
The stat's value that unlocks it (default 1) |
order |
Its place on the page, lowest first (default 1000, then by id) |
hidden |
A secret: shown as "???" with no description until it is unlocked |
progress |
While locked, the page shows "37 / 100" rather than "(Locked)". Default: on when the goal is above 1 |
icon |
A picture: a PNG in your mod (ui/achievements/slayer.png; 64 × 64 is plenty) or an ICONS.LMP entry (icbash.tex). Optional |
icon_remastered, icon_norrath |
The picture under the Remastered Interface and NorrathUI (below) |
remove |
Takes out an achievement of this id that an earlier mod made |
[achievement.mymod_slayer_100]
name = "Monster Slayer"
description = "Slay 100 creatures."
stat = "kills"
goal = 100
icon = "ui/achievements/slayer.png"
A later mod in the load order can change an earlier mod's achievement key by key, as with the other game data files, or remove it.
The module's preview shows what unlocks the selected achievement, the pop-up as each interface draws it, and the line of Lua that feeds or unlocks it (Copy puts it on the clipboard). Stats and counters lists the stats the game counts and the counters your mod's scripts feed; an achievement whose stat is neither is flagged.
Stats the game counts
The game counts these for this machine's own heroes:
| Stat | Counts |
|---|---|
kills |
Creatures slain (the killing blow) |
best_hit |
The most damage of a single blow (the highest) |
hero_level |
The highest level of a hero (the highest) |
finished |
The hardest difficulty the game was finished at (the highest): 1 Adventurous, 2 Courageous, 3 Champion, 4 Legendary, 5 Epic, 6 to 15 Epic+1 to Epic+10 |
boss_rush |
Boss Rush runs cleared |
versus_wins |
Versus and Team vs Team rounds won in the Arena |
coop_wave |
The highest wave reached in an Arena co-op run (the highest) |
falls |
Times a hero fell |
Finishing on Epic sets finished to 5, so an achievement with goal 3 (Champion) unlocks with it.
Counters of your own
Any of your Lua scripts (hero, monster or game scripts) can feed counters of your own, which your
achievements name as their stat, or unlock an achievement outright:
| Call | Does |
|---|---|
rta.achievement_add(who, counter, [n]) |
Adds n (default 1) to a counter |
rta.achievement_max(who, counter, value) |
Raises a counter to value if that is higher (a best: it never goes down) |
rta.achievement_unlock(who, id) |
Unlocks an achievement by its id |
who is the hero who did it (a hero table, or a party slot such as m.target_hero), or nil for the whole party.
Only that hero's player counts it. Name your counters after your mod, too (mymod_bosses).
-- scripts/game/counters.lua
function on_monster_death(m)
if m.boss and m.foe then rta.achievement_add(nil, "mymod_bosses") end
end
function on_pickup(hero, item)
if item.gold > 0 then rta.achievement_add(hero, "mymod_gold", item.gold) end
if item.quality == 2 then rta.achievement_unlock(hero, "mymod_first_unique") end
end
[achievement.mymod_bosses_5]
name = "Giant Killer"
description = "Defeat 5 bosses."
stat = "mymod_bosses"
goal = 5
[achievement.mymod_first_unique]
name = "Treasure Hunter"
description = "Pick up a unique item."
hidden = true
The Lua Scripts module has an Achievement counters template to start from.
In the Blueprint Editor, the Achievements nodes do the same: Add to Achievement Counter, Raise Achievement Counter and Unlock Achievement.
Note The calls only report: a script can't read a counter or ask whether something is unlocked, since each player's achievements are their own and differ from machine to machine. In network games every player's machine counts its own heroes' achievements. In a server-run game (Return to Norrath Online) your scripts' reports reach every player, but of the stats the game counts only
hero_levelandfallsare counted there.
The look per interface
The pop-up and the page can look different under each interface. In the module, open Look per interface and pick Original, Remastered Interface or NorrathUI. Each starts from the one before it (Remastered from Original, NorrathUI from Remastered), so set only what differs.
| Key | |
|---|---|
title |
The pop-up's first line (default "Achievement Unlocked") |
seconds |
How long a pop-up shows (default 4) |
y |
The pop-up's top, in the original's 640 × 448 screen (default 22) |
plate |
The pop-up's plate colour, #rrggbb or #rrggbbaa (default #00000099) |
title_colour, name_colour |
The pop-up's text colours (default: the interface's own) |
sound |
A sound as the pop-up shows: an fx.lmp entry or "<lump>/<entry>" (default none) |
icons |
Whether icons show on the page and in the pop-up (default true) |
locked_text, unlocked_text |
After a name on the page (default "(Locked)" and "(Unlocked)") |
hidden_name |
A hidden achievement's name while locked (default "???") |
[style.original]
sound = "menu_main_accept.anm"
[style.norrath]
title = "Feat Accomplished"
plate = "#1a1208e6"
title_colour = "#d9b25a"
y = 60
Each achievement can have its own picture per interface too: icon for the Original interface,
icon_remastered for the Remastered Interface, icon_norrath for NorrathUI. A missing one uses the one before it.
An interface mod (NorrathUI included) can also draw the pop-up and the page itself, with
the screens hud.achievement and menu.achievements, and hear each unlock with ui.on("achievement", fn).
Testing
Turn your mod on and play: the pause menu's Achievements page lists your achievements. To try a counter's goal quickly, give it a goal of 1 while you test.
