Arrays in general are containers that store elements (data). In Hearts of Iron IV it is possible to store numerical data and scope data within arrays.
Arrays are used via effects and can be checked with triggers. There are special effects that allow you to iterate through an array to then apply other effects to or with the data within.
Effects
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.9。 |
add_to_array
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.9。 |
add_to_array = { array = <name> value = <value> index = <index> }
An array is created once an element has been added to it.
The name of the array is what you use to refer to the array in other effects and triggers.
The value is the data you are adding to the array. It can be a number (i.e. 1 or var:my_num) or a scope (i.e. GER or var:my_scope). This is optional, if not included the current scope is added as the value.
The index refers the where the value should be inserted into the array. By default data is added to the end of the array, otherwise the data is shifted to accommodate the new value.
A short form can be used: add_to_array = { <name> = <value> }
remove_from_array
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.9。 |
remove_from_array = { array = <name> value = <value> index = <index> }
The name of the array is the array you want to remove the data from.
The value is the value you want to remove from the array (if present).
The index is the index of the value you want to remove from the array (if present).
If neither the value or index attributes are defined, the last element will be deleted.
A short form can be used: remove_from_array = { <name> = <value> }
clear_array
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.9。 |
clear_array = <name>
Clears all data from the specified array.
resize_array
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.9。 |
resize_array = { array = <name> value = <value> size = <int> }
Resizes the specified array.
The value attribute sets any empty elements to the specified value if expanding the array. Defaults to 0 if not specified.
The size attribute specifies the new size of the array, removing elements if shrinking the array, or adding new elements with the specified value if expanding it.
A short form can be used: resize_array = { <name> = <size> }
while_loop_effect
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.9。 |
while_loop_effect = { break = <string> limit = { <triggers> } <effects> }
Runs the effect as long as a trigger is true.
The break attribute specifies a temp variable that can be set to non-0 to break the loop, ending iteration. By default this is break
.
Effects can be used within the loop to perform operations with the data within an array.
for_each_loop
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.9。 |
for_each_loop = { array = <name> value = <string> index = <string> break = <string> <effects> }
Runs a loop for each element of the specified array.
The value attribute specifies a temp variable that stores the current value whilst iterating over the loop. By default this is v
.
The index attribute specifies a temp variable that stores the current index whilst iterating over the loop. By default this is i
.
The break attribute specifies a temp variable that can be set to non-0 to break the loop, ending iteration. By default this is break
.
Effects can be used within the loop to perform operations with the data within an array.
for_each_scope_loop
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.9。 |
for_each_scope_loop = { array = <name> break = <string> <effects> }
Runs a loop for each element of the specified array and changes the current scope to the current element in each iteration.
The break attribute specifies a temp variable that can be set to non-0 to break the loop, ending iteration. By default this is break
.
Effects can be used within the loop to perform operations with the data within an array.
random_scope_in_array
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.9。 |
random_scope_in_array = { array = <name> break = <string> limit = { <triggers> } <effects> }
Runs a loop for each element of the specified array and changes the current scope to a random scope (out of the scopes within the array) that meet the triggers specified.
The break attribute specifies a temp variable that can be set to non-0 to break the loop, ending iteration. By default this is break
.
Effects can be used within the loop to perform operations with the data within an array.
add_to_temp_array
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.9。 |
Same as add_to_array
but for temporary arrays that expire once execution of the script is finished.
remove_from_temp_array
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.9。 |
Same as remove_from_array
but for temporary arrays that expire once execution of the script is finished.
clear_temp_array
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.9。 |
Same as clear_array
but for temporary arrays that expire once execution of the script is finished.
resize_temp_array
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.9。 |
Same as resize_array
but for temporary arrays that expire once execution of the script is finished.
Triggers
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.9。 |
is_in_array
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.9。 |
is_in_array = { array = <name> value = <value> }
Checks if the specified value is in the specified array.
any_of
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.9。 |
any_of = { array = <name> value = <string> index = <string> <triggers> }
Runs a loop on the specified array and checks the triggers against the current element. If any return true, the whole check returns true, otherwise returns false.
all_of
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.9。 |
all_of = { array = <name> value = <string> index = <string> <triggers> }
Runs a loop on the specified array and checks the triggers against the current element. If any return false, the whole check returns false, otherwise returns true.
any_of_scopes
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.9。 |
any_of_scopes = { array = <name> <triggers> }
Runs a loop on the specified array and checks the triggers against the current element scope. If any return true, the whole check returns true, otherwise returns false.
all_of_scopes
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.9。 |
all_of_scopes = { array = <name> <triggers> }
Runs a loop on the specified array and checks the triggers against the current element scope. If any return false, the whole check returns false, otherwise returns true.
Examples
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.9。 |
文件 | 效果 • 条件 • 定义 • 修正 • 修正列表 • 作用域 • 本地化 • on action • 数据结构 (标记, 临时标记, 国家别名, 变量, 数组) |
脚本 | 成就修改 • AI修改 • AI focuses • 自治领修改 • 权力平衡修改 • 剧本/标签 (游戏规则)• 建筑修改 • 人物修改 • 修饰性TAG修改 • 国家创建 • 军队修改 • 决议制作 • 装备修改 • 事件修改 • Idea修改 • 意识形态修改 • 军工商修改 • 国策制作 • 资源修改 • Scripted GUI • 科技制作 • 单位修改 |
地图 | 地图 • 省份 • 补给区域 • 战略区域 |
图形图像 | 界面 • 图形资产 • 实体模型 • 后期特效 • 离子效果 • 字体 |
装饰性 | 肖像 • 命名列表 • 音乐 • 音效 |
其他 | 控制台指令 • 故障排除 • 模组结构 • 成就代码分析 • Mod相关 • Nudger修改 |