• 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.
Showing developer posts only. Show all posts in this thread.
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 }
}
 
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.
 
A change what made to the game to force all courtiers to be generated with a dynasty if they are in the history files if I remember correctly.
You have to do effect = { dynasty = none } on their birth I believe to have the game force them to be lowborn
 
For long-term cleanliness sake, if you use this method does the random dynasty get generated anyway, just that the new member gets overwritten as lowborn?

I ask because the save file would still then be burdened with unused dynasties, a pet peeve of mine when I started editing save files.
Yep, however as far as I know it is the only way unless you define all your lowborns with the same dynasty then on startup overwrite that dynasty by scoping to one of them and doing any_dynasty_member_even_if_dead and making them lowborn. That should mean you only end up with one extra dynasty but not sure if that is worse for the game engine to scope to all lowborns at the start of every game.
Although it would be better to have Paradox just fix dynasty=0 not working to make people lowborn again.
 
Where do I define the end game year?
Might just be missing it, but I didn't see an option for it in defines.lua and my mod's custom timeline passes far beyond the vanilla end year (2100).
Everything else is set up for the game to start in that year properly, but naturally the game ends just as soon as it starts.
In the common folder the defines.txt file
 
Thanks.

--------


I'm presuming the naming conventions are hardcoded? For example, I wouldn't be able to switch surname and first name around as is done in many eastern cultures, at least in display?
You might be able to mess with some of it localisation wise but probably not all
 
Is the weight/factor for AI deciding whether or not to use matrilineal marriage moddable?

I'm thinking of desiging a mod where if the realm has Enatic or Enatic-Cognatic succession, they would only accept matrilineal marriages, otherwise I realize the AI would just quickly switch out dynasties.
Nope, the best you can do is maintenance events on marriage or betrothal to cancel dumb marriages the ai makes.
 
Wondering if there is there a way to modify the cost and/or upkeep of a specific mercenary company during gameplay, such as through an event? Haven't seen anything outside of globally changing the costs via defines, so I'm curious if there is a way or if it's something we can't mess with.
Not sure. I am leaning towards a no.
I know you can have set_mercenary_maintenance_modifier = defined_static_modifier but I am pretty sure all that does is increase the cost for hosting a dynamic merc company. So no I don't think you can change anything, best you could do is have an event which gives the person using the merc company money back but even then I don't think there are any scopes or conditions for that anyway
 
So when factors stack, what is the result? Does that mean two factors of 0.5 equals 1.0? Or is this some kind of funky math where it's like 0.75?
They are factors so you multiply them.
If you have a base chance of 1, and two factors of 0.5 that the conditions are met for your end product is 1 * 0.5 * 0.5 = 0.25
 
Quick question: does anybody know what the common/stories folder is about? There is just one file in the folder, alpha_story.txt ... something about John Lackland. Seems interesting, I want to know more ...
Pretty sure it is some super old defunct thing way back during the alpha (obviously) stages of the game. Doesn't actually do anything now
 
Does anyone know if the game rules provincial_revolts and provincial_revolt_strength have hard-coded response or if they are things we can mess around with? It looks like the only reference to them is in 00_game_rules.txt.
Not sure about the first but the second one is referenced in the event files for old gods rebel events and scales the strength or the troops
 
Can you use character ID as a variable? Like I want to set a character flag by pulling a value from another's id.
I'd also like to use it here is it possible and what would the code be?
Code:
trait = {
    is_visible = {
        OR = {
            character = FROM
            sire = {
                has_character_flag = { (value = from.getcharacterid) }
            }
        }
    }
You ca but not like your script. Firstly sire is not a scope, has_character_flag = flag is the correct form, normal brackets () are not used in the script, you can't change scopes using dots except in localisation, you can't use a command inside a condition and getcharacerid is not a valid command or condition itself.
In CK2 terms a variable is something you define dynamically and modify using set_variable and change_variable etc.
You can use dynamic flags by doing set_character_flag = can_see_trait_@FROM which will save a flag as can_see_trait_123 for a character with the ID 123. You would then check that with has_character_flag = can_see_trait_@FROM as a condition for scope which I assume you mean liege or father.
But if you are doing that then there are conditions to check those relationships regardless without needing to use dynamic flags.
 
Thanks for telling me about the dynamic flags, is there somewhere that I can read more about them?

I put it into the code and it doesn't show up unfortunately, is this code right?

any_realm_character = {
has_character_flag = can_see_trait_@FROM
}
That would work, you still also need to actually set that flag somewhere though. What are you using this for? There are generally better ways of scoping to certain people than using dynamic flags as your example was about their sire
 
What happens when a character dies ? More specifically, I assume that all flags, modifiers and variables (eg Wealth, Prestige etc) are removed or zeroed, but is it possible to add them back again via a decision or event ?

What I am trying to do is add a decision on any recently deceased character (date of death less than 12 months before the present) that allows the player to give them a proper funeral. The effect would be to put an opaque overlay over the character's portrait of various funeral plots (eg grave, tomb, mausoleum, monument) and give the plot builder some sort of Piety or Prestige boost in return for some fixed Gold cost.

a) Can an event or decision refer to a dead character ?
b) How hard is it to make custom portrait overlays ?
a) Refer to yes. But dead people cannot be right clicked to target for a decision.
b) Never tried personally

For a funeral event your best bet is to launch an event to their liege or whoever you want to have the funeral using the on death on action and allow the funeral events to be started from there.