• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

Divine

Tech Lead
Paradox Staff
33 Badges
Dec 26, 2005
593
1.094
  • Semper Fi
  • Hearts of Iron III
  • Hearts of Iron III: Their Finest Hour
  • Heir to the Throne
  • Europa Universalis III Complete
  • Magicka
  • March of the Eagles
  • Europa Universalis III Complete
  • Victoria: Revolutions
  • For the Motherland
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • 500k Club
  • Magicka: Wizard Wars Founder Wizard
  • Magicka 2 - Signup Campaign
  • Stellaris Sign-up
  • Crusader Kings II
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV
  • Divine Wind
  • Europa Universalis III Complete
  • Europa Universalis III: Chronicles
  • Europa Universalis III
  • Diplomacy
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Republic
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Legacy of Rome
So I've spent some time to port the export_to_variable effect from EUIV to CKII. The syntax is going to be the same that EUIV uses.
Code:
event_target:my_character
    export_to_variable = {
        which = my_variable
        value = stewardship
        (who = event_target:another_character)
    }
}
who is an optional value which defines from what scope we should extract the value. The variable is always held by the current scope. The scopes which can hold variables are Characters, Titles, Provinces.

What I want from you is a list of useful game numbers that you would find useful to export to script variables. Most of them are easy to add as long as we have things nicely defined and they are related to the three types of scopes. Please also state a priority on the things you want to see added as I've already got quite a few candidates to add.
 
Last edited:
  • 4
Reactions:
Currently I've implemented:
Character:
- All modifiers
- Attribute values

Titles:
- All modifier

Provinces:
- All modifier
 
  • 1
Reactions:
Interesting !
As script variables are numeric, would any character/title/province trigger of type int or double be potentially eligible ?
There'a list of these that can be retrieved by sorting the column "Value type" of http://www.ckiiwiki.com/Conditions
 
  • 1
Reactions:
Worth noting that the game doesn't actually use floating points for anything gameplay related; it uses fixed points instead, with precision down to 1/1000.
So the wiki probably shouldn't be calling them doubles, as they're not doubles in any way. The vast majority aren't even 64 bits long
 
Unit stats, I should think.
 
  • 1
Reactions:
Divine, we need the ability to go backwards, to take a variable and set it as an in game value. For instance, the ability to take a modded variable that has had a numeric function applied to it, and convert it back into a stat.

The other useful thing would be the various components of modifiers and the new stacking modifiers, for instance, the remaining duration, and the effect of the modifier itself.
 
  • 2
Reactions:
Divine, we need the ability to go backwards, to take a variable and set it as an in game value. For instance, the ability to take a modded variable that has had a numeric function applied to it, and convert it back into a stat.

The other useful thing would be the various components of modifiers and the new stacking modifiers, for instance, the remaining duration, and the effect of the modifier itself.
This would be awesome and it's something we're thinking about for the newer projects but due to limitations on how the current script language is implemented we have yet to come up with a solution that would work for the current games without rewriting a huge amount of code.
I've implemented a small scale version of a while loop as an effect that will at least let you do some interesting things. Do note however that the while-effect will create no tooltip at all.
 
  • 1
Reactions:
Unit stats, I should think.
Since Unit scopes are a very special I'm a bit hesitant to add them. It's currently not possible to save units or armies as event_targets which would be required for it to work. Would it be super useful for a cool feature to have this value exportable?
 
Interesting !
As script variables are numeric, would any character/title/province trigger of type int or double be potentially eligible ?
There'a list of these that can be retrieved by sorting the column "Value type" of http://www.ckiiwiki.com/Conditions
Most of them should be doable and that list is useful. Since there was quite a few of them it would be helpful if you can help out by stating which you'd find extra useful that I should prioritize.
 
  • 1
Reactions:
Quick quiestion: would that effect set the variable to the selected value or add the selected value to the variable's current value? And, would the variable need to be defined beforehand, or will this script also set the variable on the fly, so to speak?

Some war values, specially warscore and war contribution could be very helpful in cb modding (for peace conditions). And also population, manpower and retinuepoints (do these count as "character modifiers" though?)
 
  • 1
Reactions:
Quick quiestion: would that effect set the variable to the selected value or add the selected value to the variable's current value? And, would the variable need to be defined beforehand, or will this script also set the variable on the fly, so to speak?

Some war values, specially warscore and war contribution could be very helpful in cb modding (for peace conditions). And also population, manpower and retinuepoints (do these count as "character modifiers" though?)
It would set the variable to the value exported from the game. And it will define the variable if not previously defined.

I would like to avoid the war-scope in the beginning since they are always handled in a special way. Population, manpower and retinuepoints are not modifiers but I'll make sure to add those.
 
It would set the variable to the value exported from the game. And it will define the variable if not previously defined.

I would like to avoid the war-scope in the beginning since they are always handled in a special way. Population, manpower and retinuepoints are not modifiers but I'll make sure to add those.

Thanks! Other interesting values would be the maximum loot of a province, and athe tax yielded by a holding and/or the sum of taxes yielded by all settlements in a province (basically, something to help compute the richness of a province, so to speak, more accurately than the prosperity feature that is upcoming).
 
These 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:
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
    }
}
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.

In addition to these you can also export modifier values for the different scopes (eg. value = modifier:fertility).
 
Please note that these are implemented with minimal testing so be aware that there might be some values that are not resolving correctly, if so then please don't hesitate to post here to make me aware of any malfunctioning export values, when you get the possibility to try them out.
 
He said earlier that that would be difficult, as you can not currently make a unit an event target, and that is required.

Since Unit scopes are a very special I'm a bit hesitant to add them. It's currently not possible to save units or armies as event_targets which would be required for it to work. Would it be super useful for a cool feature to have this value exportable?