Wiki

effect · raid_add_unit_experience

Definition

  • Supported scope:RAID_INSTANCE
  • Supported target:THIS, ROOT, PREV, FROM, OWNER, CONTROLLER, OCCUPIED, CAPITAL

Description

Give experience to the units performing the raid (raid instance scope).

Will give experience to any type of unit assigned to the raid, e.g. divisions or air wings.
The value defines the progress towards the max level, e.g. 0.2 = gain 20% of the experience needed to reach max level.

Can use either an explicit value or a variable

ex.
raid_add_unit_experience = 0.2

Hands-On Notes

Hands-on notes are AI-generated and checked against the vanilla command vocabulary — treat them as a starting point, not authoritative reference. The definition above is the game's own documentation.

Hands-On Usage

In custom Raid gameplay mods, when a raid mission reaches specific milestones (such as successfully destroying targets or completing designated rounds), use this effect to reward participating units with experience, creating a positive feedback loop of "better performance leads to faster unit growth". Note that experience is expressed as a "ratio of total experience required to reach max level", allowing flexible adjustment of reward magnitude based on difficulty tiers.

# Reward participating units with experience upon raid mission settlement
RAID_INSTANCE = {
    # Grant different rewards based on whether excellent rating is achieved
    if = {
        limit = {
            hidden_trigger = { ... }   # Check raid completion conditions
        }
        raid_add_unit_experience = 0.3  # Reward 30% progress experience
    }
    else = {
        raid_add_unit_experience = 0.1  # Base reward 10% progress
    }
}

Synergy

  • [add_raid_history_entry](/wiki/effect/add_raid_history_entry): Records a raid history log entry while granting experience, making it easy to track "why experience was gained". Both effects commonly appear together in the same settlement block.
  • [raid_damage_units](/wiki/effect/raid_damage_units): Raids typically involve casualties. First use this command to inflict damage on participating units, then use experience rewards as compensation for "paying a price for growth", logically forming a complete combat settlement loop.
  • [hidden_trigger](/wiki/trigger/hidden_trigger): Used for implicit condition checks before awarding experience (such as whether the raid succeeded or met minimum participation rounds), preventing unconditional experience distribution that breaks balance.
  • [meta_trigger](/wiki/trigger/meta_trigger): When dynamic parameter passing is needed (such as determining reward ratios based on raid level variables), combine with meta_trigger to construct parameterized condition judgments, making experience rewards more flexible.

Common Pitfalls

  1. Calling directly under country/state scope: This effect only works within RAID_INSTANCE scope. If mistakenly written under country or state scope, the script silently fails without error reporting. Ensure the call chain has entered the raid instance scope.
  2. Misinterpreting the value as absolute experience amount: The input value represents "the ratio of experience required to reach max level" rather than a fixed amount. Setting 1.0 means directly reaching max level—beginners often input the same magnitude as regular add_experience, causing all participating units to instantly max level.