Update:
- Added a while effect
- Added an export_to_variable effect
Examples:
Code:set_variable = { which = count value = 20 } while = { limit = { check_variable = { which = count value = 1 } } subtract_variable = { which = count value = 1 } add_treasury = 5 }
Note: the while effect will not produce any tooltip due to the problems that would cause. Also, make sure you don't create an endless loop... (altough there is a fail-safe at 100K loops)
Code:export_to_variable = { which = prestigeVar value = prestige }
Note: The current country's prestige is saved in the variable.
Code:export_to_variable = { which = stabilityVar value = stability who = FROM }
Note: FROM's stability is saved in the variable.
Code:export_to_variable = { which = productionEfficiencyVar value = modifier:production_efficiency }
Note: The current country's modifier production_efficiency is saved in the variable.
Code:export_to_variable = { which = borderDistanceVar value = borderDistance who = FRA }
Note: The border distance between the current country and FRA is saved in the variable.
General note: export_to_variable also works in province scope
Country values:
Code:prestige war_exhaustion manpower manpower_percentage max_manpower states_development average_autonomy average_home_autonomy corruption stability treasury land_forcelimit naval_forcelimit average_unrest num_of_cities army_tradition navy_tradition mercantilism overextension_percentage inflation num_of_ports patriarch_authority piety religious_unity ADM DIP MIL heir_adm heir_dip heir_mil tolerance_to_this trade_income_percentage years_of_income monthly_income army_size navy_size adm_tech dip_tech mil_tech border_distance capital_distance + all global modifiers
Province values:
Code:province_trade_power local_autonomy base_manpower base_production base_tax development unrest nationalism tolerance_to_this + all local modifiers
Just want to confirm, this will be in the next patch, right?The syntax should be the same that EUIV uses so I'll just quote Captain Gars post where he explains it in a thorough manner.
Do note however that I've yet to fill out most of the variables that can be exported. So please head over here https://forum.paradoxplaza.com/foru...eature-feedback-request.951329/#post-21468139 to suggest prioritized game values to export.
Divine, how frequently does the while loop trigger? And can we get the ability to define how frequently? Such as weekly, daily, monthly, or indeed yearly?
Anything you would use a while loop in programming for. For example right now I have an event that fires itself X times until a condition is met. A while loop would be a way better solution. Anything with complicated variable operations would benefit from such a loop.It depends actually on how you use a while loop. My point though is with CKII why would you want a while loop that did have a tick function?
What you seem to be wanting is better handled by repeat_event with a delay.At the moment I am using similar things, I am thinking though more of an operations standpoint, what if the condition does not become valid for x number of ticks? Depending on how fast the while loop acts it will cause a crash.
Posted in the feedback thread for export variables. This is now the current functionality for export_to_variable. Please keep the feedback for this specific effect in the linked thread: https://forum.paradoxplaza.com/forum/index.php?threads/script-feature-feedback-request.951329These are the implemented game values currently available for export_to_variable effect.
Character:
martial
diplomacy
intrigue
stewardship
learning
base_health
demesne_efficiency
decadence
dynasty_realm_power
fertility
infamy
monthly_income
plot_power
population_factor
relative_power_to_liege
religion_authority
scaled_wealth
treasury
yearly_income
age
ai_ambition
ai_greed
ai_honor
ai_rationality
ai_zeal
among_most_powerful_vassals
combat_rating
demesne_garrison_size
demesne_size
health_traits
imprisoned_days
lifestyle_traits
max_manpower
num_of_baron_titles
num_of_children
num_of_claims
num_of_consorts
num_of_count_titles
num_of_count_titles_in_realm
num_of_duke_titles
num_of_dynasty_members
num_of_emperor_titles
num_of_extra_landed_titles
num_of_friends
num_of_holy_sites
num_of_king_titles
num_of_lovers
num_of_plot_backers
num_of_prisoners
num_of_rivals
num_of_subrealm_castles
num_of_subrealm_cities
num_of_spouses
num_of_titles
num_of_trade_posts
num_of_traits
num_of_unique_dynasty_vassals
num_of_vassals
over_max_demesne_size
over_vassal_limit
personality_traits
piety
population
population_and_manpower
prestige
realm_diplomacy
realm_intrigue
realm_learning
realm_martial
realm_stewardship
realm_levies
max_realm_levies
realm_size
republic_total_num_of_trade_posts
ruled_years
score
unused_manpower
retinue_points_max
retinue_points_used
retinue_points_free
Title:
mercenary_siphon_factor
num_fitting_characters_for_title
num_of_buildings
num_of_feuds
population
population_and_manpower
ruled_years
unused_manpower
holding_tax_value
Province:
religion_authority
revolt_risk
num_of_empty_holdings
num_of_max_settlements
num_of_settlements
total_tax_value
Example usage:
The current scope will always be holding the variable that is assigned the value but the who parameter is used if you want to export a value from another scope to use in your current scopes variables. If who is not defined it will default to using the current scope when exporting the game value.Code:ROOT = { export_to_variable = { which = count who = event_target:my_capital value = total_tax_value } while = { limit = { check_variable = { which = count value = 1 } } subtract_variable = { which = count value = 1 } wealth = 1 } }
In addition to these you can also export modifier values for the different scopes (eg. value = modifier:fertility).