Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Kingdoms of the Damned

An adult text-based medieval fantasy sandbox. Wander a living world, make your mark, and answer to no crown. Β· By EroBunny Studio

Modding Kingdoms of the Damned Sticky

A topic by EroBunny Studio created 15 days ago Views: 183
Viewing posts 1 to 1

Mods let you add or change almost anything in the game: items, people, places, quests, events, dialogue, races, status effects, world generation, pictures and more. Most mods are just text files. You don't need to program, and a data mod can't break the game's code.

New to this? Read Install a mod and Your first mod. Everything after that is a reference you can come back to.

πŸ“₯ Install a mod

  1. In the main menu choose Mods, then Open mods folder.
  2. Copy the mod's folder in (for example mods/moonlight_peddler/), or drop its .zip file in as it is. The files can be at the top of the zip or inside one folder.
  3. Restart the game. The Mods page lists the mod and lets you switch it off.
  4. Press Check for problems to see broken references (for example a person placed in a room that doesn't exist).

Mods are also found in a mods folder next to the game's executable. Saves remember which mods were on and warn you if some are missing when you load.

⚠️ Mods with scripts can do more, but they are real programs. They do nothing until you open the Mods page and press Allow scripts, after a warning. Only allow scripts from people you trust.

πŸ› οΈ Your first mod

A mod is a folder:

my_mod/
  mod.json            name, id, author
  data/
    items.json        the same format as the game's data/items.json
    npcs.json
    dialogues.json
    ...
  imagepacks/         optional: pictures (works like a normal image pack)

1. mod.json

{ "id": "my_mod", "name": "My Mod", "version": "1.0", "author": "You",
  "description": "What it does.", "priority": 0 }

id must be unique. Mods load by priority (low first), then by id. Later mods win.

2. data/items.json: a new item

[
  {
    "id": "my_mod_tonic",
    "name": "Traveler's Tonic",
    "type": "consumable",
    "description": "Tastes of mint and bad decisions.",
    "value": 25,
    "use": { "text": "You drink the tonic.", "heal": 40, "stamina": 20 }
  }
]

3. Restart the game and use the console (press ` or F2) to try it: give my_mod_tonic 3.

That's a mod. Copy the example mods in the game's mods_example folder to see bigger ones.

πŸ—‚οΈ Which files can a mod have?

Any of the game's list files, with the same name and format as in the game's data/ folder:

items, npcs, dialogues, locations, zones, regions, races, names, archetypes, quests, classes, skills, social, codex, properties, furniture, events, crops, gathering, theft, family

Also: hooks, conditions, effects, status_effects, personalities, strings, placements, laws, audio and more.

Big mods can split a file into a folder: data/items/swords.json and data/items/potions.json are both read as items.

Some files are objects instead of lists (worldgen.json, dungeons.json, guild.json, economy.json, calendar.json, character.json). They are merged key by key.

πŸ”€ How entries combine

Every entry has an "id":

You writeResult
a new idthe entry is added
an id that already existsyour entry replaces the old one completely
"_patch": trueyour keys are merged into the old entry; keys you leave out stay
"_remove": truethe entry is deleted

Inside a patch (and in object files): objects merge key by key, and a key starting with + adds to a list instead of replacing it.

[
  { "id": "bread_loaf", "_patch": true, "value": 4 },
  { "id": "east_lane", "_patch": true,
    "+exits": [ { "to": "my_room", "label": "Visit my room", "minutes": 2 } ] }
]

This makes bread cost 4 and adds a door to an existing room.

⚑ Make things happen without scripts

Hooks

data/hooks.json runs something when an event occurs:

[{ "id": "my_mod_chime", "trigger": "enter_room", "room": "east_lane", "once": true,
   "text": "A faint chime drifts down the lane.", "give_gold": 5, "set_flag": "heard_chime" }]
  • Triggers: new_day, enter_room, talk, combat_end, sleep, level_up, purchase
  • Filters: room, room_type, npc, chance (0 to 1), once, every_days, plus the usual requires_flag, requires_item, requires_property …
  • Effects: text, give_gold, give_item (+give_count), set_flag, clear_flag

Your own conditions and effects

Name a test in conditions.json and an outcome in effects.json, then use them by name.

// conditions.json
[{ "id": "my_rich", "gold_min": 100 }, { "id": "my_night", "period": "night", "level_min": 2 }]
// effects.json
[{ "id": "my_blessing", "heal": "full", "give_gold": 3, "text": "Warm light settles over you." }]
  • Condition keys: gold_min, level_min/max, day_min/max, period, location, location_type, has_item, no_item, flag, no_flag, any: [ids], not: id
  • Effect keys: give_gold, give_item, take_item, set_flag, clear_flag, heal, stamina, xp, learn, advance_minutes, text
  • Use them on a dialogue choice or room action: "requires_custom": "my_rich", "hide_if_custom": "...", "effect": "my_blessing"

πŸ’¬ Dialogue, people and events

Dialogue is a list of nodes. Each has text (one string, or a list of variants picked at random) and choices.

{ "id": "my_mod_greeting",
  "text": [ "{name} grins. β€œBack again?”", "{name} looks up. β€œAh, it's you.”" ],
  "choices": [
    { "label": "Buy a tonic (25g)", "give_gold": -25, "give_item": "my_mod_tonic", "goto": "my_mod_greeting" },
    { "label": "Leave", "goto": "" } ] }

Useful keys on a choice: goto, requires_flag, hide_if_flag, requires_item, requires_gender, requires_bond, requires_romance, requires_status, requires_attraction, give_gold, give_item, take_item, set_flag, bond, romance, apply_status, act (runs a social act with the person) and more. Text tokens include {name}, {npc_he}, {npc_him}, {npc_his}, {player}, and {img:key} shows a picture.

Shops are an NPC plus dialogue nodes: a negative give_gold with a give_item is a purchase and gets the Buy Γ—1/Γ—5/Γ—10/Max buttons automatically.

People's ties: in npcs.json an entry can list "ties": [{"with": "marda", "kind": "friends", "closeness": 60}] (friends, dating, partner, married, ex).

Random events are in events.json. Each starts a dialogue node:

{ "id": "my_mod_traveler", "node": "my_mod_traveler_node", "triggers": ["enter"],
  "where": { "types": ["road", "forest"] }, "time": ["day", "dusk"],
  "cast": { "type": "spawn", "archetype": "traveler" }, "weight": 1.0, "cooldown_days": 4 }
  • triggers: enter (arriving in a room), rest (after sleeping), linger
  • cast: narrator (nobody), npc (a particular person), present (someone who is here), spawn (a stranger who turns up and leaves afterwards). present with "companion": "resident", "anywhere": true picks someone who lives in your home.
  • Other keys: where, time, weight, once, cooldown_days, min_day, min_level, filter (a content filter id: the event never happens if the player blocked it), always (skip the random chance) and any condition a dialogue choice can use.

πŸ†• Body conditions (mod API 2)

Choices, text variants and events can ask about the body of the person they are about with requires_npc and hide_if_npc (one tag, or a list: any of them is enough):

male, female, futa, penis, breasts, lactating (producing milk right now), cum (has a penis, and the Fluids filter is off)

Put "api": 2 in your mod.json when you use them. Older versions of the game hold the mod back with a message.

πŸ’‘ See a complete example: the Buy Me a Coffee mod uses a rest event, a dialogue with body conditions, status effects, and its own picture pack. It is in the game's mods_example folder.

πŸ§ͺ Status effects and potions

status_effects.json lists conditions. kind is "buff" or "debuff".

{ "id": "my_mod_glow", "name": "Glowing", "kind": "buff", "minutes": 240, "color": "ffe9a8", "icon": "sun",
  "stats": { "attack": 2, "max_health": 10 }, "combat": { "dodge": 0.05, "crit": 0.03 },
  "regen": 1, "tick_minutes": 30,
  "description": "You shine faintly.", "gain": "A soft light surrounds you.", "end": "The glow fades." }
  • stats can hold attack, defense, magic, max_health (and strength, agility, will, wits). combat can hold miss, dodge, crit, flee, skip.
  • damage / regen happen every tick_minutes. Time is in minutes (1440 = a day).
  • Give or remove effects: on an item's use ("apply": "my_mod_glow", "cure": ["poisoned"]), on a dialogue choice ("apply_status", "cure_status"), or from a race or archetype with "inflicts": {"poisoned": 0.25}.
  • Body potions: "use": { "body": { "penis_cm": 3 } }, "breast_step": -1, "height_cm": 5, "gender": "female".

🌍 Generated worlds

Sandbox worlds are generated, so your hand-made rooms need a way in:

  • placements.json carries your rooms into generated worlds and puts a door on a settlement:
[{ "id": "my_mod_place", "entry": "my_room", "rooms": ["my_room", "my_back_room"],
   "where": { "culture": ["human"], "category": ["settlement"] },
   "label": "Visit my shop", "back_label": "Back outside",
   "modes": ["sandbox"], "chance": 1.0 }]
  • worldgen.json: add buildings, shops, templates, names and pools, and generated worlds use them (new worlds only).
World modeYour hand-made rooms
Sandboxnot there, unless you use placements.json
Story / Handmadethere

🎨 Pictures in a mod

Put an image pack in your mod: imagepacks/<pack name>/…. It works exactly like a normal pack (see the Image Packs guide). For event or dialogue pictures use events/<group>/ev_<node>.webp, with looks added as +gender_female and so on.

πŸ’» Scripts (when data isn't enough)

A script starts with extends ModScript and overrides what it needs:

extends ModScript

func on_new_day(_day: int) -> void:
	api.give_gold(1)
	api.notify("A coin appears on your windowsill.")

func room_actions(room_id: String) -> Array:
	if api.location_type(room_id) != "square":
		return []
	return [{"label": "Toss a coin", "callback": _toss}]

func _toss() -> void:
	api.notify("Plink.")

Hooks you can override: on_game_start, on_new_day(day), on_enter_room(room_id), on_talk(npc_id), on_item_added, on_combat_start, on_combat_end, on_purchase, on_sleep, on_level_up, on_save, room_actions(room_id)

api offers: notify, gold, give_gold, give_item, take_item, item_count, add_xp, heal, run_effect, condition, option, show_page, day, hour, period, advance_time, location, npcs_in, flag, set_flag, get_data / set_data (saved with the game), chance, random_int

πŸ”’ Scripts are real programs. Players have to approve them, and the Mods page scans them for risky words. Only use a script when data can't do the job, and never put anything in one that you wouldn't want to be responsible for.

βš™οΈ Options, translations and the console

Mod options appear on the Mods page. Types: bool, int, float, choice.

"options": [{ "id": "bonus_gold", "label": "Daily bonus", "type": "int", "min": 0, "max": 20, "default": 2 }]

Scripts read them with api.option("bonus_gold", 2).

Translations and text changes: strings.json maps text to replacement text: { "Town Square": "Platz" }.

Requirements and load order in mod.json:

{ "requires": ["other_mod"], "conflicts": ["bad_mod"], "load_after": ["some_mod"], "api": 1 }

Developer console: press ` or F2 in a game. help lists the commands: gold 500, give healing_potion 5, tp arcana_shop, effect poisoned, time 22:00, modcheck …

βœ… Tips

  • Prefix your ids with your mod id (my_mod_dagger) so mods don't collide.
  • New rooms need a zone and a grid position that no other room in that zone uses. A new zone goes in zones.json.
  • A broken file is skipped and listed on the Mods page. It never crashes the game. Check for problems shows the mod, file and entry, and suggests "did you mean…" for typos.
  • Data changes need a restart. Scripts are reloaded each time a game starts.
  • Copy a mod from mods_example and change it, it's the fastest way to learn.

Happy modding! If you make something, share it with the rest of us. 🧩