Modding Achievementsystem - Robosturm/Commander_Wars GitHub Wiki

How to mod acheivements?

  • As usual adding scripts to your mod has to happen in the corresponding folder for achievements this is the folder: "scripts/achievements"
  • Implement the function registerAchievements You can register as many achievements as you want using the call userdata.addAchievement(id, target-value, name, description, icon, hidden)
    • where id is the unique id of the achievement
    • target-value is the amount of times the achievement needs to be achieved for fulfilling it
    • name the name of the achievement shown in the menu etc.
    • description the description of the achievement for helping how to achieve it
    • icon shown when achieving the achievement
    • hidden if the achievement infos are hidden till it's achieved
  • implement a custom function which calls userdata.increaseAchievement(id, progress)
    • where id is the unique id of the achievement
    • progress the amount of progress made when calling the function usual this is 1
  • call the custom function in any offer script to report a progress of your achievement. Note: contrary to other modding features the achievement trigger needs to be implemented by yourself. For an example checkout the vanilla achievements.