achievements_modding_reference

Achievements Modding Reference

Achievements are in game events that can be triggered by specific actions and hooks with some of the main game entities. We will take a look at the anathomy of an achievement and then take a look at all the available hooks to connect the achievement to.

Let's take a look at a typical achievement file to inspect it's exposed properties:

{
  "achievementId": "BuyItem",
  "numberToUnlock": 1,
  "voidSpriteName": "buy_item_locked.png",
  "fullSpriteName": "buy_item_unlocked.png"
}

As we can see the achievement descriptor file is very easy to understand.

First of all we have the achievementId:

"achievementId": "BuyItem",

which represents the unique id identifying the achievement game wise. It will be referenced in other files to instruct the game about which achievement to fire when some event occurs.

Second property is numberToUnlock:

"numberToUnlock": 1,

This is representing the number of events to be fired before the achievement is actually activated. For example: Eat 100 krapfens to unlock the achievement “Krapfen Master”.

Third property is voidSpriteName:

"voidSpriteName": "buy_item_locked.png",

This is just the name of the 64x64px png file representing the LOCKED icon of the achievement. It must be found in the

C:\Users\{YOUR USERNAME}\AppData\LocalLow\RadicalFiction\HARDTIMES\Mods\MyMod_MODPKG\Achievements\Sprites

folder under your mod folder.

Fourth property is the fullSpriteName:

  "fullSpriteName": "buy_item_unlocked.png"

which is representing the UNLOCKED icon of the achievement. It will be found in the same folder as the previous file.

In Hard Times there are some hardcoded achievements which are triggered by events not accessible to the modder. You should not mimnd about those achievements, and are encouraged to not alter the Vanilla achievements system. You are encouraged, however, to add as many achievements you'd like to the game and experiment with hooks to connect those new achievements to available entities and events in game.
In the next paragraph we will see how to do that.

Once you defined a new achievement you will have to connect it to a game event to make it possible for the player to activate it.
There a number of predefined hook points where you can reference any achievement for the game to fire it (achievements with a “numberToUnlock” value greater that 1 must be fired multiple times to unlock the achievement).
NB: remember that you can reference multiple achievements just separting them with a “,”.
Let's take a look at all of the available hooks:

Items Achievements

Items achievements can be specified in the items descriptors and can be attached to the following hooks:

  • achievementsOnCraft: the referenced achievement is fired everytime the player crafts such an item.
  • achievementsOnUse: the referenced achievement is fired everytime the player uses such an item.
  • achievementsOnSteal: the referenced achievement is fired everytime the player steals such an item.
  • achievementsOnBuy: the referenced achievement is fired everytime the player buys such an item.

FOR EXAMPLE:

{
    "itemRootPath": "",
    "itemId": "earthworm",
    "itemSpriteName": "earthworm.png",
    "itemProxySprite": "",
    "itemEffectOnEquip": "",
    "achievementsOnCraft": "EarthwormsCraft",
    "itemExpiration": 0,
    "maxStackable": 10,
    "effectModifiers": []
  }

(note the use of the “achievementsOnCraft” property to reference the “EarthwormsCraft” achievement)

Miniquest Achievements

Miniquest achievements can be specified in the miniquest descriptors and can be attached to the following hooks:

  • achievementsOnComplete: the referenced achievement is fired when the player completes this quest.
  • achievementsOnStart: the referenced achievement is fired when the player starts this quest.

FOR EXAMPLE:

{
  "questType": "BaseQuest",
  "questId": "ernest_one_quest",
  "questSpriteName": "ernest_one.png",
  "isReoccurring": false,
  "startingQuestDialogueId": "start_dialogue",
  "okQuestDialogueId": "ok_dialogue",
  "koQuestDialogueId": "ko_dialogue",
  "achievementsOnStart": "TalkToANpc",
  "achievementsOnComplete": "CompleteAllMiniquest,MiniquestComplete",
  [...lots of other stuff we don't care about right now!!...]
}

(note the use of the “achievementsOnStart” and “achievementsOnComplete” properties

Furnitures Achievements

Furnitures achievements can be specified in the furniture descriptors and can be attached to the following hooks:

  • achievementsOnUse: the referenced achievement is fired when the player uses this furniture.

Please note that attaching an achievement to the crafting of a furniture is actually done by attaching it to the crafting hook of the relative Boxed Furniture Item!

Doors Achievements

Doors achievements can be specified in the doors descriptors and can be attached to the following hooks:

  • achievementsOnUse: the referenced achievement is fired when the player uses this door (passing through it).
  • achievementsOnOpen: the referenced achievement is fired when the player opens this door.
  • achievementsOnBreak: the referenced achievement is fired when the player breaks this door.

Player Effects Achievements

Player Effects achievements can be specified in the effects descriptors and can be attached to the following hooks:

  • achievementsOnActive: the referenced achievement is fired whenever the player effect is set to active.

Spawners Achievements

Spawners achievements can be specified in the spawners descriptors and can be attached to the following hooks:

  • achievementsOnComplete: the referenced achievement is fired whenever the player completes the farming of this spawner.

Days Survived Achievements

This is a special kind of achievements, since if you want to set a Days Survived achievements you just attach them to the game by using a special naming convention:

AchievementDaysSurvived190 

In this case we are defining a Days Survived type of achievement which will be triggered automatically when the user has survived for 190 days. So the naming convention:

AchievementDaysSurvivedxxx

Is the way to name the achievement to be triggered after “xxx” days.

Events Achievements

Events achievements are attached to Events that occur in game (like the punk concert). The syntax is similar to the previous ones:

  • achievementsOnEvent: the referenced achievement is fired whenever the player is present during the event.

Master Achievement

Another special kind of achievement is the Master Achievement, which is hardcoded in game and is automatically fired when the player has already fired all of the other achievements. Please note that in the Vanilla game the master achievement is the 50° and last achievement to fire. Should you add achievements to the game the master achievement will automatically fire when all other achievements are done, thus firing later if you added custom achievements to the game.

If you have problems or find errors in this guide please get in touch at info@tempi-duri.net.

You could leave a comment if you were logged in.
  • achievements_modding_reference.txt
  • Last modified: 2019/01/16 02:51
  • by thorfinio