钢铁雄心4
ParaWikis
最新百科
都市天际线2百科
英雄无敌3百科
维多利亚3百科
奇妙探险队2百科
罪恶帝国百科
英白拉多:罗马百科
热门百科
群星百科
欧陆风云4百科
十字军之王2百科
十字军之王3百科
钢铁雄心4百科
维多利亚2百科
ParaWikis
申请建站
ParaWikis
ParaCommons
最近更改
随机页面
加入QQ群
工具
链入页面
相关更改
特殊页面
页面信息
页面值
帮助
译名手册
字词转换
编辑指南
编辑规范
练手沙盒
资助我们
ParaTranz
资助我们
×
欢迎访问钢铁雄心4百科!
注册一个账号
,一起参与编写吧!这里是
当前的工程
。
注意:请勿在本站上传违反中华人民共和国法律的相关项目及文本,包括但不限于涉及违法犯罪、历史虚无主义、侮辱先烈、暴力色情等,一经发现将立刻锁定证据并上报网警。
欢迎所有对百科感兴趣的同学加入钢4编辑群:
1137478871
。
阅读
查看源代码
查看历史
讨论
查看“变量”的源代码
←
变量
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{version|1.9}} Variables<ref name=shultays>Guide written by shultays at https://forum.paradoxplaza.com/forum/index.php?threads/list-of-tutorials-on-modding-scripting.1087204/#post-24257440</ref> is a powerful system that we have added in 1.5.0. It enables content designers to store numbers ("values") in various places and use them in effects/triggers. There are 4 scopes that you can store variables * Country * State * Unit Leader * Global Every country, state and unit leader has its own variable list. Global scope is unique and should be used for storing variables that makes sense in a global sense, not something specific to a country. == Accessing Variables == {{SVersion|1.9}} In various effects/triggers, you will access a variable by giving it a name. Variable names are not case sensitive and other than a few special characters, you can use anything character you want. Although for consistency and future proof, avoid using numbers and special characters other than '_' By default, you will access the variables in current scope. If you want to access a variable on a specific scope or a different you can use the following: <pre> ENG.var_name 42.var_name global.var_name ROOT.var_name FROM.FROM.var_name event_target:event_target_name.var_name global_event_target:event_target_name.var_name another_var_name:var_name </pre> * You can use a country's tag to access a variable in that country. First example access a variable on England. * You can use a state's id to access a variable in that state. Second example for example will access to Moselland which has an id of 42 * You can access global variables by using global (3rd example) * You can access a variable on different scope by using tokens like ROOT, PREV or FROM (4th) and you can chain them together (5th) * You can access a variable on an event target by adding event_target:event_target_name before the variable (6th) or you can do * same for a global_event_target (7th) Variables are set to 0 by default. When you access a variable that does not exist, you will get 0 instead. You can use following to make it default to some other value <pre>var_name?123</pre> When you access a variable like that, it will give you value '123' if var_name does not exist. In the rest of the tutorials, I will use var_name to access an example variable named 'var_name' in current scope but you can use all other ways mentioned here to access variables in different scopes as well == Variable Effects == {{SVersion|1.9}} Here is a list of effects that you can use to alter value of a variable. === set_variable === {{SVersion|1.9}} <pre> set_variable = { var = var_name value = 123 } set_variable = { var = var_name value = var_name_2 } </pre> or short hand <pre>set_variable = { var_name = var_name_2 }</pre> set_variable is used for setting value of a variable to a number or another variable. First example sets var_name to 123, second one sets it to value of var_name_2. 3rd example is equivalent to 2nd one but it is shorter to write. Every example that accepts var & value pair can be shortened. One special thing about variables is you can use a value instead of a variable. This is how the first example works. In that example, 123 is actually a variable but its value is always 123 no matter what. This makes it possible to use a constant number in places that actually expects a variable. But of course if you try something like: <pre> set_variable = { 1 = 2 } </pre> It will fail and give an error since assigning something to a value makes no sense. === clear_variable === {{SVersion|1.9}} <pre> clear_variable = var_name </pre> This clears a variable completely. After clearing a variable, it will not exist to anymore and when you access it you will get 0 (unless it is overridden by ?) === add_to_variable === {{SVersion|1.9}} Includes '''subtract_from_variable''', '''multiply_variable''', '''divide_variable''', '''modulo_variable'''. These are all similar and works exactly like set_variable. <pre> add_to_variable = { var = var_name value = 123 } add_to_variable = { var = var_name value = var_name_2 } or short hand add_to_variable = { var_name = var_name_2 } </pre> Instead of setting var_name, these examples will add the value to it instead. You can replace add_to_variable token with other effects to use those operations instead. === clamp_variable === {{SVersion|1.9}} <pre> clamp_variable = { var = var_name min = var_name_2 max = var_name_3 } </pre> clamp_variable can be used to clamp a variable between other two variables (or values). In this example if var_name < var_name_2 it will be set to var_name 2. If it is > var_name_3 it will be set to var_name_3. Otherwise its value will remain same. === round_variable === {{SVersion|1.9}} <pre> round_variable = var_name </pre> This will round a variable to nearest integer. == Variable Triggers == {{SVersion|1.9}} There are only two triggers related to variables. === check_variable === {{SVersion|1.9}} check_variable will compare two variables/values with each other with a specified operator and uses it as a trigger. <pre> check_variable = { var = var_name value = var_name_2 compare = less_than } </pre> This example compares var_name to var_name_2 and returns true of var_name is less than var_name_2. Available compare tokens: * less_than * less_than_or_equals * greater_than * greater_than_or_equals * equals * not_equals You can omit compare token if you want, in this case it will default to greater_than_or_equals Short syntax can be used: <pre> check_variable = { var_name = var_name_2 } check_variable = { var_name < var_name_2 } check_variable = { var_name > var_name_2 } </pre> First one will compare for equals, second one is for less_than and third one is for greater_than. There is no way to use other comparison methods in this way (ie >= won't work) === has_variable === {{SVersion|1.9}} <pre> has_variable = var_name </pre> This will check if a variable exist for a scope. clear_variable effect will erase a variable completely so has_variable will return false after that. == Targeted Variables== {{SVersion|1.9}} You can define a variable that is targeted at some other scope. Here is an example usage <pre> ENG = { TUR = { set_variable = { var_name@PREV = 5 } } } </pre> Here first we set scope to ENG and then to TUR. When we call set_variable, it will set a variable named var_name on TUR targeted towards PREV scope (which is ENG). You can chain scopes (var_name@PREV.PREV) or use country tags/state IDs as well (var_name@ENG for example would behave same in previous example, an example for states would be var_name@42). You can only target states or countries (no unit leaders). === Using variables like event targets === {{SVersion|1.9}} Variables can replace event targets up to a point. Instead of storing a value, you can store a country TAG or state id in variables and use them later in a similar way. Example: <pre> set_variable = { var_name = POL.id } var:var_name = { set_variable = { var_name_2 = 125 } } </pre> This example will create a var_name variable in current scope and set it to id of POL (a unique number represents POL). After that you can switch scope to POL using this variable like we did in the example. The example here will set a variable named var_name_2 to 125 in Poland scope. You can set a variable to a country TAG like we did in example. You can also use scopes like PREV/FROM/ROOT or chain them together. To set something to current scope, use THIS instead. If you want to set a variable to a specific state scope, you can use set_variable = { var_name = 42.id} (which is basically id on 42 scope) You can only set a variable to a country or a state scope (no unit leader scope, they are like a bastard child of this system) == Variables and Scripted Localization == {{SVersion|1.9}} You can access a variable in scripted using the following in the string: <pre>[?var_name]</pre> Will print the value of var_name in scope of scripted localization. == Temporary Variables == {{SVersion|1.9}} Temporary variables is a 'feature' (read hack) that lets you store variables that will be stored temporarily and will be deleted after the script ends. You can use those to make a calculations without , lets say you want to calculate following equation: <pre>c = a * 2 - b / 3</pre> Here is how you can do it without creating additional variables anywhere: <pre> set_temp_variable = { temp1 = a } multiply_temp_variable = { temp1 = 2 } set_temp_variable = { temp2 = b } divide_temp_variable = { temp2 = 3 } subtract_from_temp_variable = { temp1 = temp2 } set_variable = { c = temp1 } </pre> These are the effects relating to temporary variables: * set_temp_variable * add_to_temp_variable * subtract_from_temp_variable * multiply_temp_variable * divide_temp_variable * modulo_temp_variable * round_temp_variable * clamp_temp_variable In previous example, the last line sets c to temp1. If you already had an actual variable named temp1 in current scope, it will be shadowed by temp variable. So try to use unique names for your temp variables or otherwise it will be weird. One cool about temp variables is that you can use them in triggers. Since their effects are only temporary and does not affect game play, they should be safe to use. For example in previous example we could calculate a * 2 - b / 3 same way and check if it is greater than 0 using using check_variable trigger. Also in a couple part of the programs, temporary variables are not cleared between triggers and effects. For example temporary variables stays same for is_valid trigger of an event and their effects. So you can calculate something in trigger, then use it on effect. This is kinda weird but it has uses. === Random Variables === {{SVersion|1.9}} You can use a variable named 'random' to get a random variable: <pre>set_variable = { var_name = random }</pre> Will set var_name to a value between 0 and 1. You can use it on triggers as well but it will give you same variable. There are also a couple more types of randomization distributions: uniform, binomial and poisson distribution. The first type is almost identical to the default distribution, except that when using it, you can select the minimum and maximum values of the variable. Example: <pre> randomize_temp_variable = { var = num_dogs distribution = uniform min = 0 max = 1 } </pre> The second type can take the minimum and maximum values as the previous one, but in contrast to the previous one is more likely to take an average value, note: N=2. Example: <pre> randomize_temp_variable = { var = num_dogs distribution = binomial min = 0 # optional max = 10 # required if min is specified } </pre> The last distribution uses the lambda value to randomize the variable. When using this type of distribution, the difference between the maximum and average values of the variable decreases as the lambda value increases. Unlike the previous ones, it can only set the minimum value of a variable. Example: <pre> randomize_temp_variable = { var = num_dogs distribution = poisson lambda = 10 # required min = 10 # optional } </pre> For AI triggers (like ai_will_do modifiers), use ai_random instead. === Game Variables === {{SVersion|1.9}} Game variables are a special read only variables. You can read them like regular variables but they are actually calculated dynamically. For example in countries you can access political power of a country and use it as a variable: <pre>set_variable = { var_name = political_power }</pre> Here political_power is actually a game variable and it gives you political power that a country has. You can not edit them though, you have to use effects for those. Some of them are automatically converted from triggers (basically any triggers that accepts country/state/unit leader/global scope and works like max_manpower = 10 can be used as game variable) but some of them are unique to modifier system. Do not use name of game variables in your variables. hoi4 scripting language supports storing tokens as a variable. For example you can do the following: <pre> set_temp_variable = { t = token:infantry_equipment } add_equipment_to_stockpile = { type = var:t amount = 100 } </pre> Here you are storing token infantry_equipment in a temporary variable named t and later we are using this stored token in add_equipment_to_stockpile effect. At the moment following objects can be stored in variables and all effects/triggers should be able to accept such variables. <pre> ideology/ideology groups equipment types operation </pre> Here is a list of game variables for each type of scope: ==== Global ==== {{SVersion|1.9}} {| class="wikitable sortable" width="100%" |- ! width="40%" | Variable ! width="60%" | Description |- |countries |get array of all countries (including non existing) |- |date |get date value that can be comparable to other date values and localized using GetDateString/GetDateStringShortMonth/GetDateStringNoHour/GetDateStringNoHourLong scripted locs |- |ideology_groups |array of objects in ideology_groups database |- |majors |get array of all majors (including non existing) |- |num_days |current total days |- |operations |array of objects in operations database |- |year |current year |- |difficulty |(trigger) check if the difficulty is above or below specified value 0-2 (difficulty enum). Example: difficulty > 0 (above easy) |- |threat |(trigger) check the global threat value. 0-1 value |} ==== Country ==== {{SVersion|1.9}} {| class="wikitable sortable" width="100%" |- ! width="40%" | Variable ! width="60%" | Description |- |ai_attitude_allied_weight |weight for an ai attitude attitude_allied against country. Example: GER.ai_attitude_allied_weight@ENG |- |ai_attitude_friendly_weight |weight for an ai attitude attitude_friendly against country. Example: GER.ai_attitude_friendly_weight@ENG |- |ai_attitude_hostile_weight |weight for an ai attitude attitude_hostile against country. Example: GER.ai_attitude_hostile_weight@ENG |- |ai_attitude_is_threatened |returns 1 if ai is threatened |- |ai_attitude_neutral_weight |weight for an ai attitude attitude_neutral against country. Example: GER.ai_attitude_neutral_weight@ENG |- |ai_attitude_outraged_weight |weight for an ai attitude attitude_outraged against country. Example: GER.ai_attitude_outraged_weight@ENG |- |ai_attitude_protective_weight |weight for an ai attitude attitude_protective against country. Example: GER.ai_attitude_protective_weight@ENG |- |ai_attitude_threatened_weight |weight for an ai attitude attitude_threatened against country. Example: GER.ai_attitude_threatened_weight@ENG |- |ai_attitude_wants_ally |returns 1 if ai wants ally |- |ai_attitude_wants_antagonize |returns 1 if ai wants antagonize |- |ai_attitude_wants_ignore |returns 1 if ai wants ignore |- |ai_attitude_wants_protect |returns 1 if ai wants protect |- |ai_attitude_wants_weaken |returns 1 if ai wants weaken |- |ai_strategy_activate_crypto |ai strategy value activate_crypto against country. Example: GER.ai_strategy_activate_crypto@ENG |- |ai_strategy_alliance |ai strategy value alliance against country. Example: GER.ai_strategy_alliance@ENG |- |ai_strategy_antagonize |ai strategy value antagonize against country. Example: GER.ai_strategy_antagonize@ENG |- |ai_strategy_befriend |ai strategy value befriend against country. Example: GER.ai_strategy_befriend@ENG |- |ai_strategy_conquer |ai strategy value conquer against country. Example: GER.ai_strategy_conquer@ENG |- |ai_strategy_consider_weak |ai strategy value consider_weak against country. Example: GER.ai_strategy_consider_weak@ENG |- |ai_strategy_contain |ai strategy value contain against country. Example: GER.ai_strategy_contain@ENG |- |ai_strategy_declare_war |ai strategy value declare_war against country. Example: GER.ai_strategy_declare_war@ENG |- |ai_strategy_decrypt_target |ai strategy value decrypt_target against country. Example: GER.ai_strategy_decrypt_target@ENG |- |ai_strategy_dont_defend_ally_borders |ai strategy value dont_defend_ally_bordersagainst country. Example: GER.ai_strategy_dont_defend_ally_borders@ENG |- |ai_strategy_force_defend_ally_borders |ai strategy value force_defend_ally_borders against country. Example: GER.ai_strategy_force_defend_ally_borders@ENG |- |ai_strategy_ignore |ai strategy value ignore against country. Example: GER.ai_strategy_ignore@ENG |- |ai_strategy_ignore_claim |ai strategy value ignore_claim against country. Example: GER.ai_strategy_ignore_claim@ENG |- |ai_strategy_influence |ai strategy value influence against country. Example: GER.ai_strategy_influence@ENG |- |ai_strategy_invade |ai strategy value invade against country. Example: GER.ai_strategy_invade@ENG |- |ai_strategy_occupation_policy |ai strategy value occupation_policy against country. Example: GER.ai_strategy_occupation_policy@ENG |- |ai_strategy_prepare_for_war |ai strategy value prepare_for_war against country. Example: GER.ai_strategy_prepare_for_war@ENG |- |ai_strategy_protect |ai strategy value protect against country. Example: GER.ai_strategy_protect@ENG |- |ai_strategy_send_volunteers_desire |ai strategy value send_volunteers_desire against country. Example: GER.ai_strategy_send_volunteers_desire@ENG |- |ai_strategy_support |ai strategy value support against country. Example: GER.ai_strategy_support@ENG |- |air_intel |air intel against a target country. example GER.air_intel@ENG |- |allies |array of allies (faction members). prefer using faction_members instead |- |army_intel |army intel against a target country. example GER.army_intel@ENG |- |army_leaders |all army leaders of a country |- |autonomy_ratio |autonomy of scope country. -1 if not a subject |- |capital |capital state of the country |- |civilian_intel |civilian intel against a target country. example GER.civilian_intel@ENG |- |command_power |total command power of country |- |controlled_states |array of controlled states |- |core_compliance |returns core compliance of target country |- |core_resistance |returns core resistance of target country |- |core_states |array of core states |- |cryptology_defense_level |cryptology defense level of a country |- |current_party_ideology_group |returns the token for current party ideology group |- |days_mission_timeout |timeout in days for a specific timed mission, mission type token is defined in target. example: days_mission_timeout@GER_mefo_bills_mission |- |decryption_speed |total encryption strength of a country that is needed |- |encryption_strength |total encryption strength of a country that is needed |- |enemies |array of enemies at war with |- |enemies_of_allies |array of enemies of allies |- |exiles |exile host of this country |- |faction_leader |faction leader of this country's faction |- |faction_members |array of faction members |- |fuel_k |total fuel of country in thousands |- |highest_party_ideology |ideology of the most popular party. Can exclude the ruling party by using @exclude_ruling_party. Example: highest_party_ideology OR highest_party_ideology@exclude_ruling_party |- |highest_party_popularity |popularity size of the most popular party [0.00, 1.00]. Can exclude the ruling party by using @exclude_ruling_party. Example: highest_party_popularity OR highest_party_popularity@exclude_ruling_party |- |host |exile host of this country |- |legitimacy |legitimacy of scope country. -1 if not an exile |- |manpower |DEPRECATED, MAY OVERFLOW. total manpower of country |- |manpower_k |total manpower of country in thousands |- |max_available_manpower |DEPRECATED, MAY OVERFLOW. total available manpower of country |- |max_available_manpower_k |total available manpower of country in thousands |- |max_fuel_k |max fuel of country in thousands |- |max_manpower |DEPRECATED, MAY OVERFLOW. maximum manpower of country |- |max_manpower_k |maximum manpower of country in thousands |- |modifier |a modifier stored in country scope (usage modifier@stability_weekly or any other modifier. Gives you value of a modifier at country) |- |navy_intel |navy intel against a target country. example GER.navy_intel@ENG |- |navy_leaders |all navy leaders of a country |- |neighbors |array of neighbors |- |neighbors_owned |array of neighbors to owned states |- |num_armies |number of armies |- |num_armies_in_state |number of armies in state, state is in target. example num_armies_in_state@123 |- |num_armies_with_type |number of armies with dominant type, dominant type is defined in target. example: num_armies_with_type@light_armor |- |num_battalions |number of battalions |- |num_battalions_with_type |number of battalions with sub unit type, sub unit type is defined in target. example: num_of_battalions_with_type@light_armor |- |num_controlled_states |number of controlled states |- |num_core_states |number of core states |- |num_deployed_planes |number of deployed planes |- |num_deployed_planes_with_type |number of deployed planes with equipment type. example num_deployed_planes_with_type@fighter |- |num_equipment |number of equipment in country. example num_equipment@infantry_equipment |- |num_equipment_in_armies |number of equipment in armies of the country, equipment type token is defined in target. example num_equipment_in_armies@infantry_equipment |- |num_equipment_in_armies_k |number of equipment in armies of the country in thousands, equipment type token is defined in target. example num_equipment_in_armies_k@infantry_equipment |- |num_owned_controlled_states |number of owned and core states |- |num_owned_states |number of owned states |- |num_ships |number of ships |- |num_ships_with_type |number of ships controlled in country, ship type is defined in target. example num_ships_with_type@carrier |- |num_target_equipment_in_armies |number of equipment required in armies of the country, equipment type token is defined in target. example num_target_equipment_in_armies@infantry_equipment |- |num_target_equipment_in_armies_k |number of equipment required in armies of the country in thousands, equipment type token is defined in target. example num_target_equipment_in_armies_k@infantry_equipment |- |occupied_countries |array of occupied countries |- |operatives |all operatives of a country |- |opinion |opinion of a country targeted on another one. example GER.opinion@ENG |- |original_tag |returns the original tag of a country |- |overlord |master of this subject |- |owned_controlled_states |array owned and core states |- |owned_states |array of owned states |- |party_popularity |popularity of targeted party. example party_popularity@democratic. mat also target ruling_party |- |political_power |total political power of country |- |potential_and_current_enemies |array of potential and actual enemies |- |resource |number of surplus resources in country, resource type is defined in target resource@steel |- |resource_consumed |number of resources consumed by country, resource type is defined in target resource_consumed@steel |- |resource_exported |number of resources exported by country, resource type is defined in target resource_exported@steel |- |resource_imported |number of resources imported by country, resource type is defined in target resource_imported@steel |- |resource_produced |number of resources produced by country, resource type is defined in target. example resource_produced@steel |- |stability |stability of a country |- |subjects |array of subjects |- |agency_upgrade_number |(Trigger) Checks the number of upgrade done in the intelligence agency. |- |ai_irrationality |(trigger) Check the ai irrationality value. |- |ai_wants_divisions |(trigger) Will compare towards the amount of divisions an ai wants to have. |- |alliance_naval_strength_ratio |(trigger) Compares the estimated naval strength between the scope country, his allies and his enemies. |- |alliance_strength_ratio |(trigger) Compares the estimated army strength between the scope country, his allies and his enemies. |- |amount_manpower_in_deployment_queue |(trigger) Checks for amount manpower currently in deploymentview. |- |amount_research_slots |(trigger) Check number of research current research slots. |- |any_war_score |(trigger) Compares the warscore of all wars in a country to see if any fullfills the comparison condition 0-100. Example: any_war_score > 40. |- |casualties |(trigger) Check the amount of casualties a country has suffered in all of it's wars. |- |casualties_k |(trigger) Check the amount of casualties in thousands a country has suffered in all of it's wars. |- |command_power_daily |(trigger) Checks if daily command power increase is more or less that specified value. |- |compare_autonomy_progress_ratio |(trigger) Check if autonomy progress ratio is higher than value. |- |conscription_ratio |(trigger) Checks conscription ratio of the country compared to target conscription ratio. |- |convoy_threat |(trigger) A trigger to check convoy threat for a country. Controlled by NAVAL_CONVOY_DANGER defines. Returns a value between 0 and 1. Example: convoy_threat > 0.5 |- |current_conscription_amount |(trigger) Checks the current conscription amount of the country. |- |days_since_capitulated |(trigger) Checks the number of days since the country last capitulated, even if it is no longer capitulated. If it has not ever capitulated, the value is extremely large. It is recommended to combine this with has_capitulated = yes when you specifically want to ignore non-active capitulations. Example: GER = { OR = { has_capitulated = no days_since_capitulated > 14 } } # Germany is not both actively and recently capitulated. |- |decryption_progress |(trigger) Checks decryption ratio against a country. Example: decryption_progress = { target = GER value > 0.5 } OR decryption_progress@GER as variable. |- |enemies_naval_strength_ratio |(trigger) Compares the estimated navy strength between the scope country and all its enemies. |- |enemies_strength_ratio |(trigger) Compares the estimated army strength between the scope country and all its enemies. |- |foreign_manpower |(trigger) Check the amount of foreign garrison manpower we have. |- |fuel_ratio |(trigger) Compares the fuel ratio to a variable. |- |garrison_manpower_need |(trigger) Check the amount of manpower needed by garrisons. |- |has_added_tension_amount |(trigger) Compare if the country has added above or below the specified amount of tension. |- |has_collaboration |(trigger) Checks the collaboration in a target country with our currently scoped country. Example: has_collaboration = { target = GER value > 0.5} OR has_collaboration@GER as variable. |- |has_legitimacy |(trigger) Check scope country legitimacy 0-100. |- |has_manpower |(trigger) Check amount of manpower. |- |has_political_power |(trigger) Check amount of political power. |- |has_stability |(trigger) Check value of stability 0-1. Example: has_stability < 0.6. |- |has_war_support |(trigger) Check value of war_support 0-1. Example: has_war_support < 0.6. |- |land_doctrine_level |(trigger) Checks researched land doctrine level. |- |manpower_per_military_factory |(trigger) Number of available manpower per factory (excluding dockyards) the country has. |- |mine_threat |(trigger) A trigger to check how dangerous enemy mines are for a country. Controlled by NAVAL_MINE_DANGER defines. Returns a value between 0 and 1. Example: mine_threat > 0.5 |- |network_national_coverage |(trigger) Checks network national coverage you have over a country. Example: network_national_coverage = { target = GER value > 0.5 }. |- |num_divisions |(trigger) Will compare towards the amount of divisions a country has control over, if strength matters use has_army_size. |- |num_faction_members |(trigger) Compares the number of members in the faction for the current country. |- |num_fake_intel_divisions |(trigger) Will compare towards the amount of fake intel divisions a country has control over. |- |num_free_operative_slots |(trigger) Checks the number of operative a country can recruit right now. Note that this is not necessarily greater than zero, if num_operative_slots returned a number greater than the number of operative. |- |num_occupied_states |(trigger) Check the number of states occupied by nation. |- |num_of_available_civilian_factories |(trigger) Check amount of available civilian factories. |- |num_of_available_military_factories |(trigger) Check amount of available military factories. |- |num_of_available_naval_factories |(trigger) Check amount of available naval factories. |- |num_of_civilian_factories |(trigger) Check amount of civilian factories. |- |num_of_civilian_factories_available_for_projects |(trigger) Check amount of civilian factories available for a new project to use. |- |num_of_controlled_states |(trigger) Check amount of controlled states. |- |num_of_factories |(trigger) Check amount of total factories. |- |num_of_military_factories |(trigger) Check amount of military factories. |- |num_of_naval_factories |(trigger) Check amount of naval factories. |- |num_of_nukes |(trigger) Check amount of nukes. |- |num_of_operatives |(trigger) Checks the number of operatives the country controls. |- |num_operative_slots |(trigger) Checks the number of available operative slots a country has. If this differs from the number of operative, this does not mean the country can recruit an operative, but that it will eventually be able to. |- |num_subjects |(trigger) Check the number of subjects of nation. |- |num_tech_sharing_groups |(trigger) Checks how many tech sharing groups a nation is a member of. |- |original_research_slots |(trigger) Check number of research slots at start of game. |- |political_power_daily |(trigger) Checks if daily political power increase is more or less that specified value . |- |political_power_growth |(trigger) Check the value of political power daily growth. |- |surrender_progress |(trigger) Check if a country is close to surrendering. |- |target_conscription_amount |(trigger) Checks the target conscription amount of the country. |} ==== State ==== {{SVersion|1.9}} {| class="wikitable sortable" width="100%" |- ! width="40%" | Variable ! width="60%" | Description |- |arms_factory_level |military factory level in the state |- |building_level |building level of a building with type, uses target as building type. example: building_level@arms_factory |- |controller |controller of the state |- |core_countries |countries that cores the state |- |damaged_building_level |damaged building level of a building with type, uses target as building type. example: damaged_building_level@arms_factory |- |distance_to |distance to another state, uses target as another state. example: 123.distance_to@124 |- |industrial_complex_level |civilian factory level in the state |- |infrastructure_level |infrastructure level in the state |- |modifier |value of modifier stored in this state, uses target as modifier token, example: 123.modifier@local_manpower |- |non_damaged_building_level |non damaged building level of a building with type, uses target as building type. example: non_damaged_building_level@arms_factory |- |owner |owner of the state |- |resource |resources produced in state. example: resource@steel |- |compliance |(trigger) Compares the current compliance level of a state to a value. |- |compliance_speed |(trigger) Compares the current compliance speed of a state to a value. |- |days_since_last_strategic_bombing |(trigger) Checks the days since last strategic bombing. |- |resistance |(trigger) Compares the current resistance level of a state to a value. |- |resistance_speed |(trigger) Compares the current resistance speed of a state to a value. |- |resistance_target |(trigger) Compares the target resistance level of a state to a value. |- |state_and_terrain_strategic_value |(trigger) Checks for state strategic value. |- |state_population |(trigger) Check the population in the state. |- |state_population_k |(trigger) Check the population in the state in thousands (use to avoid variable overflows). |- |state_strategic_value |(trigger) Checks for state strategic value. |} ==== Unit Leader ==== {{SVersion|1.9}} {| class="wikitable sortable" width="100%" |- ! width="40%" | Variable ! width="60%" | Description |- |army_attack_level |attack level of the leader |- |army_defense_level |defense level of the leader |- |attack_level |attack level of the leader |- |average_stats |average stats of unit leader |- |avg_combat_status |average progress of all combats |- |avg_defensive_combat_status |average progress of defensive combats |- |avg_offensive_combat_status |average progress of offensive combats |- |avg_unit_planning_ratio |average planning ratio of all units |- |avg_units_acclimation |average unit acclimatization for a specific climate, acclimatization type is defined in target, example: avg_units_acclimation@cold_climate |- |coordination_level |coordination level of the leader |- |defense_level |defense level of the leader |- |has_orders_group |1 if leader has orders group, zero otherwise |- |intel_yield_factor_on_capture |rate at which intel is extracted from this operative by an enemy country |- |leader_modifier |value of a modifier stored in leader modifier, modifier token is defined in target, example: leader_modifier@navy_max_range |- |logistics_level |logistics level of the leader |- |maneuvering_level |maneuvering level of the leader |- |num_armored |number of units with armored dominant type |- |num_artillery |number of units with artillery dominant type |- |num_assigned_traits |number of assigned traits the leader has |- |num_basic_traits |number of basic traits a leader has |- |num_battalions |number of battalions |- |num_battalions_with_type |number of battalions with sub unit type, sub unit type is defined in target, example: num_battalions_with_type@light_armor |- |num_battle_plans |number of battle plans of unit leader |- |num_cavalry |number of units with cavalry dominant type |- |num_equipment |number of equipment in army of a leader, equipment type token is defined in target, example: num_equipment@infantry_equipment |- |num_infantry |number of units with infantry dominant type |- |num_max_traits |number of maximum assignable traits a leader can have |- |num_mechanized |number of units with mechanized dominant type |- |num_motorized |number of units with motorized dominant type |- |num_personality_traits |number of personality traits a leader has |- |num_rocket |number of units with rocket dominant type |- |num_ships |number of ships controlled by leader |- |num_ships_with_type |number of ships controlled by leader, ship type is defined in target, example: num_ships_with_type@carrier |- |num_special |number of units with special dominant type |- |num_status_traits |number of status traits a leader has |- |num_target_equipment |number of equipment required in army of a leader, equipment type token is defined in target, example: num_target_equipment@infantry_equipment |- |num_terrain_traits |number of terrain traits a leader has |- |num_traits |number of traits a leader has |- |num_units |number of units controlled by leader |- |num_units_crossing_river |number of units currently passing through a river |- |num_units_defensive_combats |number of units in defensive combats |- |num_units_defensive_combats_on |number of units that are defensively fighting on a terrain, terrain type is defined as target, example: num_units_defensive_combats_on@plains |- |num_units_in_combat |number of units current fighting |- |num_units_in_state |number of units controlled by leader in state, state is in target, example: num_units_in_state@123 |- |num_units_offensive_combats |number of units in offensive combats |- |num_units_offensive_combats_against |number of units that are offensively fighting against a terrain, terrain type is defined as target, example: num_units_offensive_combats_against@plains |- |num_units_on_climate |number of units that are on an acclimatization required location, acclimatization type is defined in target, example: num_units_on_climate@hot_climate |- |num_units_with_type |number of units with dominant type controlled by leader, dominant type is defined in target, example: num_units_with_type@light_armor |- |operation_country |the country location the operative is assigned. 0 if it is not assigned to a country |- |operation_state |the state location the operative is assigned. 0 if it is not assigned to a state |- |operation_type |returns the operation token the operative is assigned |- |operative_captor |returns the country tag that captured the operative |- |own_capture_chance_factor |the chance this operative has to be captured, taking into account the country it is operating for and the country it is operating against |- |own_forced_into_hiding_time_factor |the time factor applied to the status "forced into hiding". Takes into account the country it is operating for and the country it is operating against |- |own_harmed_time_factor |the time factor applied to the status "harmed". Takes int account the country it is operating for and the country it is operating against |- |planning_level |planning level of the leader |- |skill_level |skill level of the leader |- |sum_unit_terrain_modifier |sum of terrain modifiers of each army's location, terrain type is defined in target, example: sum_unit_terrain_modifier@sickness_chance |- |unit_modifier |value of a modifier stored in unit modifier, modifier token is defined in target, example: unit_modifier@army_attack_factor |- |unit_ratio_ready_for_plan |ratio of units that are ready for plan |- |attack_skill_level |(trigger) Compares attack skill level of a unit leader. |- |defense_skill_level |(trigger) Compares defense skill level of a unit leader. |- |logistics_skill_level |(trigger) Compares logistics skill level of a unit leader. |- |planning_skill_level |(trigger) Compares planning skill level of a unit leader. |- |skill |(trigger) Compare leader skill levels. |} == Debugging == {{SVersion|1.8}} There are various console commands to debug variables. All this console command uses selection as a scope. If you select a state (left click a state) it will scope to that. If you select a country (right click a state) it will scope to that country. If you select an army with a leader assigned it will scope to the leader. If nothing is selected, it will scope to player country. <pre> set_var var_name 1 get_var var_name list_vars list_vars TUR </pre> First one sets a variable to a value, second one gets result of a variable. 3rd and 4th one lists variables in the scope There is also print_variables effect/trigger that lets you print every variable (temp or regular) to a file <pre> print_variables = { file = log_file text = header_text append = yes print_global = yes var_list = { a b c } #optional } </pre> == Footnotes == <references/> {{Modding navbox}} [[Category:Modding]]
本页使用的模板:
Template:Ambox
(
查看源代码
)
Template:Ambox/core
(
查看源代码
)
Template:Clear
(
查看源代码
)
Template:Modding navbox
(
查看源代码
)
Template:Navbox
(
查看源代码
)
Template:Navboxgroup
(
查看源代码
)
Template:SVersion
(
查看源代码
)
Template:Version
(
查看源代码
)
返回
变量
。
×
登录
密码
记住登录
加入钢铁雄心4百科
忘记密码?
其他方式登录