第11行: | 第11行: | ||
But not all bracketed blocks are scopes: some are function blocks (<code>option</code>, <code>trigger</code>, <code>mean_time_to_happen</code>,...), [[operator]]s (<code>AND</code>), flow control statements (<code>if</code>, <code>limit</code>), or clause for complex [[conditions]] or [[commands]]. | But not all bracketed blocks are scopes: some are function blocks (<code>option</code>, <code>trigger</code>, <code>mean_time_to_happen</code>,...), [[operator]]s (<code>AND</code>), flow control statements (<code>if</code>, <code>limit</code>), or clause for complex [[conditions]] or [[commands]]. | ||
=== Scope-change types === | ===Scope-change types=== | ||
There are different types of scope change operators. | 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 | *Condition: Conditional scopes do return a Boolean value like other conditions | ||
* Both: These operators can be used as both of the above. | *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. | Most of the general scope change operators have four different forms. | ||
第21行: | 第22行: | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
! Name !! Description | !Name!!Description | ||
|- | |- | ||
| all_<name> || Conditional, all must meet the subconditions | |all_<name>||Conditional, all must meet the subconditions | ||
|- | |- | ||
| any_<name> || Conditional, at least one must meet the subconditions | |any_<name>||Conditional, at least one must meet the subconditions | ||
|- | |- | ||
| every_<name> || Command, executed on every subscope | |every_<name>||Command, executed on every subscope | ||
|- | |- | ||
| random_<name> || Command, executed on one random subscope | |random_<name>||Command, executed on one random subscope | ||
|} | |} | ||
=== List of Scopes === | ===List of Scopes=== | ||
'''Please be aware of the following:''' | '''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 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. | :If a scope has effect set to '''✓''', then you may run a command on it. | ||
第40行: | 第42行: | ||
{| class="wikitable sortable" | {| class="wikitable sortable" | ||
|- | |- | ||
! Scope !! Description !! Example || Trigger || Effect || From Scope || To Scope || Game Version | !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 = { ... } || | |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||Check if any unit leader meets the trigger. | ||
|| any_unit_leader = { ... } || | ||any_unit_leader = { ... }||✓||X||Country||Unit Leader||1.5 | ||
|- | |- | ||
| all_army_leader || | |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 = { ... } || | |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 || | |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 || | |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 || | |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 || every_unit_leader = { ... } || X || | |every_unit_leader||Targets every unit leader owned by the current country 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 || | |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 || | |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 || | |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 || | |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 || | |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 | ||
|- | |- | ||
| OVERLORD || Targets the overlord of the current scope, if current scope is a subject || RAJ = { OVERLORD = { ... } } || | |OVERLORD||Targets the overlord of the current scope, if current scope is a subject||RAJ = { OVERLORD = { ... } }||✓||✓||Country||Country||1.3 | ||
|- | |- | ||
| TAG || Targets a specific country by tag || FRA = { ... } || | |TAG||Targets a specific country by tag||FRA = { ... }||✓||✓||Anywhere||Country||1.0 | ||
|- | |- | ||
| any_country || Targets any country in the world (including the current scope, see any_other_country) || any_country = { ... } || | |any_country||Targets any country in the world (including the current scope, see any_other_country)||any_country = { ... }||✓||X||Anywhere||Country||1.0 | ||
|- | |- | ||
| any_country_with_original_tag || Targets any country with current scope's original tag || any_country_with_original_tag = { ... } || | |any_country_with_original_tag||Targets any country with current scope's original tag||any_country_with_original_tag = { ... }||✓||X||Anywhere||Country||1.9 | ||
|- | |- | ||
| any_neighbor_country || Targets any neighboring country of the current scope | |any_neighbor_country||Targets any neighboring country of the current scope||any_neighbor_country = { ... }||✓||X||Country||Country||1.0 | ||
|- | |- | ||
| any_home_area_neighbor_country || Targets any country that shares a border with the current scope's home area (cored states) || any_home_area_neighbor_country = { ... } || | |any_home_area_neighbor_country||Targets any country that shares a border with the current scope's home area (cored states)||any_home_area_neighbor_country = { ... }||✓||X||Anywhere||Country||1.0 | ||
|- | |- | ||
| any_guaranteed_country || Targets any country with current scoped country guarantees || any_guaranteed_country = { ... } || | |any_guaranteed_country||Targets any country with current scoped country guarantees||any_guaranteed_country = { ... }||✓||X||Country||Country||1.9 | ||
|- | |- | ||
| any_allied_country || Targets any allied country of the current scope || any_allied_country = { ... } || | |any_allied_country||Targets any allied country of the current scope||any_allied_country = { ... }||✓||X||Country||Country||1.0 | ||
|- | |- | ||
| any_other_country || Targets any other country in the world (not including the current scope) || any_other_country = { ... } || | |any_other_country||Targets any other country in the world (not including the current scope)||any_other_country = { ... }||✓||X||Country||Country||1.0 | ||
|- | |- | ||
| any_enemy_country || Targets any enemy country of the current scope || any_enemy_country = { ... } || | |any_enemy_country||Targets any enemy country of the current scope||any_enemy_country = { ... }||✓||X||Country||Country||1.0 | ||
|- | |- | ||
| any_occupied_country || Targets any occupied country by the current scope || any_occupied_country = { ... } || | |any_occupied_country||Targets any occupied country by the current scope||any_occupied_country = { ... }||✓||X||Country||Country||1.9 | ||
|- | |- | ||
| all_neighbor_country || Targets all neighboring countries of the current scope || all_neighbor_country = { ... } || | |all_neighbor_country||Targets all neighboring countries of the current scope||all_neighbor_country = { ... }||✓||X||Country||Country/ies||1.0 | ||
|- | |- | ||
| all_country || Targets all countries in the world || all_country = { ... } || | |all_country||Targets all countries in the world||all_country = { ... }||✓||X||Anywhere||Country/ies||1.0 | ||
|- | |- | ||
| all_country_with_original_tag || Targets all country with current scope's original tag || all_country_with_original_tag = { ... } || | |all_country_with_original_tag||Targets all country with current scope's original tag||all_country_with_original_tag = { ... }||✓||X||Anywhere||Country/ies||1.9 | ||
|- | |- | ||
| all_allied_country || Targets all allied countries of the current scope || all_allied_country = { ... } || | |all_allied_country||Targets all allied countries of the current scope||all_allied_country = { ... }||✓||X||Country||Country/ies||1.9 | ||
|- | |- | ||
| all_guaranteed_country || Targets every country with current scoped country guarantees || all_guaranteed_country = { ... } || | |all_guaranteed_country||Targets every country with current scoped country guarantees||all_guaranteed_country = { ... }||✓||X||Country||Country/ies||1.9 | ||
|- | |- | ||
| all_enemy_country || Targets all enemy countries of the current scope || all_enemy_country = { ... } || | |all_enemy_country||Targets all enemy countries of the current scope||all_enemy_country = { ... }||✓||X||Country||Country/ies||1.0 | ||
|- | |- | ||
| all_occupied_country || Targets all occupied countries || all_occupied_country = { ... } || | |all_occupied_country||Targets all occupied countries||all_occupied_country = { ... }||✓||X||Country||Country/ies||1.9 | ||
|- | |- | ||
| state_id || Targets a specific state by id number || 145 = { ... } || | |state_id||Targets a specific state by id number||145 = { ... }||✓||✓||Anywhere||State||1.0 | ||
|- | |- | ||
| any_state || Targets any state in the world || any_state = { ... } || | |any_state||Targets any state in the world||any_state = { ... }||✓||X||Anywhere||State||1.0 | ||
|- | |- | ||
| any_controlled_state || Targets any of the states controlled by the scope country || any_controlled_state = { ... } || | |any_controlled_state||Targets any of the states controlled by the scope country||any_controlled_state = { ... }||✓||X||Country||State||1.9 | ||
|- | |- | ||
| any_owned_state || Targets any owned state of the current scope || any_owned_state = { ... } || | |any_owned_state||Targets any owned state of the current scope||any_owned_state = { ... }||✓||X||Country||State||1.0 | ||
|- | |- | ||
| any_neighbor_state || Targets any neighboring state of the current scope || any_neighbor_state = { ... } || | |any_neighbor_state||Targets any neighboring state of the current scope||any_neighbor_state = { ... }||✓||X||State||State||1.0 | ||
|- | |- | ||
| all_state || Targets all states in the world || all_state = { ... } || | |all_state||Targets all states in the world||all_state = { ... }||✓||X||Anywhere||State/s||1.0 | ||
|- | |- | ||
| all_owned_state || Targets all owned states of the current scope || all_owned_state = { ... } || | |all_owned_state||Targets all owned states of the current scope||all_owned_state = { ... }||✓||X||Country||State/s||1.0 | ||
|- | |- | ||
| all_neighbor_state || Targets all neighboring states of the current scope || all_neighbor_state = { ... } || | |all_neighbor_state||Targets all neighboring states of the current scope||all_neighbor_state = { ... }||✓||X||State||State/s||1.0 | ||
|- | |- | ||
| all_owned_state || Targets all owned states of the current scope || all_owned_state = { ... } || | |all_owned_state||Targets all owned states of the current scope||all_owned_state = { ... }||✓||X||Country||State/s||1.0 | ||
|- | |- | ||
| all_controlled_state || Targets all of the states controlled by the scope country || all_controlled_state = { ... } || | |all_controlled_state||Targets all of the states controlled by the scope country||all_controlled_state = { ... }||✓||X||Country||State/s||1.9 | ||
|- | |- | ||
| every_country || Targets every country in the world (including the current scope, see every_other_country) || every_country = { ... } || X || | |every_country||Targets every country in the world (including the current scope, see every_other_country)||every_country = { ... }||X||✓||Anywhere||Country/ies||1.0 | ||
|- | |- | ||
| every_country_with_original_tag || Targets every country with original tag || every_country_with_original_tag = { original_tag_to_check = TAG limit = { ... } ... } || X || | |every_country_with_original_tag||Targets every country with original tag||every_country_with_original_tag = { original_tag_to_check = TAG limit = { ... } ... }||X||✓||Anywhere||Country/ies||1.9 | ||
|- | |- | ||
| every_other_country || Targets every other country in the world (not including the current scope) || every_other_country = { ... } || X || | |every_other_country||Targets every other country in the world (not including the current scope)||every_other_country = { ... }||X||✓||Country||Country/ies||1.0 | ||
|- | |- | ||
| every_neighbor_country || Targets every neighboring country of the current scope || every_neighbor_country = { ... } || X || | |every_neighbor_country||Targets every neighboring country of the current scope||every_neighbor_country = { ... }||X||✓||Country||Country/ies||1.0 | ||
|- | |- | ||
| every_enemy_country || Targets every enemy country of the current scope || every_enemy_country = { ... } || X || | |every_enemy_country||Targets every enemy country of the current scope||every_enemy_country = { ... }||X||✓||Country||Country/ies||1.0 | ||
|- | |- | ||
| every_occupied_country || Targets every occupied country of the current scope || every_occupied_country = { ... } || X || | |every_occupied_country||Targets every occupied country of the current scope||every_occupied_country = { ... }||X||✓||Country||Country/ies||1.9 | ||
|- | |- | ||
| random_country || Targets a random country in the world (including the current scope) || random_country = { ... } || X || | |random_country||Targets a random country in the world (including the current scope)||random_country = { ... }||X||✓||Anywhere||Country||1.0 | ||
|- | |- | ||
| random_country_with_original_tag || Targets a random country with original tag || random_country_with_original_tag = { original_tag_to_check = TAG limit = {...} ... } || X || | |random_country_with_original_tag||Targets a random country with original tag||random_country_with_original_tag = { original_tag_to_check = TAG limit = {...} ... }||X||✓||Anywhere||Country||1.9 | ||
|- | |- | ||
| random_neighbor_country || Targets a random neighboring country of the current scope || random_neighbor_country = { ... } || X || | |random_neighbor_country||Targets a random neighboring country of the current scope||random_neighbor_country = { ... }||X||✓||Country||Country/ies||1.0 | ||
|- | |- | ||
| random_enemy_country || Targets a random enemy country of the current scope || random_enemy_country = { ... } || X || | |random_enemy_country||Targets a random enemy country of the current scope||random_enemy_country = { ... }||X||✓||Country||Country||1.0 | ||
|- | |- | ||
| random_occupied_country || Targets a random occupied country of the current scope || random_occupied_country = { ... } || X || | |random_occupied_country||Targets a random occupied country of the current scope||random_occupied_country = { ... }||X||✓||Country||Country||1.9 | ||
|- | |- | ||
| random_state || Targets a random state in the world || random_state = { ... } || X || | |random_state||Targets a random state in the world||random_state = { ... }||X||✓||Anywhere||State||1.0 | ||
|- | |- | ||
| random_owned_state || Targets a random owned state of the current scope || random_owned_state = { ... } || X || | |random_owned_state||Targets a random owned state of the current scope||random_owned_state = { ... }||X||✓||Country||State||1.0 | ||
|- | |- | ||
| random_controlled_state || Targets a random controlled state of the current scope || random_controlled_state = { prioritize = { <stateID> <stateID> } to pick those states first if they fulfill the limit ... } || X || | |random_controlled_state||Targets a random controlled state of the current scope||random_controlled_state = { prioritize = { <stateID> <stateID> } to pick those states first if they fulfill the limit ... }||X||✓||Country||State||1.9 | ||
|- | |- | ||
| random_owned_controlled_state || Targets a random owned and controlled state for the current scope || random_owned_controlled_state = { ... } || X || | |random_owned_controlled_state||Targets a random owned and controlled state for the current scope||random_owned_controlled_state = { ... }||X||✓||Country||State||1.3 | ||
|- | |- | ||
| random_neighbor_state || Targets a random neighboring state of the current scope || random_neighbor_state = { ... } || X || | |random_neighbor_state||Targets a random neighboring state of the current scope||random_neighbor_state = { ... }||X||✓||State||State||1.0 | ||
|- | |- | ||
| every_state || Targets every state in the world || every_state = { ... } || X || | |every_state||Targets every state in the world||every_state = { ... }||X||✓||State||State/s||1.0 | ||
|- | |- | ||
| every_controlled_state || Targets every controlled state of the current scope || every_controlled_state = { ... } || X || | |every_controlled_state||Targets every controlled state of the current scope||every_controlled_state = { ... }||X||✓||Country||State/s||1.9 | ||
|- | |- | ||
| every_owned_state || Targets every owned state of the current scope || every_owned_state = { ... } || X || | |every_owned_state||Targets every owned state of the current scope||every_owned_state = { ... }||X||✓||Country||State/s||1.0 | ||
|- | |- | ||
| every_neighbor_state || Targets every neighboring state of the current scope || every_neighbor_state = { ... } || X || | |every_neighbor_state||Targets every neighboring state of the current scope||every_neighbor_state = { ... }||X||✓||State||State/s||1.0 | ||
|- | |- | ||
| capital_scope || Targets the capital state of the current scope || capital_scope = { ... } || | |capital_scope||Targets the capital state of the current scope||capital_scope = { ... }||✓||✓||Country||State||1.0 | ||
|- | |- | ||
| owner scope || Targets the owner of a state || owner = { ... } || X || | |owner scope||Targets the owner of a state||owner = { ... }||X||✓||State||Country||1.0 | ||
|- | |- | ||
| controller scope || Targets the controller of a state || controller = { ... } || X || | |controller scope||Targets the controller of a state||controller = { ... }||X||✓||State||Country||1.0 | ||
|- | |- | ||
| all_operative_leader || Targets all operatives of the current scope || all_operative_leader = { ... } || | |all_operative_leader||Targets all operatives of the current scope||all_operative_leader = { ... }||✓||X||Country/Operation||Operatives||1.9 | ||
|- | |- | ||
| any_operative_leader || Targets any operative of the current scope || any_operative_leader = { ... } || | |any_operative_leader||Targets any operative of the current scope||any_operative_leader = { ... }||✓||X||Country/Operation||Operative||1.9 | ||
|- | |- | ||
| every_operative || Targets every operatives of the current scope || every_operative = { ... } || X || | |every_operative||Targets every operatives of the current scope||every_operative = { ... }||X||✓||Country/Operation||Operative||1.9 | ||
|- | |- | ||
| random_operative || Targets a random operative of the current scope || random_operative = { ... } || X || | |random_operative||Targets a random operative of the current scope||random_operative = { ... }||X||✓||Country/Operation||Operative||1.9 | ||
|} | |} | ||
'''NOTE:''' Some of these scopes may have no countries/states that match the criteria | '''NOTE:''' Some of these scopes may have no countries/states that match the criteria | ||
=== Scope limits === | ===Scope limits=== | ||
It is possible to use the <code>limit</code> block to narrow down scopes using specific conditions. Simply insert the <code>limit</code> block inside a scope (ex. every neighbor country), put in the desired conditions (ex. has more than 5 military factories) and after closing the limit block, put in the commands (ex. give military access) to affect the specified scopes. A short example is available here: | It is possible to use the <code>limit</code> block to narrow down scopes using specific conditions. Simply insert the <code>limit</code> block inside a scope (ex. every neighbor country), put in the desired conditions (ex. has more than 5 military factories) and after closing the limit block, put in the commands (ex. give military access) to affect the specified scopes. A short example is available here: | ||
第194行: | 第196行: | ||
</pre> | </pre> | ||
=== | === 作用域之间的移动=== | ||
有许多能够跨作用域执行效果或检查触发器的链接。所有的链接都可以用于效果或触发器,尽管不是所有指令和条件(即效果和触发器)都接受它们,或者是作用域本身。 | |||
{| class="wikitable sortable" | {| class="wikitable sortable" | ||
|- | |- | ||
! | ! 链接!! 描述!! 样例 | ||
|- | |- | ||
| ROOT | |ROOT | ||
| | | 定位这个效果或触发器所在的根(脚本进入的第一个作用域)国家,无视其它任何作用域。 | ||
| <pre> | |<pre> | ||
ENG = { | ENG = { | ||
FRA = { | FRA = { | ||
第217行: | 第219行: | ||
</pre> | </pre> | ||
|- | |- | ||
| THIS | |THIS | ||
| | | 定位当前作用域。 | ||
| <pre> | |<pre> | ||
random_state = { | random_state = { | ||
add_resource = { | add_resource = { | ||
第229行: | 第231行: | ||
</pre> | </pre> | ||
|- | |- | ||
| PREV | |PREV | ||
| | | 定位上一个作用域。 | ||
| <pre> | |<pre> | ||
FRA = { | FRA = { | ||
random_country = { | random_country = { | ||
第245行: | 第247行: | ||
</pre> | </pre> | ||
|- | |- | ||
| FROM | |FROM | ||
| | |'''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) | In '''events''', this scopes to the tag that sent you this event, if applicable (i.e. if Germany sends an event to Italy) | ||
| <pre> | |<pre> | ||
declare_war_on = { | declare_war_on = { | ||
target = FROM | target = FROM |
2020年9月4日 (五) 11:20的版本
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 | 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 |
OVERLORD | Targets the overlord of the current scope, if current scope is a subject | RAJ = { OVERLORD = { ... } } | ✓ | ✓ | Country | Country | 1.3 |
TAG | Targets a specific country by tag | FRA = { ... } | ✓ | ✓ | Anywhere | Country | 1.0 |
any_country | Targets any country in the world (including the current scope, see any_other_country) | any_country = { ... } | ✓ | X | Anywhere | Country | 1.0 |
any_country_with_original_tag | Targets any country with current scope's original tag | any_country_with_original_tag = { ... } | ✓ | X | Anywhere | Country | 1.9 |
any_neighbor_country | Targets any neighboring country of the current scope | any_neighbor_country = { ... } | ✓ | X | Country | Country | 1.0 |
any_home_area_neighbor_country | Targets any country that shares a border with the current scope's home area (cored states) | any_home_area_neighbor_country = { ... } | ✓ | X | Anywhere | Country | 1.0 |
any_guaranteed_country | Targets any country with current scoped country guarantees | any_guaranteed_country = { ... } | ✓ | X | Country | Country | 1.9 |
any_allied_country | Targets any allied country of the current scope | any_allied_country = { ... } | ✓ | X | Country | Country | 1.0 |
any_other_country | Targets any other country in the world (not including the current scope) | any_other_country = { ... } | ✓ | X | Country | Country | 1.0 |
any_enemy_country | Targets any enemy country of the current scope | any_enemy_country = { ... } | ✓ | X | Country | Country | 1.0 |
any_occupied_country | Targets any occupied country by the current scope | any_occupied_country = { ... } | ✓ | X | Country | Country | 1.9 |
all_neighbor_country | Targets all neighboring countries of the current scope | all_neighbor_country = { ... } | ✓ | X | Country | Country/ies | 1.0 |
all_country | Targets all countries in the world | all_country = { ... } | ✓ | X | Anywhere | Country/ies | 1.0 |
all_country_with_original_tag | Targets all country with current scope's original tag | all_country_with_original_tag = { ... } | ✓ | X | Anywhere | Country/ies | 1.9 |
all_allied_country | Targets all allied countries of the current scope | all_allied_country = { ... } | ✓ | X | Country | Country/ies | 1.9 |
all_guaranteed_country | Targets every country with current scoped country guarantees | all_guaranteed_country = { ... } | ✓ | X | Country | Country/ies | 1.9 |
all_enemy_country | Targets all enemy countries of the current scope | all_enemy_country = { ... } | ✓ | X | Country | Country/ies | 1.0 |
all_occupied_country | Targets all occupied countries | all_occupied_country = { ... } | ✓ | X | Country | Country/ies | 1.9 |
state_id | Targets a specific state by id number | 145 = { ... } | ✓ | ✓ | Anywhere | State | 1.0 |
any_state | Targets any state in the world | any_state = { ... } | ✓ | X | Anywhere | State | 1.0 |
any_controlled_state | Targets any of the states controlled by the scope country | any_controlled_state = { ... } | ✓ | X | Country | State | 1.9 |
any_owned_state | Targets any owned state of the current scope | any_owned_state = { ... } | ✓ | X | Country | State | 1.0 |
any_neighbor_state | Targets any neighboring state of the current scope | any_neighbor_state = { ... } | ✓ | X | State | State | 1.0 |
all_state | Targets all states in the world | all_state = { ... } | ✓ | X | Anywhere | State/s | 1.0 |
all_owned_state | Targets all owned states of the current scope | all_owned_state = { ... } | ✓ | X | Country | State/s | 1.0 |
all_neighbor_state | Targets all neighboring states of the current scope | all_neighbor_state = { ... } | ✓ | X | State | State/s | 1.0 |
all_owned_state | Targets all owned states of the current scope | all_owned_state = { ... } | ✓ | X | Country | State/s | 1.0 |
all_controlled_state | Targets all of the states controlled by the scope country | all_controlled_state = { ... } | ✓ | X | Country | State/s | 1.9 |
every_country | Targets every country in the world (including the current scope, see every_other_country) | every_country = { ... } | X | ✓ | Anywhere | Country/ies | 1.0 |
every_country_with_original_tag | Targets every country with original tag | every_country_with_original_tag = { original_tag_to_check = TAG limit = { ... } ... } | X | ✓ | Anywhere | Country/ies | 1.9 |
every_other_country | Targets every other country in the world (not including the current scope) | every_other_country = { ... } | X | ✓ | Country | Country/ies | 1.0 |
every_neighbor_country | Targets every neighboring country of the current scope | every_neighbor_country = { ... } | X | ✓ | Country | Country/ies | 1.0 |
every_enemy_country | Targets every enemy country of the current scope | every_enemy_country = { ... } | X | ✓ | Country | Country/ies | 1.0 |
every_occupied_country | Targets every occupied country of the current scope | every_occupied_country = { ... } | X | ✓ | Country | Country/ies | 1.9 |
random_country | Targets a random country in the world (including the current scope) | random_country = { ... } | X | ✓ | Anywhere | Country | 1.0 |
random_country_with_original_tag | Targets a random country with original tag | random_country_with_original_tag = { original_tag_to_check = TAG limit = {...} ... } | X | ✓ | Anywhere | Country | 1.9 |
random_neighbor_country | Targets a random neighboring country of the current scope | random_neighbor_country = { ... } | X | ✓ | Country | Country/ies | 1.0 |
random_enemy_country | Targets a random enemy country of the current scope | random_enemy_country = { ... } | X | ✓ | Country | Country | 1.0 |
random_occupied_country | Targets a random occupied country of the current scope | random_occupied_country = { ... } | X | ✓ | Country | Country | 1.9 |
random_state | Targets a random state in the world | random_state = { ... } | X | ✓ | Anywhere | State | 1.0 |
random_owned_state | Targets a random owned state of the current scope | random_owned_state = { ... } | X | ✓ | Country | State | 1.0 |
random_controlled_state | Targets a random controlled state of the current scope | random_controlled_state = { prioritize = { <stateID> <stateID> } to pick those states first if they fulfill the limit ... } | X | ✓ | Country | State | 1.9 |
random_owned_controlled_state | Targets a random owned and controlled state for the current scope | random_owned_controlled_state = { ... } | X | ✓ | Country | State | 1.3 |
random_neighbor_state | Targets a random neighboring state of the current scope | random_neighbor_state = { ... } | X | ✓ | State | State | 1.0 |
every_state | Targets every state in the world | every_state = { ... } | X | ✓ | State | State/s | 1.0 |
every_controlled_state | Targets every controlled state of the current scope | every_controlled_state = { ... } | X | ✓ | Country | State/s | 1.9 |
every_owned_state | Targets every owned state of the current scope | every_owned_state = { ... } | X | ✓ | Country | State/s | 1.0 |
every_neighbor_state | Targets every neighboring state of the current scope | every_neighbor_state = { ... } | X | ✓ | State | State/s | 1.0 |
capital_scope | Targets the capital state of the current scope | capital_scope = { ... } | ✓ | ✓ | Country | State | 1.0 |
owner scope | Targets the owner of a state | owner = { ... } | X | ✓ | State | Country | 1.0 |
controller scope | Targets the controller of a state | controller = { ... } | X | ✓ | State | Country | 1.0 |
all_operative_leader | Targets all operatives of the current scope | all_operative_leader = { ... } | ✓ | X | Country/Operation | Operatives | 1.9 |
any_operative_leader | Targets any operative of the current scope | any_operative_leader = { ... } | ✓ | X | Country/Operation | Operative | 1.9 |
every_operative | Targets every operatives of the current scope | every_operative = { ... } | X | ✓ | Country/Operation | Operative | 1.9 |
random_operative | Targets a random operative of the current scope | random_operative = { ... } | X | ✓ | Country/Operation | Operative | 1.9 |
NOTE: Some of these scopes may have no countries/states that match the criteria
Scope limits
It is possible to use the limit
block to narrow down scopes using specific conditions. Simply insert the limit
block inside a scope (ex. every neighbor country), put in the desired conditions (ex. has more than 5 military factories) and after closing the limit block, put in the commands (ex. give military access) to affect the specified scopes. A short example is available here:
every_neighbor_country = { # Targets every neighbor country limit = { num_of_military_factories > 5 # Limit the scope to neighbor countries with more than 5 military factories } give_military_access = ROOT # Give military access to neighbor countries with more than 5 military factories }
作用域之间的移动
有许多能够跨作用域执行效果或检查触发器的链接。所有的链接都可以用于效果或触发器,尽管不是所有指令和条件(即效果和触发器)都接受它们,或者是作用域本身。
链接 | 描述 | 样例 |
---|---|---|
ROOT | 定位这个效果或触发器所在的根(脚本进入的第一个作用域)国家,无视其它任何作用域。 | ENG = { FRA = { GER = { declare_war_on = { target = ROOT type = annex_everything } } } } # Germany declares war on Britain (assuming there is no scope before ENG = { ) |
THIS | 定位当前作用域。 | random_state = { add_resource = { type = oil amount = 50 state = THIS } }#The resource is added to random_state |
PREV | 定位上一个作用域。 | FRA = { random_country = { GER = { declare_war_on = { target = PREV type = annex_everything } } } } #Germany declares war on random_country |
FROM | 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 = { #1st scope [1] random_owned_state = { # 2nd scope [1,2] add_extra_state_shared_building_slots = 2 add_building_construction = { type = arms_factory level = 2 instant_build = yes } PREV = { #from random_owned_state(#2nd) to random_country(#1st). [1,2,1] random_owned_state = { #new second scope [1,2_old,1,2_new] limit = { NOT = { state = PREV.PREV } } # The first PREV scopes back to the country, the second scopes back to the first random state <Value:1,2_old,̶1̶,̶̶̶2̶̶̶_̶̶̶n̶̶̶e̶̶̶w> add_extra_state_shared_building_slots = 2 #Note: We used PREV.PREV to get a value, but didn't actually enter that scope. [1,2_old,1,2_new] add_building_construction = { type = arms_factory level = 2 instant_build = yes } } } } }
References
文件 | 效果 • 条件 • 定义 • 修正 • 修正列表 • 作用域 • 本地化 • on action • 数据结构 (标记, 临时标记, 国家别名, 变量, 数组) |
脚本 | 成就修改 • AI修改 • AI focuses • 自治领修改 • 权力平衡修改 • 剧本/标签 (游戏规则)• 建筑修改 • 人物修改 • 修饰性TAG修改 • 国家创建 • 军队修改 • 决议制作 • 装备修改 • 事件修改 • Idea修改 • 意识形态修改 • 军工商修改 • 国策制作 • 资源修改 • Scripted GUI • 科技制作 • 单位修改 |
地图 | 地图 • 省份 • 补给区域 • 战略区域 |
图形图像 | 界面 • 图形资产 • 实体模型 • 后期特效 • 离子效果 • 字体 |
装饰性 | 肖像 • 命名列表 • 音乐 • 音效 |
其他 | 控制台指令 • 故障排除 • 模组结构 • 成就代码分析 • Mod相关 • Nudger修改 |