• 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.
Erm, sorry to bother you fellas.

Can anyone direct me to the localization file where I can change the culture tooltip? The one that shows up when hovering over a character's culture.

I am trying to make a quick mod with some notes to remember.
 
Erm, sorry to bother you fellas.

Can anyone direct me to the localization file where I can change the culture tooltip? The one that shows up when hovering over a character's culture.

I am trying to make a quick mod with some notes to remember.

There's no localization key for that, so I don't know.
 
That is honestly just a mess of conditions. There is no FROM in a normal decision, you cannot scope just randomly with made up conditions and invalid syntax.
Honestly I would recommend you take a look at the wiki especially scripting, scopes, conditions, commands and decisions. It lists pretty much all the valid conditions and scopes to use as well as the effects that can be done along with where they go into decisions for the formatting and what scopes are default.
Sorry if this seems a bit harsh but make sure to use the links I've given so you can make sure to use the correct ones, it is basically a modders life line :D

Ok thanks for pointing that I promise that I wasn't trying to make up conditions, I simply did not understand the scripting language and only had (amateur, not professional) basic C and Objective-C exposure.

So what I gathered is that the "=" sign is not an operator, just a very unintuitive (in my view) to initiate a function or command - this was my major source of confusion - I was treating it like a C-based language.

Most of the logic and syntax this language is done in reverse.. or at least when compared to what I'm used to, which was another source of confusion.

After revising the code, I think I now have the syntax right based on the way conditions are listed. It's a bit odd that the condition is marked as not met, but the decision can be clicked.

Additionally, I think I still have the syntax for copy_name wrong.

Code:
decisions = {
    adopt_patronym = {

        potential = {
            is_female = no
            higher_tier_than = COUNT
        }
       
        allow = {
            primary_title = {
                any_previous_holder = {
                    is_father = ROOT
                }
            }
                custom_tooltip = {
                    text = "Succeed Father's Legacy"
            }
        }
        effect = {
            ROOT = { copy_name = father }
            ROOT = { piety = 100 }
        }
        revoke_allowed = {
            always = no
        }
        ai_will_do = {
            factor = 1
#            modifier = {
#                factor = 0
#            }
        }
    }

}


ck2_1.png ck2_2.png
 
Ok thanks for pointing that I promise that I wasn't trying to make up conditions, I simply did not understand the scripting language and only had (amateur, not professional) basic C and Objective-C exposure.

So what I gathered is that the "=" sign is not an operator, just a very unintuitive (in my view) to initiate a function or command - this was my major source of confusion - I was treating it like a C-based language.

Most of the logic and syntax this language is done in reverse.. or at least when compared to what I'm used to, which was another source of confusion.

After revising the code, I think I now have the syntax right based on the way conditions are listed. It's a bit odd that the condition is marked as not met, but the decision can be clicked.

Additionally, I think I still have the syntax for copy_name wrong.

Code:
decisions = {
    adopt_patronym = {

        potential = {
            is_female = no
            higher_tier_than = COUNT
        }
      
        allow = {
            primary_title = {
                any_previous_holder = {
                    is_father = ROOT
                }
            }
                custom_tooltip = {
                    text = "Succeed Father's Legacy"
            }
        }
        effect = {
            ROOT = { copy_name = father }
            ROOT = { piety = 100 }
        }
        revoke_allowed = {
            always = no
        }
        ai_will_do = {
            factor = 1
#            modifier = {
#                factor = 0
#            }
        }
    }

}


View attachment 265142 View attachment 265143
That is a bit weird that it doesn't show the conditions as being met, but if it works then that is good at least!
As for the effect try father_even_if_dead = { ROOT = { copy_name = PREV } }
Only some scopes work as the right hand side of effects, mostly only THIS, ROOT, FROM, PREV and saved event targets. So you have to scope to one thing then go back to ROOT then use PREV to change based on the things you scoped to if that makes sense.
 
This event is supposed to apply particular modifiers to particular provinces on startup, with a game rule to disable it. It works normally, but when the rule is set to 'off' the game crashes while starting up. What gives?

Game Rule
Code:
american_landmarks = {
    name = "RULE_AMERICAN_LANDMARKS"
    group = "RULE_GROUP_VARIOUS"
    option = {
        name = on
        text = "RULE_OPTION_LANDMARKS"
        desc = "RULE_LANDMARKS_ON_DESC"
    }
    option = {
        name = off
        text = "RULE_OPTION_OFF"
        desc = "RULE_LANDMARKS_OFF_DESC"
    }
}

On Startup
Code:
on_startup = {
    events = {
        landmark.0
    }
}

Event
Code:
namespace = landmark

character_event = {
    id = landmark.0
  
    hide_window = yes
  
    is_triggered_only = yes
  
    only_rulers = yes
  
    trigger = {
        is_ruler = yes
        has_landed_title = k_papal_state
        NOT = { has_global_flag = landmarks_set }
        has_game_rule = {
            name = american_landmarks
            value = on
        }
    }
  
    option = {
        name = OK
        any_independent_ruler  = {
            any_realm_province = {
                province_event = { id = landmark.1 }
            }
        }
        set_global_flag = landmarks_set
    }
}

province_event = {
    id = landmark.1
    title = "Landmark"
    desc = "hidden event"
    picture = GFX_evt_council
    hide_window = yes
    is_triggered_only = yes
    
    trigger = {
        OR = {
            province_id = 383 #Rushmore - Mt. Rushmore
            province_id = 384 #Black Hills - Crazy Horse Memorial
            province_id = 448 #Yellowstone - Yellowstone
        }
    }
  
    option = {
        name = "OK"
    
        if = {
            limit = { province_id = 383 }
            ROOT = {
                add_province_modifier = { name = landmark_rushmore duration = -1 }
            }
        }
        if = {
            limit = { province_id = 384 }
            ROOT = {
                add_province_modifier = { name = landmark_crazy_horse duration = -1 }
            }
        }
        if = {
            limit = { province_id = 448 }
            ROOT = {
                add_province_modifier = { name = landmark_yellowstone duration = -1 }
            }
        }


    }
}
 
How to do arithmetic operations? Specifically:
  • How to calculate the difference between the moral authorities of two religions. For instance if I want to put a condition in an "if" statement which finds the difference between the moral authorities of two religions and executes a set of commands if the difference is greater than a certain value.
  • Is it possible to do arithmetic operations on the right side of a "=" ? For example: society_currency >= 150 - var1
Thanks in advance for help :)
 
This event is supposed to apply particular modifiers to particular provinces on startup, with a game rule to disable it. It works normally, but when the rule is set to 'off' the game crashes while starting up. What gives?

Game Rule
Code:
american_landmarks = {
    name = "RULE_AMERICAN_LANDMARKS"
    group = "RULE_GROUP_VARIOUS"
    option = {
        name = on
        text = "RULE_OPTION_LANDMARKS"
        desc = "RULE_LANDMARKS_ON_DESC"
    }
    option = {
        name = off
        text = "RULE_OPTION_OFF"
        desc = "RULE_LANDMARKS_OFF_DESC"
    }
}

On Startup
Code:
on_startup = {
    events = {
        landmark.0
    }
}

Event
Code:
namespace = landmark

character_event = {
    id = landmark.0
 
    hide_window = yes
 
    is_triggered_only = yes
 
    only_rulers = yes
 
    trigger = {
        is_ruler = yes
        has_landed_title = k_papal_state
        NOT = { has_global_flag = landmarks_set }
        has_game_rule = {
            name = american_landmarks
            value = on
        }
    }
 
    option = {
        name = OK
        any_independent_ruler  = {
            any_realm_province = {
                province_event = { id = landmark.1 }
            }
        }
        set_global_flag = landmarks_set
    }
}

province_event = {
    id = landmark.1
    title = "Landmark"
    desc = "hidden event"
    picture = GFX_evt_council
    hide_window = yes
    is_triggered_only = yes
   
    trigger = {
        OR = {
            province_id = 383 #Rushmore - Mt. Rushmore
            province_id = 384 #Black Hills - Crazy Horse Memorial
            province_id = 448 #Yellowstone - Yellowstone
        }
    }
 
    option = {
        name = "OK"
   
        if = {
            limit = { province_id = 383 }
            ROOT = {
                add_province_modifier = { name = landmark_rushmore duration = -1 }
            }
        }
        if = {
            limit = { province_id = 384 }
            ROOT = {
                add_province_modifier = { name = landmark_crazy_horse duration = -1 }
            }
        }
        if = {
            limit = { province_id = 448 }
            ROOT = {
                add_province_modifier = { name = landmark_yellowstone duration = -1 }
            }
        }


    }
}

Try removing the has_game_rule condition from your event trigger, and instead put it in the on_startup code. Like this:
Code:
on_startup = {
    if = {
        limit = { has_game_rule = { name = american_landmarks value = on } }
        events = {
            landmark.0
        }
    }
}
 
This event is supposed to apply particular modifiers to particular provinces on startup, with a game rule to disable it. It works normally, but when the rule is set to 'off' the game crashes while starting up. What gives?

Game Rule
Code:
american_landmarks = {
    name = "RULE_AMERICAN_LANDMARKS"
    group = "RULE_GROUP_VARIOUS"
    option = {
        name = on
        text = "RULE_OPTION_LANDMARKS"
        desc = "RULE_LANDMARKS_ON_DESC"
    }
    option = {
        name = off
        text = "RULE_OPTION_OFF"
        desc = "RULE_LANDMARKS_OFF_DESC"
    }
}

On Startup
Code:
on_startup = {
    events = {
        landmark.0
    }
}

Event
Code:
namespace = landmark

character_event = {
    id = landmark.0
 
    hide_window = yes
 
    is_triggered_only = yes
 
    only_rulers = yes
 
    trigger = {
        is_ruler = yes
        has_landed_title = k_papal_state
        NOT = { has_global_flag = landmarks_set }
        has_game_rule = {
            name = american_landmarks
            value = on
        }
    }
 
    option = {
        name = OK
        any_independent_ruler  = {
            any_realm_province = {
                province_event = { id = landmark.1 }
            }
        }
        set_global_flag = landmarks_set
    }
}

province_event = {
    id = landmark.1
    title = "Landmark"
    desc = "hidden event"
    picture = GFX_evt_council
    hide_window = yes
    is_triggered_only = yes
  
    trigger = {
        OR = {
            province_id = 383 #Rushmore - Mt. Rushmore
            province_id = 384 #Black Hills - Crazy Horse Memorial
            province_id = 448 #Yellowstone - Yellowstone
        }
    }
 
    option = {
        name = "OK"
  
        if = {
            limit = { province_id = 383 }
            ROOT = {
                add_province_modifier = { name = landmark_rushmore duration = -1 }
            }
        }
        if = {
            limit = { province_id = 384 }
            ROOT = {
                add_province_modifier = { name = landmark_crazy_horse duration = -1 }
            }
        }
        if = {
            limit = { province_id = 448 }
            ROOT = {
                add_province_modifier = { name = landmark_yellowstone duration = -1 }
            }
        }


    }
}

Looks good, but maybe there's some side effect of the game rule that triggers buggy script in another place ?
Try checking for other errors.log, exceptions.log and run the validator on your mod.

Note that you should do this more simply in a single event:
Code:
namespace = landmark

character_event = {
    id = landmark.0
    hide_window = yes
    is_triggered_only = yes
 
    only_rulers = yes
 
    trigger = {
        has_landed_title = k_papal_state
        NOT = { has_global_flag = landmarks_set }
        has_game_rule = {
            name = american_landmarks
            value = on
        }
    }
 
    option = {
        383 = {
          add_province_modifier = { name = landmark_rushmore duration = -1 }
        }
        384 = {
          add_province_modifier = { name = landmark_crazy_horse duration = -1 }
        }
        448 = {
          add_province_modifier = { name = landmark_yellowstone duration = -1 }
        }
        set_global_flag = landmarks_set
    }
}

Try removing the has_game_rule condition from your event trigger, and instead put it in the on_startup code. Like this:
Code:
on_startup = {
    if = {
        limit = { has_game_rule = { name = american_landmarks value = on } }
        events = {
            landmark.0
        }
    }
}

Scripting won't work in on_actions files.
 
How to do arithmetic operations? Specifically:
  • How to calculate the difference between the moral authorities of two religions. For instance if I want to put a condition in an "if" statement which finds the difference between the moral authorities of two religions and executes a set of commands if the difference is greater than a certain value.
  • Is it possible to do arithmetic operations on the right side of a "=" ? For example: society_currency >= 150 - var1
Thanks in advance for help :)
1) Best way I could imagine you doing it is exporting the two moral authorities to variables, find the difference, ensure the difference is a positive number, then using that number to as a checked variable.
2) Not in that way, as of the DD Meneth did a bit back in the next patch you can use variables as the right hand side of an effect. So you would be able to set a variable as 150, subtract your variable from that number, then use that number as the right hand side of the effect and if it works as a condition use it as that.
 
1) Best way I could imagine you doing it is exporting the two moral authorities to variables, find the difference, ensure the difference is a positive number, then using that number to as a checked variable.
2) Not in that way, as of the DD Meneth did a bit back in the next patch you can use variables as the right hand side of an effect. So you would be able to set a variable as 150, subtract your variable from that number, then use that number as the right hand side of the effect and if it works as a condition use it as that.
Thank you. What is the code for finding the difference between two variables?
 
Looks good, but maybe there's some side effect of the game rule that triggers buggy script in another place ?
Try checking for other errors.log, exceptions.log and run the validator on your mod.

Note that you should do this more simply in a single event:
Code:
namespace = landmark

character_event = {
    id = landmark.0
    hide_window = yes
    is_triggered_only = yes
 
    only_rulers = yes
 
    trigger = {
        has_landed_title = k_papal_state
        NOT = { has_global_flag = landmarks_set }
        has_game_rule = {
            name = american_landmarks
            value = on
        }
    }
 
    option = {
        383 = {
          add_province_modifier = { name = landmark_rushmore duration = -1 }
        }
        384 = {
          add_province_modifier = { name = landmark_crazy_horse duration = -1 }
        }
        448 = {
          add_province_modifier = { name = landmark_yellowstone duration = -1 }
        }
        set_global_flag = landmarks_set
    }
}



Scripting won't work in on_actions files.

That shorter event works fine, but setting the rule to 'off' still causes a crash on startup. I can't find any errors using the logs/validator.
 
Thank you. What is the code for finding the difference between two variables?
Just subtract the variables from each other and if the value is negative multiply by -1 to make sure it is a positive number for your further checks with something like:
Code:
change_variable = { which = "var1" which = "var2" }
if = { 
    limit = { 
        NOT = { check_variable = { which = "var1" value = 0 } }
    }
    multiply_variable = { which = "var1" value = -1 }
}
 
Is there a quick way to check if a province is a holy site of a character's secret religion? For example, for public religion "is_holy_site = ROOT" would work if ROOT is a character. Would something like this work for secret religion:
Code:
    ROOT = {
        secret_religion_scope = {
            save_event_target_as = ROOTs_secret_religion
        }
    }
    event_target:target_province = {
        OR = {
                is_holy_site = event_target:ROOTs_secret_religion
                any_de_jure_vassal_title = {
                    is_holy_site = event_target:ROOTs_secret_religion
                }
         }
     }

It is based on the following line from the latest patch's changelog:
- Added religion_scope, secret_religion_scope, true_religion_scope, and culture_scope as scopes. These scope to the religion/culture of the character/province/society (only religion for societies) currently scoped to. Can be saved as event targets
 
Last edited:
That is a bit weird that it doesn't show the conditions as being met, but if it works then that is good at least!
As for the effect try father_even_if_dead = { ROOT = { copy_name = PREV } }
Only some scopes work as the right hand side of effects, mostly only THIS, ROOT, FROM, PREV and saved event targets. So you have to scope to one thing then go back to ROOT then use PREV to change based on the things you scoped to if that makes sense.

Ok great, I think i'm understanding the script languge logic much better now.

So I scoped it to the father then try to copy_name = THIS, which seems correct based on the samples I can find, but it's not working; it is still trying to copy his own name. This remains the case whether i do PREV or PREVPREV, even though PREVPREV should be invalid as that goes beyond ROOT i believe.

I suspect this is something to do with the fact that the condition is listed as not being met, even though the decision is enabled.

Can anyone help take a look?

EDIT: can anyone also help me with creating a line-break in the effect description for OCD's sake? (see screenshot)

Code:
decisions = {
    adopt_patronym = {

        potential = {
            is_female = no
            higher_tier_than = COUNT
        }
     
        allow = {
            primary_title = {
                any_previous_holder = {
                    is_father = ROOT
                }
            }
                custom_tooltip = {
                    text = "Succeed Father's Legacy"
            }
        }
        effect = {
            father_even_if_dead = {
                ROOT = { copy_name = THIS }
            }
#            custom_tooltip = { text = "" }
            ROOT = { piety = 100 }
        }
        revoke_allowed = {
            always = no
        }
        ai_will_do = {
            factor = 1
#            modifier = {
#                factor = 0
#            }
        }
    }

}

ck2_3.png
 
Last edited:
Ok great, I think i'm understanding the script languge logic much better now.

So I scoped it to the father then try to copy_name = THIS, which seems correct based on the samples I can find, but it's not working; it is still trying to copy his own name.

I suspect this is something to do with the fact that the condition is listed as not being met, even though the decision is enabled.

Can anyone help take a look?

EDIT: can anyone also help me with creating a line-break in the effect description for OCD's sake? (see screenshot)

Code:
decisions = {
    adopt_patronym = {

        potential = {
            is_female = no
            higher_tier_than = COUNT
        }
     
        allow = {
            primary_title = {
                any_previous_holder = {
                    is_father = ROOT
                }
            }
                custom_tooltip = {
                    text = "Succeed Father's Legacy"
            }
        }
        effect = {
            father_even_if_dead = {
                ROOT = { copy_name = THIS }
            }
#            custom_tooltip = { text = "" }
            ROOT = { piety = 100 }
        }
        revoke_allowed = {
            always = no
        }
        ai_will_do = {
            factor = 1
#            modifier = {
#                factor = 0
#            }
        }
    }

}

View attachment 265227
THIS scopes to the currently scoped character, you would want to do as I said and use PREV as it scopes back one thing so in your example it scopes back to father_even_if_dead.
I imagine the issue with their not being a line break is due to the base game itself not using the copy name function so it had not been tested to see the localisation it gives out, a bug report for that would be a good idea if you can get it to be a repeatable simple issue and then provide a test decision to show it.
 
Is there any way to control how aggressive the AI is in the way it handles armies? Normally the AI always makes armies avoid battling larger forces, even if modifiers allow that smaller army to be stronger than the bigger army.
 
Can anyone tell me what i did wrong? I startet to create a small new map but if i start the game it looks like in the screenshot.
20170513235703_1.jpg


Would be great if anyone can tell me how to fix this mess.
 

Attachments

  • colormap.png
    colormap.png
    2,8 KB · Views: 3
  • colormap_water.png
    colormap_water.png
    3 KB · Views: 3
  • provinces.png
    provinces.png
    5,6 KB · Views: 3
  • rivers.png
    rivers.png
    4,9 KB · Views: 3
  • terrain.png
    terrain.png
    6 KB · Views: 4
  • topology.png
    topology.png
    2,5 KB · Views: 4
  • trees.png
    trees.png
    607 bytes · Views: 4
  • world_normal_height.png
    world_normal_height.png
    1 KB · Views: 2