Scopes

From Paradox Modding Cooperation
Jump to: navigation, search

Scopes select entities in order to check for conditions or apply commands.

Scopes always have a bracketed block on the right side:

<scope_name> = {
	#Stuff to execute in the scope.
}

But not all bracketed blocks are scopes: some are function blocks (option, trigger, mean_time_to_happen,...), operators (AND), flow control statements (if, limit), or clause for complex conditions or commands.

Scope-change types

There are different types of scope change operators.

  • Condition: Conditional scopes do return a Boolean value like other conditions
  • Command: Command scopes do execute commands on the new scope
  • Both: These operators can be used as both of the above.

Most of the general scope change operators have four different forms.

Name Description
all_<name> Conditional, all must meet the subconditions
any_<name> Conditional, at least one must meet the subconditions
every_<name> Command, executed on every subscope
random_<name> Command, executed on one random subscope

List of Scopes

Please be aware of the following:

If a scope has trigger set to , then you may test it against a condition.
If a scope has effect set to , then you may run a command on it.
Scope Description Example Trigger Effect From Scope To Scope Game Version
all_unit_leader Check if all unit leaders owned by the current country scope meet the trigger. all_unit_leader = { ... } X Country Unit Leader 1.5
any_unit_leader Check if any unit leader meets the trigger. any_unit_leader = { ... } X Country Unit Leader 1.5
all_army_leader Check if all army unit leaders owned by the current country scope meet the trigger all_unit_leader = { ... } X Country Unit Leader 1.5
any_army_leader Check if any army unit leader owned by the current country scope meets the trigger all_unit_leader = { ... } X Country Unit Leader 1.5
all_navy_leader Check if all navy unit leaders owned by the current country scope meet the trigger all_navy_leader = { ... } X Country Unit Leader 1.5
any_navy_leader Check if any navy unit leader owned by the current country scope meets the trigger. all_navy_leader = { ... } X Country Unit Leader 1.5
random_unit_leader Targets a random unit leader owned by the current country scope random_unit_leader = { ... } X Country Unit Leader 1.5
every_unit_leader Targets every unit leader owned by the current country scope scope every_unit_leader = { ... } X Country Unit Leader 1.5
random_army_leader Targets a random army unit leader owned by the current country scope random_army_leader = { ... } X Country Unit Leader 1.5
every_army_leader Targets every army unit leader owned by the current country scope every_army_leader = { ... } X Country Unit Leader 1.5
random_navy_leader Targets a random naval unit leader owned by the current country scope random_navy_leader = { ... } X Country Unit Leader 1.5
every_navy_leader Targets every naval unit leader owned by the current country scope every_navy_leader = { ... } X Country Unit Leader 1.5
global_every_army_leader Targets every army leader for every country in the world (Better to use every_army_leader if you know the country) global_every_army_leader = { ... } X Country Unit Leader 1.5
random_owned_controlled_state Targets a random owned and controlled state random_owned_controlled_state = { } Country State 1.3
OVERLORD Targets the overlord of a subject RAJ = { OVERLORD = { ... } } Country Country 1.3
state_id Targets a specific state 145 = { ... } Anywhere State 1.0
any_neighbor_country Targets any neighboring country any_neighbor_country = { ... } X Country Country 1.0
TAG Targets a specific country FRA = { ... } Anywhere Country 1.0
any_country Targets any country any_country = { ... } X Anywhere Country 1.0
any_home_area_neighbor_country Targets any country that shares a border with the current scope's home area any_home_area_neighbor_country = { ... } X Anywhere Country 1.0
any_other_country Targets any other country any_other_country = { ... } Anywhere Country 1.0
any_enemy_country Targets any enemy country any_enemy_country = { ... } X Country Country 1.0
all_neighbor_country Targets all neighboring countries all_neighbor_country = { ... } Country Country/ies 1.0
all_country Targets all countries all_country = { ... } Anywhere Country/ies 1.0
all_enemy_country Targets all enemy countries all_enemy_country = { ... } Country Country/ies 1.0
any_state Targets any state any_state = { ... } X Anywhere State 1.0
any_owned_state Targets any owned state any_owned_state = { ... } X Country State 1.0
any_neighbor_state Targets any neighboring state any_neighbor_state = { ... } X State State 1.0
any_allied_country Targets any allied country any_allied_country = { ... } X Country Country 1.0
all_state Targets all state all_state = { ... } Anywhere State/s 1.0
all_owned_state Targets all owned states all_owned_state = { ... } Country State/s 1.0
all_neighbor_state Targets all neighboring states all_neighbor_state = { ... } State State/s 1.0
all_allied_country Targets all allied countries all_allied_country = { ... } Country Country/ies 1.0
every_country Targets every country every_country = { ... } X Anywhere Country/ies 1.0
random_country Targets a random country random_country = { ... } X Anywhere Country 1.0
every_neighbor_country Targets every neighboring country every_neighbor_country = { ... } Country Country/ies 1.0
random_neighbor_country Targets a random neighboring country random_neighbor_country = { ... } X Country Country/ies 1.0
every_enemy_country Targets every enemy country every_enemy_country = { ... } Country Country/ies 1.0
random_enemy_country Targets a random enemy country random_enemy_country = { ... } X Country Country 1.0
random_state Targets a random state random_state = { ... } X Anywhere State 1.0
random_owned_state Targets a random owned state random_owned_state = { ... } X Country State 1.0
random_neighbor_state Targets a random neighboring state random_neighbor_state = { ... } X State State 1.0
every_state Targets every state every_state = { ... } X State State/s 1.0
every_owned_state Targets every owned state every_owned_state = { ... } X Country State/s 1.0
every_neighbor_state Targets every neighboring state every_neighbor_state = { ... } X State State/s 1.0
capital_scope Targets the capital capital_scope = { ... } Country State 1.0
owner scope Targets the owner of the state owner = { ... } X State Country 1.0
controller scope Targets the controller of the state controller = { ... } X State Country 1.0

NOTE: Some of these scopes may have no countries/states that match the criteria

Moving Between Scopes

There are a series of links to help you call effects or check triggers in other scopes. All these links can be used in effects or triggers, although not all commands and conditions seem to accept them, or as scopes themselves

Link Description Example
ROOT Targets the root country that this effect or trigger is in, regardless of what other scope this is
GER = {
    declare_war_on = {
        target = ROOT
        type = annex_everything
    }
}
THIS Targets the current scope
random_state = {
    add_resource = {
        type = oil
        amount = 50
        state = THIS
    }
}
PREV Targets the previous scope
random_country = {
    GER = {
        declare_war_on = {
            target = PREV
            type = annex_everything
        }
    }
}
FROM In decisions, this scopes to the target of a target trigger decision

In events, this scopes to the tag that sent you this event, if applicable (i.e. if Germany sends an event to Italy)

declare_war_on = {
    target = FROM
    type = annex_everything
}
FROM = {
    load_oob = defend_ourselves
}

FROM and PREV can be chained together to go back multiple scopes by adding more of them after each other after a . - e.g. FROM.FROM or PREV.PREV.PREV. In this example of chaining these links, two arms factories are built in two random states of a random country, and PREV.PREV is used to ensure the second state is not the same as the first state.

random_country = {
    random_owned_state = {
        add_extra_state_shared_building_slots = 2
        add_building_construction = {
            type = arms_factory
            level = 2
            instant_build = yes
        }
        PREV = {
            random_owned_state = {
                limit = { NOT = { state = PREV.PREV } } # The first PREV scopes back to the country, the second scopes back to the first random state
                add_extra_state_shared_building_slots = 2
                add_building_construction = {
                    type = arms_factory
                    level = 2
                    instant_build = yes
                }
            }
        }
    }
}

References

<references />

Template:Modding navbox