Effects

Template:Version

Effects (also known as Commands) are used in order to affect the game dynamically from within a specific scope.

Effects are used throughout the game in numerous scopes, most commonly National Focuses, Events and Decisions.

See Variables for information on the variable effects.

Note that certain effects may take a value from a variable, i.e.

`add_manpower = var:my_var`.

This is noted by **<variable>** in an effect's parameters.

## Any Scope

Can be used in **country**, **state** or **unit leader** scopes.

## Country Scope

The effects here must be used within a **country** scope.

### Resources

`amount = <int>`The amount of resource to add.
`state = <id>`Which state to add the resource to.
```
add_resource = {
    type = oil
    amount = 50
    state = 88
}

```
 create\_import
`amount = <int>`The amount of resource to import.
`exporter = <id>`Which country exports the resource.
```
create_import = {
    resource = steel
    amount = 100
    exporter = GER
}

```

### Buildings

`level = <level> / <variable>`The maximum level to add.
```
add_offsite_building = { type = arms_factory level = 1 }

```
 modify\_building\_resources
`resource = <resource>`The resource to add.
`amount = <amount>`The amount of resource to add.
```
modify_building_resources = {
    building = synthetic_refinery
    resource = oil
    amount = 1
}

```

### National Focus

```
load_focus_tree = china_communist_focus
```
 unlock\_national\_focus
```
unlock_national_focus = my_focus
```
 complete\_national\_focus
```
complete_national_focus = my_focus
```

### Missions

```
activate_mission = my_mission
```
 activate\_mission\_tooltip
```
activate_mission_tooltip = my_mission
```
 remove\_mission
```
remove_mission = my_mission
```

### Air

```
air_experience = 10
```
 add\_ace
`surname = <string>`The surname of the ace.
`callsign = <string>`The callsign of the ace.
`type = <type>`The ace type.
`is_female = <bool>`The gender of the ace.
```
add_ace = {
    name = "Amelia"
    surname = "Earhart"
    callsign = "Revenant"
    type = fighter_genius
    is_female = yes
}

```

### AI

`id = <scope>`What country the strategy is against.
`value = <int>`The weighting added by the strategy.
```
add_ai_strategy = {
    type = alliance
    id = GER
    value = 200
}

```

## State Scope

The effects here must be used within a **state** scope.

## Unit Leader Scope

The effects here must be used within a **unit leader** scope.

## Flow Control

These scopes are used within effect scopes to control the execution of effects.

### If, Else If and Else

These scopes allow effects to be conditionalized, so they only occur when the requisite triggers are met.

For example, if you only have an effect to occur for Germany, you'd do the following:

```
if = {
    limit = {
        original_tag = GER
    }
    add_stability = 0.1
}

```

If you then wanted England to have a similar effect, and everyone else to have something else, you do the following:

```
if = {
    limit = {
        original_tag = GER
    }
    add_stability = 0.1
}
else_if = {
    limit = {
        original_tag = ENG
    }
    add_stability = 0.25
}
else = {
    add_stability = 0.05
}

```

As you can see, this allows for flexibility in how effects occur and cuts down on duplication.

### Hidden Effect

This scope hides the presence of the effects within it in the player's tooltip. This is used to execute effects without the player seeing them. For example, you may want to manipulate some variables in an event. Showing them to the player may confuse them, so it is best to hide the effects within an hidden effect scope, like so:

```
hidden_effect = {
    set_variable = { my_var = 100 }
}

```

### Random List

This scope allows the creation of a random selection of effects. For example, if you wanted an effect to randomly given the player one out of four bonuses, you'd do the following:

```
random_list = {
    25 = {
        add_stability = 0.5
    }
    25 = {
        add_manpower = 10000
    }
    25 = {
        add_war_support = 0.5
    }
    25 = {
        army_experience = 100
    }
}

```

Note that if you want to create a repeatable decision including a random list, by default the same decision will pick the same random result every time it is triggered in a game. You can reverse this behaviour by including the following line in the decision block:

```
fixed_random_seed = no

```

### Effect Tooltip

This scope will display the tooltip information of the effects within, without actually executing the effects. This is useful when you want to show what the effect may look like to the player. Here is an example:

```
effect_tooltip = {
    every_owned_state = {
        add_manpower = 10000
    }
}

```

Template:Modding navbox