Skip to main content

Achievements

Version History

Build VersionChange DateChange TypeDescription
6760422025-06-21stableCurrent version

Overview

The achievements.lua module defines all available achievements in Don't Starve Together and provides platform-specific identifiers for Steam and PlayStation Network integration. It contains a simple array of achievement definitions used by the game's achievement tracking system.

Usage Example

-- Access the achievements table
local achievements = require("achievements")

-- Iterate through all achievements
for i, achievement in ipairs(achievements) do
print("Achievement:", achievement.name)
print("Steam ID:", achievement.id.steam)
print("PSN ID:", achievement.id.psn)
end

-- Find specific achievement
local function FindAchievement(name)
for _, achievement in ipairs(Achievements) do
if achievement.name == name then
return achievement
end
end
return nil
end

Functions

ACHIEVEMENT(id, name)

Status: stable

Description: Helper function that creates an achievement definition with platform-specific identifiers.

Parameters:

  • id (string): Numeric ID as string, used for PSN trophy ID
  • name (string): Achievement code name used to reference the achievement

Returns:

  • (table): Achievement definition with name and platform IDs

Example:

local achievement = ACHIEVEMENT("1", "survive_20")
-- Returns: {
-- name = "survive_20",
-- id = {
-- steam = "1_survive_20",
-- psn = 1
-- }
-- }

Version History:

  • Current implementation in build 676042

Data Structures

Achievement Definition

{
name = "achievement_name", -- Code name for referencing
id = {
steam = "id_name", -- Steam achievement ID format
psn = number -- PlayStation Network trophy ID
}
}

Achievements Table

The module exports an array containing all 35 achievement definitions:

IndexIDNameSteam IDPSN ID
11survive_201_survive_201
22survive_352_survive_352
33survive_553_survive_553
44survive_704_survive_704
55build_researchlab5_build_researchlab5
66build_researchlab26_build_researchlab26
77build_researchlab37_build_researchlab37
88build_researchlab48_build_researchlab48
99wormhole_used9_wormhole_used9
1010pigking_trader10_pigking_trader10
1111growfrombutterfly11_growfrombutterfly11
1212honey_harvester12_honey_harvester12
1313sewing_kit13_sewing_kit13
1414pigman_posse14_pigman_posse14
1515rocky_posse15_rocky_posse15
1616hatch_tallbirdegg16_hatch_tallbirdegg16
1717pacify_forest17_pacify_forest17
1818cave_entrance_opened18_cave_entrance_opened18
1919survive_earthquake19_survive_earthquake19
2020tentacle_pillar_hole_used20_tentacle_pillar_hole_used20
2121snail_armour_set21_snail_armour_set21
2222join_game22_join_game22
2323host_for_days23_host_for_days23
2424hasrevivedplayer24_hasrevivedplayer24
2525helping_hand25_helping_hand25
2626party_time26_party_time26
2727equip_skin_clothing27_equip_skin_clothing27
2828trade_inn28_trade_inn28
2929deerclops_killed29_deerclops_killed29
3030spiderqueen_killed30_spiderqueen_killed30
3131minotaur_killed31_minotaur_killed31
3232moosegoose_killed32_moosegoose_killed32
3333bearger_killed33_bearger_killed33
3434dragonfly_killed34_dragonfly_killed34
3535domesticated_beefalo35_domesticated_beefalo35

Implementation Details

Platform ID Generation

  • Steam IDs: Generated as "id_name" format (e.g., "1_survive_20")
  • PSN IDs: Use the numeric ID directly as integer (e.g., 1)
  • Sequential Numbering: IDs run from 1 to 35 with no gaps

Module Structure

-- Local helper function
local function ACHIEVEMENT(id, name)
return {
name = name,
id = {
steam = tostring(id) .. "_" .. name,
psn = id
}
}
end

-- Global achievements table
Achievements = {
ACHIEVEMENT("1", "survive_20"),
ACHIEVEMENT("2", "survive_35"),
-- ... all 35 achievements
}

-- Module return
return Achievements

Access Patterns

-- Access by index
local first_achievement = Achievements[1] -- survive_20

-- Search by name
local function GetAchievementByName(target_name)
for _, achievement in ipairs(Achievements) do
if achievement.name == target_name then
return achievement
end
end
return nil
end

-- Get platform-specific ID
local function GetSteamID(achievement_name)
local achievement = GetAchievementByName(achievement_name)
return achievement and achievement.id.steam or nil
end

Adding New Achievements

To add a new achievement, append to the Achievements table:

Achievements = {
-- ... existing achievements ...
ACHIEVEMENT("36", "new_achievement_name"),
}

Requirements:

  • Use next sequential numeric ID
  • Use descriptive, lowercase name with underscores
  • Follow existing naming conventions