Skip to content

Custom Random Inventories

amione edited this page Oct 24, 2024 · 1 revision

Editing CustomRandomInventories.json in Darkwood

This guide will help you modify CustomRandomInventories.json to customize the loot and inventory of different characters or NPCs in the game.

Understanding CustomRandomInventories.json

The CustomRandomInventories.json file defines the randomized loot that can be found in the inventories of various characters or NPCs. Each entry specifies the items that can be found, along with their quantity ranges and probabilities.

Structure of the File

Each character or NPC has an associated entry, containing presets for their inventory. Each preset has a unique identifier (like "0"), which contains the items that can be included in their inventory.

Example format:

{
  "Wolfman_att": {
    "presets": {
      "0": {
        "toolbox": {
          "type": "toolbox",
          "amountMin": 0,
          "amountMax": 0,
          "chance": 1.0
        },
        ...
      }
    }
  },
  "NightTrader": {
    "presets": {
      "0": {
        "exp_nightMushroom": {
          "type": "exp_nightMushroom",
          "amountMin": 1,
          "amountMax": 1,
          "chance": 1.0
        },
        ...
      }
    }
  }
}

In this example:

  • The character Wolfman_att has a preset that includes various items such as toolbox, battery9v, bottle, etc., each with specific amounts and chances of appearing.
  • The character NightTrader has a different preset with its own set of items like exp_nightMushroom, gasoline, and nail.
  • Notice: Do not copy this as it is trimmed (...) to not have this page be half of the example.

Customizing Random Inventories

To add or modify random inventories:

  1. Identify the character you want to edit or create a new entry for.
  2. Copy an existing preset or create a new one under the character's presets.
  3. Change the item type to the item you want to include.
  4. Adjust the amountMin and amountMax to define the quantity range for the item.
  5. Set the chance to determine the likelihood of the item appearing in the inventory (0.0 to 1.0).

Example of Adding a New Item

To add a new item to Wolfman_att's inventory, you might include:

"new_item": {
  "type": "new_item",
  "amountMin": 1,
  "amountMax": 3,
  "chance": 0.5
}

In this example:

  • The item new_item will have a 50% chance of appearing in Wolfman_att’s inventory and can appear in quantities ranging from 1 to 3.

Tips:

  • Ensure that all item types you reference are defined in your game.
  • You can add multiple presets for different situations by using unique identifiers (like "1", "2", etc.)
    • I don't know the use for this and it wasn't tested, try at your own risk.
  • Keep the formatting consistent to avoid errors when the game loads the file.

Clone this wiki locally