• 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.
Is there a way to give someone a "fake title"? So that I could make "John" appear as "Lord John" for example? I tried giving my Courtier a Titular Title, but they just automatically gave it back to their Liege for some reason, and although minor_titles show up in the tool-tip and sub-bar, the title does not appear in their actual name (which I thought is what "show_as_title = yes" was meant to do?)
You can use a special character title, use the command set_special_character_title = <LOC_KEY> on them and make sure you have localised your special title and it will appear in front of their name. In vanilla it is used for the Horse Lords decision to take the title of Genghis Khan
 
Anyone know why custom governments only come up as Anarchy? This issue persists even when the government in question is a simple copy-pasta of a Vanilla Government. Custom frames, icon, colour and name all work however.
Have you modified the government flavour file to take into account any changes you have made to religions, laws, succession etc?
 
Is there a way to remove a C_Title from existence during game?

I have a special County Title used to give a character a special flag (primary = yes); but when the Character loses all their Titles, an even kills them, and runs "destroy_landed_title", followed by "active = no", but for some reason the Title is still existing and active, and gets randomly given to a Courtless, Liegeless character.
You cannot destroy a county title or deactivate it, make your special into a duke tier one. Or if you don't actually need them to have the title to be playable give them a special character title instead which will overwrite their name regardless of if they have land or not and can be cleared easily.
 
Is there a way to condition for "any" character flag, even if I do not know which flag I am looking for? I'm trying to make my event ignore any character who starts the game with a Character Flag, since they're most likely "Special" in some way.
You can only check for the presence of lack of presence of a specific character flag, there is no way to check if a character has any flag at all.
 
Doesn't seem to be a Command for it, but are there any ways to clear the Messages part of the Outliner? My Mod causes several hundred to be presented in both high and low priority (as characters move in and out of your Court on start-up : apparently losing their titles causes them to default to come to me), and I'd like to wipe it at the end of the Event just for neatness.
I do not believe so no
 
Hey! Does anybody know if its possible to scope to a maximum amount of characters inside an any_ scope? (e.g. I want to scope to all vassals with a specific religion up to a maximum of 5 )
I tried doing it by using 5 random_vassal scopes, however it can happen that it scopes to the same character multiple times then (I think).
Any ideas ?
Upon scoping to someone through the random_scope just set a character flag then check for the next random_scope to not have that character flag is a quick way to fix it up for what you tried
 
Is there any way of adding a truce as an effect? I didn't find any mention of it on the wiki.
I don't believe so, you can do it through an opinion modifier then block wars from being declared if you have that modifier or do a penalty if you declare with it. Could also start then end a war instantly but that would give pop ups saying so.
But there is no command to start a truce though as far as I remember.
 
There is, actually.

Code:
ROOT = {
               set_truce = {
                   who = FROM
                   years = 5
               }
}
In the above case, ROOT would have a truce, and would not be able to attack FROM for five years.
Wait that actually works? When did that command get added? Can't see a mention of it on the wiki although checking the exe it does in fact seem to be a command. Also can see it in some stuff from vanilla, can't believe I missed that :(
 
Why doesn't this code work? I think it should work but the event target is not actually saved (I checked in the savefile).
Code:
    immediate = {
        ROOT = {
            save_event_target_as = target_father
        }
    }
The code also doesn't work if I replace ROOT with father. Any way to solve this?
That should work, you would need to post more of your code so we can tell
 
Code:
    player_event=
    {
        id=2
        event="38205"
        days=0
        scope=
        {
            char=1000364842
            seed=1299624477
            from=
            {
                char=1000383208
                seed=241852
                root=
                {
                    char=1000364842
                    seed=241852
                    from=
                    {
                        char=1000383208
                        seed=241852
                        root=
                        {
                            char=1000364842
                            seed=241852
                            from=
                            {
                                char=1000383208
                                seed=241852
                                saved_event_target=
                                {
                                    char=1000364842
                                    name="target_father"
                                }
                            }
                        }
                        saved_event_target=
                        {
                            char=1000364842
                            name="target_father"
                        }
                    }
                }
                saved_event_target=
                {
                    char=1000364842
                    name="target_father"
                }
            }
        }
        primary=yes
    }
Okay, I solved it, but now I have another problem.
Code:
    option = {
        name = EVTOPTD38205 # I killed her!
        trigger = {
            FROM = {
                mother = {
                    killer = event_target:target_father
                    has_nickname = nick_the_unfaithful
                }
            }
        }
        ai_chance = {
            factor = 10
            modifier = {
                factor = 4
                trait = cruel
            }
            modifier = {
                factor = 2
                trait = zealous
            }
        }     
        random_list = {
            99 = {    FROM = { add_trait = depressed }
        }
    }
Something went wrong in this code and I can't get this option to appear. I am 1000000% sure I have killed the mother and she has the nickname the unfaithful. How do I solve this?
You would need to use mother_even_if_dead as she is dead to get it to work
 
I dont know if you read my original post, but there lies the problem, when I used 39601 on him, instead of him getting the event to convert to orthodox, like me and the court priest, he gets the event asking if he will convert to slavic, the religion he already is.
The scoping is probably messed up, the event likely includes something like religion = FROM to set the characters religion to the person who sent that event. If you trigger it from the console then there is no FROM as no event sent it so it defaults to FROM being ROOT which means that religion = FROM has the effect of doing religion = ROOT so his religion gets set to his current religion.
 
How do I correctly operate on a character's property/variables?

I'm trying to create a decision for rulers to adopt their father's name, but using the code below the condition fails to work correctly, and the displayed/expected results failed to identify father's name.

Code:
decisions = {
    adopt_patronym= {

        potential = {
            is_female = no
            higher_tier_than = COUNT
        }
      
        allow = {
            FROM = {
                name = {
                    NOT = { father_even_if_dead = name }
                }
            }
            custom_tooltip = {
                text = "Take Father's Name"
            }
        }
        effect = {
            set_name = {
                father_even_if_dead = name
            }
          
            FROM = { piety = +100 }
        }
      
        revoke_allowed = {
            always = no
        }
        ai_will_do = {
            factor = 1
#            modifier = {
#                factor = 0
#                }
#            }
        }
    }

}

This remains the case even if I change father_even_if_dead to father.
"name" is not a condition or a scope.
set_name also does not take a scope either. set_name sets their name to be an exact string. You would need to use copy_name = <scope>
The + in +1000 piety is unnecessary, all values are taken as positive unless a minus is specified or the effect itself applies the values as a negative number.
I don't believe there is actually a way to check if a character has the same name as someone so you might be out of luck here unless you don't mind the decision appearing for someone who has the same name as their father.
 
Thanks! I'm still wrapping my head around the structure of how things work.

So this is what I have right now, I'm changing the condition to try to check if the ruler's primary title matches that of his father's before trying to adopt his father's name.

Neither the title check nor the copy name part works. The decision is enabled, but the mouseover seems to be matching "_ _ _" as the title, and the character's name remains unchanged.

Code:
decisions = {
    adopt_patronym = {

        potential = {
            is_female = no
            higher_tier_than = COUNT
        }
      
        allow = {
            FROM = {
                father = {
                    title = { #Condition?
                        FROM = primary_title #Scope?
                    }
                }
            }
            custom_tooltip = {
                text = "Take Father's Name"
            }
        }
        effect = {
            copy_name = father
            FROM = { piety = 100 }
        }
      
        revoke_allowed = {
            always = no
        }
        ai_will_do = {
            factor = 1
#            modifier = {
#                factor = 0
#                }
#            }
        }
    }

}
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
#            }
        }
    }

}


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.
 
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.