# Configuration

### General

All configurable parameters are defined in the `{game}/x64/scripts/config/TheInsurgentsChainBenefitsConfig.lua` file.

This configuration file can be modified via any text editor.

### Layout

```lua
local function config(targetTypes, benefitTypes, particleEffects, statusEffects, augments)
  local chainLevels = {
    {--chain level 0
      {--benefit 0
        targetType, benefitType, benefitParameter, particleEffect, chance
      },
      ...
    },
    ...
  }

  return chainLevels
end

return config
```

### Parameters

The following lists all configurable parameters and their purposes:

#### `config`

A function that returns all configurable parameters.

It is called with the following arguments:

<table><thead><tr><th width="155.59991455078125">Name</th><th width="351.00006103515625">Description</th><th>Example</th></tr></thead><tbody><tr><td><code>targetTypes</code></td><td>A metatable that maps target type names to numeric identifiers and vice versa.</td><td><code>targetTypes.foe</code></td></tr><tr><td><code>benefitTypes</code></td><td>A metatable that maps benefit type names to numeric identifiers and vice versa.</td><td><code>benefitTypes.hp</code></td></tr><tr><td><code>particleEffects</code></td><td>A metatable that maps particle effect names to numeric identifiers and vice versa.</td><td><code>particleEffects.chainBenefit</code></td></tr><tr><td><code>statusEffects</code></td><td>A metatable that maps status effect names to numeric identifiers and vice versa.</td><td><code>statusEffects.ko</code></td></tr><tr><td><code>augments</code></td><td>A metatable that maps augment names to numeric identifiers and vice versa.</td><td><code>augments.essentials</code></td></tr></tbody></table>

For more information on how these arguments can be used, you can refer to the [Name vs Identifier](/the-insurgents-chain-benefits/overview/configuration/name-vs-identifier.md) page.

#### `benefits`

A table of benefits of all chain levels. Each chain level can have multiple benefits.

#### `targetType`

The type of the targets the benefit is applied to.

<table><thead><tr><th width="127.33333333333331">Identifier</th><th width="173">Name</th><th>Description</th></tr></thead><tbody><tr><td>0</td><td>Leader</td><td>Benefits only apply to the party leader.</td></tr><tr><td>1</td><td>Party</td><td>Benefits apply to all active party members.</td></tr><tr><td>2</td><td>Foe</td><td>Benefits apply to all nearby foes.</td></tr></tbody></table>

#### `benefitType`

The type of the benefit that is applied.

<table><thead><tr><th width="124.33333333333331">Identifier</th><th width="135">Name</th><th>Description</th></tr></thead><tbody><tr><td>0</td><td>HP</td><td>Restore x% of HP.</td></tr><tr><td>1</td><td>MP</td><td>Restore x% of MP.</td></tr><tr><td>2</td><td>Status Effect</td><td>Add status effect x.</td></tr><tr><td>3</td><td>Augment</td><td>Add augment x.</td></tr><tr><td>4</td><td>Level</td><td>Level up by x.</td></tr></tbody></table>

#### `benefitParameter`

The effect or efficiency of the benefit (0 -> 255).

For example: A benefit type of `4` and a benefit parameter of `3` would result in all nearby foes leveling up by 3 levels.

#### `particleEffect`

The particle effect that will be played when the benefit is applied.

#### `chance`

The chance of the benefit to apply.

### Notes

{% hint style="warning" %}
Parameters are processed top to bottom and anything past the sum of 100 of all benefit chances is ignored. For example:

* If there are 3 benefits with the following chances: 80%, 21%, 10%. The chance of the second one is actually 20%, not 21% and the third one is ignored.
* If there are 2 benefits with the following chances: 50%, 20%. There is a 30% chance that no benefit will be granted.
  {% endhint %}

{% hint style="warning" %}
The order of the benefit list determines to which chain level the benefits are tied. So even if some chain level have no benefits, there should still be an empty entry (`{}`) like in the default configuration.
{% endhint %}

{% hint style="info" %}

* Status effects and augments are temporarily applied with their default duration. The latter is defined in Battlepack -> Section 15 for status effects and Battlepack -> Section 58 for augments.
* Applying a status effect or an augment on a target that already has it, will refresh its duration. For status effects, this behavior can be modified in Battlepack -> Section 15 -> 1.Flags -> Is Refreshable.
* A status effect cannot be applied to a target with KO, Stone or X-Zone.
* A status effect cannot be applied to a target with conflicting status effects. For example, a target with Confuse cannot get Berserk. This behavior is defined in Battlepack -> Section 15 -> Absent Status Effects.
* Applying the augments Physical-Immunity, Magick-Immunity, or Status-Immunity to a target will show a combat log message. Once the timer runs out, another message will be shown.
* A level up is not possible for a party member if weak-mode is enabled.
* A level up pop-up is only shown for party members.
  {% endhint %}

{% hint style="info" %}
For a list of status effect and augment identifiers, you can view the inventory content spreadsheet in [Resources](/the-insurgents-chain-benefits/getting-started/resources.md).
{% endhint %}

{% hint style="info" %}
For a list of particle effect identifiers, you can view the particle effect spreadsheet in [Resources](/the-insurgents-chain-benefits/getting-started/resources.md). Be mindful as some of them last indefinitely until changing the location.
{% endhint %}

{% hint style="info" %}
Since this script also allows modifying existing chain benefits, the ones configured under *Battlepack -> Section 6* will be ignored to prevent having to maintain 2 differently structured configuration files.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://xeavin.gitbook.io/the-insurgents-chain-benefits/overview/configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
