• 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.
Try a launcher event instead and add its ID inside the events block
Code:
on_game_start_after_lobby = {
    events = {
       EVENT_NAME_ID.1
    }
}
at the end there.

The ID of the event can be anything corresponding to an appropriate namespace.
The code of the event that is used to launch the actual event can be something like :
Code:
EVENT_NAME_ID.1 = {
    type = empty
 
    hidden = yes
 
    immediate = {
        every_player = {
            trigger_event = {
                id = fmaa.0002
                days = { 2 200 }
            }
        }
    }
}
 
Where can i change the dynasty splendor level for the game start ?
I only have defined it in the boomarks but i am still getting this error: [20:20:14][bookmark.cpp:172]: Bookmark character 'temptd_eragon_bm_name_eragon' has invalid dynasty scripted
But my custom character still has my custom dynasty name when i start the game.
 
I can't answer your first question, but the answer to the second is a definitive 'yes':—

...
Do you know how to access this variables from gui? Also do you know how can I access global lists from gui as well?

One more thing does anybody know how to get bool values from gui, I already asked this question but nobody answered.

PS: Am I only one suffering huge amount of game crashes and freezes?
 
I've been searching the forums without any luck regarding the following. Please excuse me if otherwise (and please just direct me to anything related if exists).
I need to work with dead characters. I am assuming the required data to mark a character as dead is the following.
Code:
1065.12.27 = {
        death = "1065.12.27"
    }
Is there any other requirement?

Also, no right click interactions seem to exist for dead characters and I suspect they can't trigger events. Is there any way to work around these limitations with a mod?
I am considering creating a 'dead' copy of characters for this purpose but I would rather work with the original entity if possible.

Thanks in advance.
To mark a character as dead in the history files (for characters that exist before the game begins), that is indeed all you need. You can also add various other things if you want, but they're not necessary.

Code:
1066.10.14 = {
    death = {
        death_reason = death_battle
        killer = 140
    }
}

I've been trying to work with dead characters myself, and they seem entirely immune from any action you can take from them, so working with copies is probably the best you can hope for, unfortunately.

Does anyone know the correct way to limit a trait to only one gender? I rather stupidly thought it would be as follows but it sends the error report into a panic. :rolleyes:
Code:
trait_name = {
    index = 7501
    potential = {
        is_female = no
    }

Should it just be potential = { is_male } ?

ps the error spewed out is:
Error: is_female trigger [ Wrong scope for trigger: none, expected character ]
Not in potential, but just in the root block of the trait:—

Code:
valid_sex = all/male/female # Defaults to all, trait can only be had by characters of this sex

Is there any mod or any vanilla way to cheat "customization points" in the ruler designer?

The mere existence of it makes me not want to play the game as a custom ruler.
Customization points do nothing but block achievements. You can go over the limit without any other incapacitation, and since using a mod will disable achievements anyway, there's no need to cheat the limit in the first place. Go hog wild! :)

Do you know how to access this variables from gui? Also do you know how can I access global lists from gui as well?

One more thing does anybody know how to get bool values from gui, I already asked this question but nobody answered.

PS: Am I only one suffering huge amount of game crashes and freezes?
I'm not entirely sure how to check for specific values from GUIs—honestly, the lack of documentation on how to work with them is quite a hindrance—but if you only need to check for the existence of the global variable, rather than its set value (i.e., if it's only going to be set to a boolean value), you can create a scripted gui that is only visible if the variable is set (it doesn't need to actually display anything, so don't worry about that!), then check for its visibility as a means of checking whether the variable is set.

Code:
# common/scripted_guis/global_variable.txt
mongol_empire_spawned = {
    is_shown = { exists = global_var:mongol_empire_has_spawned }
}

# in your GUI
datacontext = "[GetScriptedGui('mongol_empire_spawned')]"
visible = "[ScriptedGui.IsShown(GuiScope.SetRoot(GetPlayer.MakeScope).End )]"

You should be able to do the same thing in tags other than visible; I'm just using it as an example 'cause that's how I did things in my mod. You might also be able to use this to check for the other boolean values you need, but you'll have to play around with that, 'cause it's beyond my competency at that point.
 
  • 1Like
  • 1Love
Reactions:
I'm not entirely sure how to check for specific values from GUIs—honestly, the lack of documentation on how to work with them is quite a hindrance—but if you only need to check for the existence of the global variable, rather than its set value (i.e., if it's only going to be set to a boolean value), you can create a scripted gui that is only visible if the variable is set (it doesn't need to actually display anything, so don't worry about that!), then check for its visibility as a means of checking whether the variable is set.

Code:
# common/scripted_guis/global_variable.txt
mongol_empire_spawned = {
    is_shown = { exists = global_var:mongol_empire_has_spawned }
}

# in your GUI
datacontext = "[GetScriptedGui('mongol_empire_spawned')]"
visible = "[ScriptedGui.IsShown(GuiScope.SetRoot(GetPlayer.MakeScope).End )]"

You should be able to do the same thing in tags other than visible; I'm just using it as an example 'cause that's how I did things in my mod. You might also be able to use this to check for the other boolean values you need, but you'll have to play around with that, 'cause it's beyond my competency at that point.
You can actually directly check if variable exist in gui and do some more things with them:

Code:
on_start = "[GetVariableSystem.Set('var_name', 'some_value')]" #this should set some value to it, but I not sure what type is that value
on_start = "[GetVariableSystem.Clear('var_name')]" #this should remove this variable
on_start = "[GetVariableSystem.Toggle( 'var_name' )]" #not exactly sure what it does
trigger_when = "[GetVariableSystem.Exists('var_name')]" #this is checking if variable exists and it is returning bool, this might be used, but it is not geting bool value of variable, but rather if variable exists.

text = "GetVariableSystem.Get( 'var_name' )" #this is returing variable as CString, so we cannot get bools this way
trigger_when = "GetVariableSystem.HasValue( 'var_name', 'some_value' )" #From what I understad this is comparing 2 strings values and it is returning bool. This can be used, but for me it is waste of resurces to compare 2 strings
Also this can be used for geting CFixedPoint value from Scope (in this case player character) and converting it comparing to some value and simulating a bool value (1 for true (yes), 0 for false (no)) :
Code:
visible = "[EqualTo_CFixedPoint( GetPlayer.MakeScope.Var( 'acs_sort_by' ).GetValue, '(CFixedPoint)1')]"

But all of this does not solve a problem how to get bool variable directly. Not from global variables, not from scope variables. And getting bool variable directly would be ideal for performance.

About list, for now I know how to get variable list from the scope:
Code:
fixedgridbox = { #other container can be used as well
    datamodel = "[GetPlayer.MakeScope.GetList('var_list_name')]"

    #later for items:
    item = {
       widget_type_name = {
           datacontext = "[Scope.GetCharacter]" // if we had a list of characters

       }
    }
}

But I have no idea how to get global variable list.

PS: If someone is interested how to get scoped typed variable (in this example type of scope is Title) here is a code:

Code:
datacontext = "[Character.MakeScope.Var( 'var_name' ).Title]" #Character is a scope from which this variable is retrieved
onclick = "[DefaultOnCoatOfArmsClick(Title.GetID)]" #usage of this variable
 
  • 1
Reactions:
I've been searching the forums without any luck regarding the following. Please excuse me if otherwise (and please just direct me to anything related if exists).
I need to work with dead characters. I am assuming the required data to mark a character as dead is the following.
Code:
1065.12.27 = {
        death = "1065.12.27"
    }
Is there any other requirement?
You don't actually need to write the date twice, just death = yes works fine. But what you have will work.

As for other things, I'm pretty sure for performance reasons the game stores no more info on dead characters than it needs to, so I suspect trying to make it possible to interact with them won't work, but I haven't tried it.
 
Not sure of it’s the right place to ask, but can anyone explain to me the concept of character pools? ... or point me to some place where I can find info about it? ... in debug mode you have a map with colored character pools ... ok, so what’s up with that?

Another thing: how do cities at barony level work now? ... can they have court members? ... or better: if a female mayor gets some bastards what happens to her kids on succession? ... will everone in court just get wiped out?
 
You can actually directly check if variable exist in gui and do some more things with them:

Code:
on_start = "[GetVariableSystem.Set('var_name', 'some_value')]" #this should set some value to it, but I not sure what type is that value
on_start = "[GetVariableSystem.Clear('var_name')]" #this should remove this variable
on_start = "[GetVariableSystem.Toggle( 'var_name' )]" #not exactly sure what it does
trigger_when = "[GetVariableSystem.Exists('var_name')]" #this is checking if variable exists and it is returning bool, this might be used, but it is not geting bool value of variable, but rather if variable exists.

text = "GetVariableSystem.Get( 'var_name' )" #this is returing variable as CString, so we cannot get bools this way
trigger_when = "GetVariableSystem.HasValue( 'var_name', 'some_value' )" #From what I understad this is comparing 2 strings values and it is returning bool. This can be used, but for me it is waste of resurces to compare 2 strings
Also this can be used for geting CFixedPoint value from Scope (in this case player character) and converting it comparing to some value and simulating a bool value (1 for true (yes), 0 for false (no)) :
Code:
visible = "[EqualTo_CFixedPoint( GetPlayer.MakeScope.Var( 'acs_sort_by' ).GetValue, '(CFixedPoint)1')]"

But all of this does not solve a problem how to get bool variable directly. Not from global variables, not from scope variables. And getting bool variable directly would be ideal for performance.

About list, for now I know how to get variable list from the scope:
Code:
fixedgridbox = { #other container can be used as well
    datamodel = "[GetPlayer.MakeScope.GetList('var_list_name')]"

    #later for items:
    item = {
       widget_type_name = {
           datacontext = "[Scope.GetCharacter]" // if we had a list of characters

       }
    }
}

But I have no idea how to get global variable list.

PS: If someone is interested how to get scoped typed variable (in this example type of scope is Title) here is a code:

Code:
datacontext = "[Character.MakeScope.Var( 'var_name' ).Title]" #Character is a scope from which this variable is retrieved
onclick = "[DefaultOnCoatOfArmsClick(Title.GetID)]" #usage of this variable

This is all really helpful, thanks!

Do you happen to know if there's a way to read character flags in the same way?
 
Not sure of it’s the right place to ask, but can anyone explain to me the concept of character pools? ... or point me to some place where I can find info about it? ... in debug mode you have a map with colored character pools ... ok, so what’s up with that?
The game grabs characters from there for stuff like inviting physicians or knights. Some characters are just generated to fill the pool, but it's also where characters go when they leave courts, if they don't immediately find another court to visit. However there is definitely a lot I don't understand about how it works, it's not very well-documented.
 
  • 1Like
Reactions:
Can anyone verify if they crash while editing a coat of arms and saving the file while the game is running? Before 1.2 there wouldn't be an update in-game, and you wouldn't crash. Now you just crash.
 
A question : I just wanted to make a simple traits like Saoshyant/Saoshyant Descendant(I wanted to make X trait in ruler designer and then my descendants have automatically Y traits from it.), but it wasn't possible with only traits-code. I've read some Saoshyant-related code and it looks like you should make a birth event for it and do something in on_birth_child function, right? Then, should I overwrite all the on_birth_child?

I've made events, common/traits and common/on_action folders and overwritten the whole on_birth_child function code with an additional self-made birth event, but it didn't work. Could someone give me a hint?
 
Last edited:
A question : I just wanted to make a simple traits like Saoshyant/Saoshyant Descendant(I wanted to make X trait in ruler designer and then my descendants have automatically Y traits from it.), but it wasn't possible with only traits-code. I've read some Saoshyant-related code and it looks like you should make a birth event for it and do something in on_birth_child function, right? Then, should I overwrite all the on_birth_child?

I've made events, common/traits and common/on_action folders and overwritten the whole on_birth_child function code with an additional self-made birth event, but it didn't work. Could someone give me a hint?

Ah, nevermind. A small typo found and corrected then it worked.
 
Super beginner question I know, but how do I query a variable on a character? Tried var:myvariable = scope:real_father.myvariable and variations on that but nothing's taken so far. Thanks in advance you bunch of wizards
 
I am trying to find an elegant way to add the innovations from the player's original culture. I am sure this has been done many times already, given the number of people complaining about forgetting innovations when they change.

Should I be using one of these two lines just prior to the conversion lines
Code:
    culture = {save_scope_as = original_culture}
    root:culture = {save_scope_as = original_culture}
and then a line like this afterwards?
Code:
        hidden_effect = {
            get_all_innovations_from = culture:original_culture
        }
 
Super beginner question I know, but how do I query a variable on a character? Tried var:myvariable = scope:real_father.myvariable and variations on that but nothing's taken so far. Thanks in advance you bunch of wizards

I am not completly sure, but did you save real_father as scope? Or are you trying to access variable on real_father property (without checking in effects wiki page I not sure if that is a property). If that is not a scope, bat a property you do not need scope: part.


Best way to test this is to open object explorer, then in drop down menu search for living characters (or even better landing ruler or indenpedentent landed ruler if your character is one of those), then search for character you want to test on. Then click on him. This will open excecution screen. Here you can test lots of stuff. First vertical tab have list of all scopes and scoped list which are result of code you executing. Here you can see if you have real_father scope, after you execute your code. Then you have a triggers, i did not use them. Then you have place to write code and to excecute It. You have 2 options here, parse which will show you effect of code, and run which will execute your code. Parsing will not show you what scopes are updated or what varibles are set, but rather what game are a game effects. Here you try diferent variation of your code to see what is exact way to write something. You can try something like:

Code:
if = {

  limit = {

    real_father.my_variable = var:my_variable

  }

  set_variable = { name = some_name value = some_value}

}
In next 2 section you will find all permanently saved list and variable for that character. You can even change/add/delete them. Here you can check what was the value of your my_variable variable. Also you can check if some_name variable is assigned some_value. When you have that you have found right way to write your condition. If you want see value for my_variable for father character you need to close this screen and reopen it with that other character.

Ps: One more advice, that code executor is not best place for writting code. Write it somewhere else and just copy paste it there.
 
I am trying to find an elegant way to add the innovations from the player's original culture. I am sure this has been done many times already, given the number of people complaining about forgetting innovations when they change.

Should I be using one of these two lines just prior to the conversion lines
Code:
    culture = {save_scope_as = original_culture}
    root:culture = {save_scope_as = original_culture}
and then a line like this afterwards?
Code:
        hidden_effect = {
            get_all_innovations_from = culture:original_culture
        }
It is not root:culture, but root.culture. Also it is not culture:original_culture, but scope:original_culture.
I do not know what is current scope is when you exacuting or what is root scope in your case, so I cannot tell you if you need to use root or not. Also I do not know how get_all_inovation_from, so I cannot tell you if that part is corect. Look at my prev post for idea how to test it.
 
This is all really helpful, thanks!

Do you happen to know if there's a way to read character flags in the same way?
Var function is returning score. Scope does not have, as much as I can see, Exists function. So I am guessing we cannot get it directly. ScopeObjectEditor have some interesting functions, but I do not have ideas how to excess them.

If you really want to use flag it only appears that you can use it with scripted gui. It looks like also that bools are reachable in the same way, which is shame.
1606591877266.png
 
  • 1
Reactions:
I am not completly sure, but did you save real_father as scope? Or are you trying to access variable on real_father property (without checking in effects wiki page I not sure if that is a property). If that is not a scope, bat a property you do not need scope: part.


Best way to test this is to open object explorer, then in drop down menu search for living characters (or even better landing ruler or indenpedentent landed ruler if your character is one of those), then search for character you want to test on. Then click on him. This will open excecution screen. Here you can test lots of stuff. First vertical tab have list of all scopes and scoped list which are result of code you executing. Here you can see if you have real_father scope, after you execute your code. Then you have a triggers, i did not use them. Then you have place to write code and to excecute It. You have 2 options here, parse which will show you effect of code, and run which will execute your code. Parsing will not show you what scopes are updated or what varibles are set, but rather what game are a game effects. Here you try diferent variation of your code to see what is exact way to write something. You can try something like:

Code:
if = {

  limit = {

    real_father.my_variable = var:my_variable

  }

  set_variable = { name = some_name value = some_value}

}
In next 2 section you will find all permanently saved list and variable for that character. You can even change/add/delete them. Here you can check what was the value of your my_variable variable. Also you can check if some_name variable is assigned some_value. When you have that you have found right way to write your condition. If you want see value for my_variable for father character you need to close this screen and reopen it with that other character.

Ps: One more advice, that code executor is not best place for writting code. Write it somewhere else and just copy paste it there.


Used your advice about the object editor to test the code and after some tries got it working. Turns out there is no need to save the scope at all. The below seems to work fine.

Code:
  set_variable = {
                 name = myvariable
                 value = real_father.var:targetvariable
                }
Hope this helps others as well.
 
Can one define custom variables, similar to in HoI 4? I want these bound to a particular realm or its holder character.

More in-depth version: I want to create a stepped modifier that gives some characters characters bonuses or penalties based on the value of an internal value they have. Eg. you get nothing at value 0-20, minor effects at 21-40, large effects at 41+. If I can use a custom variable I think it could be a scripted modifier whose effects depend on the variable in question. Is it doable and is this the right way to do it? (EDIT: to be clear, I prefer discrete stepping over continuous scaling for my particular use case)
 
Last edited: