Modding quick questions and answers!

Modding quick questions and answers!

  • Hello Everyone, Today we've upgraded to the latest version of our forum software, bringing more features and better performance to the community. As always, we appreciate your bug reports and feedback, and you can post all of that here, as well as view the list of new features
  • Crusader Kings III Available Now!

    The realm rejoices as Paradox Interactive announces the launch of Crusader Kings III, the latest entry in the publisher’s grand strategy role-playing game franchise. Advisors may now jockey for positions of influence and adversaries should save their schemes for another day, because on this day Crusader Kings III can be purchased on Steam, the Paradox Store, and other major online retailers.


    Real Strategy Requires Cunning

Mixael

Private
53 Badges
Jun 26, 2015
13
0
  • Cities in Motion 2
  • Stellaris - Path to Destruction bundle
  • Cities: Skylines - After Dark
  • Victoria 2: A House Divided
  • Sword of the Stars II
  • Sengoku
  • Semper Fi
  • Europa Universalis IV: Res Publica
  • Magicka
  • Knights of Pen and Paper +1 Edition
  • Impire
  • Hearts of Iron III
  • For the Motherland
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Art of War
  • Hearts of Iron III: Their Finest Hour
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II
  • Stellaris: Leviathans Story Pack
  • Prison Architect
  • Cities: Skylines - Mass Transit
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis 4: Emperor
  • Age of Wonders III
  • Cities: Skylines - Green Cities
  • Crusader Kings III
  • Stellaris: Apocalypse
  • Europa Universalis IV: Rule Britannia
  • Cities: Skylines - Parklife Pre-Order
  • Cities: Skylines - Parklife
  • Europa Universalis IV: Dharma
  • Europa Universalis IV: Golden Century
  • Europa Universalis IV: Rights of Man
  • Victoria 2
  • War of the Roses
  • Cities: Skylines
  • Europa Universalis IV: El Dorado
  • Magicka: Wizard Wars Founder Wizard
  • Crusader Kings II: Way of Life
  • Pillars of Eternity
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Mare Nostrum
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Third Rome
I can't answer your first question, but the answer to the second is a definitive 'yes':—

Code:
# set global variable
set_global_variable = {
    name = mongol_empire_has_spawned
    value = yes
}

# to check for it in a trigger
exists = global_var:mongol_empire_has_spawned

You can also save things other than a boolean as the value, such as a scope or a flag:—

Code:
# set global variable as a character
set_global_variable = {
    name = ruler_of_ganges
    value = root
}

if = {
    # to check for it in a trigger…
    limit = {
        exists = global_var:ruler_of_ganges
        global_var:ruler_of_ganges = {
            is_alive = yes
        }
    }

    # …and do something with him!
    global_var:ruler_of_ganges = {
        trigger_event = {
            id = south_asia.0013 #Someone else has taken my title
            days = 3
        }
    }
}

These are all adapted from vanilla code, just to give you examples.
Ah I see, I always searched the files for "global_flag", should have just gone with global. Thanks!
 

RashHellstorm

Recruit
25 Badges
Oct 26, 2013
2
0
  • Pillars of Eternity
  • Crusader Kings III
  • Prison Architect
  • Crusader Kings II: Holy Fury
  • Shadowrun: Dragonfall
  • Crusader Kings II: Jade Dragon
  • Stellaris - Path to Destruction bundle
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Reapers Due
  • Hearts of Iron IV: Cadet
  • Stellaris
  • Crusader Kings II: Conclave
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Way of Life
  • Magicka
  • 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
  • Crusader Kings II: Charlemagne
  • Crusader Kings II
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.
 

Mixael

Private
53 Badges
Jun 26, 2015
13
0
  • Cities in Motion 2
  • Stellaris - Path to Destruction bundle
  • Cities: Skylines - After Dark
  • Victoria 2: A House Divided
  • Sword of the Stars II
  • Sengoku
  • Semper Fi
  • Europa Universalis IV: Res Publica
  • Magicka
  • Knights of Pen and Paper +1 Edition
  • Impire
  • Hearts of Iron III
  • For the Motherland
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Art of War
  • Hearts of Iron III: Their Finest Hour
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II
  • Stellaris: Leviathans Story Pack
  • Prison Architect
  • Cities: Skylines - Mass Transit
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis 4: Emperor
  • Age of Wonders III
  • Cities: Skylines - Green Cities
  • Crusader Kings III
  • Stellaris: Apocalypse
  • Europa Universalis IV: Rule Britannia
  • Cities: Skylines - Parklife Pre-Order
  • Cities: Skylines - Parklife
  • Europa Universalis IV: Dharma
  • Europa Universalis IV: Golden Century
  • Europa Universalis IV: Rights of Man
  • Victoria 2
  • War of the Roses
  • Cities: Skylines
  • Europa Universalis IV: El Dorado
  • Magicka: Wizard Wars Founder Wizard
  • Crusader Kings II: Way of Life
  • Pillars of Eternity
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Mare Nostrum
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Third Rome
How do I get an event to trigger for every player or the host player on game start? It seems simple enough to do but I just can't get it to work.

Code:
on_game_start = {
    effect = {
        root = {
            trigger_event = {
                id = fmaa.0002
                days = { 2 200 }
            }
        }
    }
}

I'm guessing that root isn't correct here, but nothing else I've tried works.
 

YTnuBF

First Lieutenant
66 Badges
Apr 5, 2014
229
95
  • Victoria 2: A House Divided
  • Hearts of Iron III: Their Finest Hour
  • Heir to the Throne
  • Magicka
  • Majesty 2
  • March of the Eagles
  • Victoria: Revolutions
  • Semper Fi
  • Sengoku
  • Sword of the Stars II
  • Europa Universalis IV: Res Publica
  • Victoria 2: Heart of Darkness
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV: Pre-order
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Cossacks
  • Cities: Skylines - Snowfall
  • Europa Universalis IV: Mare Nostrum
  • Stellaris
  • Knights of Honor
  • Crusader Kings II: Sons of Abraham
  • Cities in Motion 2
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Hearts of Iron III
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Europa Universalis IV: Art of War
  • For the Motherland
  • For The Glory
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Divine Wind
  • Europa Universalis III
  • Darkest Hour
  • Crusader Kings II: Way of Life
  • Pillars of Eternity
  • Europa Universalis IV: Common Sense
  • Crusader Kings III
  • Victoria 2
  • Crusader Kings II: Conclave
  • Europa Universalis III: Collection
  • Cities: Skylines
  • Crusader Kings II: Reapers Due
  • Stellaris: Digital Anniversary Edition
How do I get an event to trigger for every player or the host player on game start? It seems simple enough to do but I just can't get it to work.

Code:
on_game_start = {
    effect = {
        root = {
            trigger_event = {
                id = fmaa.0002
                days = { 2 200 }
            }
        }
    }
}

I'm guessing that root isn't correct here, but nothing else I've tried works.

Did you already try using the next on_action block in that same file, called on_game_start_after_lobby = { } ?

The description says that it's "Like on_game_start, except it is called once the host (or player, in single player) exits the lobby..."

Also you might need to change root into every_player.
 

Thomas_Oak

Captain
8 Badges
May 11, 2018
432
510
  • Crusader Kings II
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Sons of Abraham
  • Warlock: Master of the Arcane
  • Crusader Kings II: Way of Life
  • Pillars of Eternity
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings III
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 ]
 

yoloswag6969

Corporal
12 Badges
Apr 10, 2014
39
45
  • Crusader Kings II
  • War of the Roses
  • Magicka: Wizard Wars Founder Wizard
  • Pillars of Eternity
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Together for Victory
  • Hearts of Iron IV: Death or Dishonor
  • Hearts of Iron IV: Expansion Pass
  • Hearts of Iron IV: Expansion Pass
  • Crusader Kings III
  • Europa Universalis III
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.
 

Mixael

Private
53 Badges
Jun 26, 2015
13
0
  • Cities in Motion 2
  • Stellaris - Path to Destruction bundle
  • Cities: Skylines - After Dark
  • Victoria 2: A House Divided
  • Sword of the Stars II
  • Sengoku
  • Semper Fi
  • Europa Universalis IV: Res Publica
  • Magicka
  • Knights of Pen and Paper +1 Edition
  • Impire
  • Hearts of Iron III
  • For the Motherland
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Art of War
  • Hearts of Iron III: Their Finest Hour
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II
  • Stellaris: Leviathans Story Pack
  • Prison Architect
  • Cities: Skylines - Mass Transit
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis 4: Emperor
  • Age of Wonders III
  • Cities: Skylines - Green Cities
  • Crusader Kings III
  • Stellaris: Apocalypse
  • Europa Universalis IV: Rule Britannia
  • Cities: Skylines - Parklife Pre-Order
  • Cities: Skylines - Parklife
  • Europa Universalis IV: Dharma
  • Europa Universalis IV: Golden Century
  • Europa Universalis IV: Rights of Man
  • Victoria 2
  • War of the Roses
  • Cities: Skylines
  • Europa Universalis IV: El Dorado
  • Magicka: Wizard Wars Founder Wizard
  • Crusader Kings II: Way of Life
  • Pillars of Eternity
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Mare Nostrum
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Third Rome
Did you already try using the next on_action block in that same file, called on_game_start_after_lobby = { } ?

The description says that it's "Like on_game_start, except it is called once the host (or player, in single player) exits the lobby..."

Also you might need to change root into every_player.
Didn't think of that, but sadly doesn't work either. Tried every_player already, now with the after_lobby too, but nope.
 

YTnuBF

First Lieutenant
66 Badges
Apr 5, 2014
229
95
  • Victoria 2: A House Divided
  • Hearts of Iron III: Their Finest Hour
  • Heir to the Throne
  • Magicka
  • Majesty 2
  • March of the Eagles
  • Victoria: Revolutions
  • Semper Fi
  • Sengoku
  • Sword of the Stars II
  • Europa Universalis IV: Res Publica
  • Victoria 2: Heart of Darkness
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV: Pre-order
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Cossacks
  • Cities: Skylines - Snowfall
  • Europa Universalis IV: Mare Nostrum
  • Stellaris
  • Knights of Honor
  • Crusader Kings II: Sons of Abraham
  • Cities in Motion 2
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Hearts of Iron III
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Europa Universalis IV: Art of War
  • For the Motherland
  • For The Glory
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Divine Wind
  • Europa Universalis III
  • Darkest Hour
  • Crusader Kings II: Way of Life
  • Pillars of Eternity
  • Europa Universalis IV: Common Sense
  • Crusader Kings III
  • Victoria 2
  • Crusader Kings II: Conclave
  • Europa Universalis III: Collection
  • Cities: Skylines
  • Crusader Kings II: Reapers Due
  • Stellaris: Digital Anniversary Edition
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 }
            }
        }
    }
}
 

Abcunbekannt75

Private
1 Badges
Nov 14, 2020
11
0
  • Crusader Kings II: The Old Gods
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.
 

Vasoli

Corporal
48 Badges
Mar 21, 2015
30
15
  • Cities in Motion
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Semper Fi
  • Victoria: Revolutions
  • Europa Universalis IV: Res Publica
  • Magicka
  • Hearts of Iron III
  • For the Motherland
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis III
  • Europa Universalis IV: Art of War
  • Crusader Kings II
  • Crusader Kings II: Horse Lords
  • Crusader Kings III: Royal Edition
  • Cities: Skylines - After Dark
  • Crusader Kings II: Conclave
  • Cities: Skylines - Snowfall
  • Hearts of Iron IV Sign-up
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Cities: Skylines - Natural Disasters
  • Hearts of Iron IV: Together for Victory
  • Hearts of Iron IV: Death or Dishonor
  • Crusader Kings II: Jade Dragon
  • Cities: Skylines - Parklife Pre-Order
  • Cities: Skylines - Parklife
  • Crusader Kings II: Holy Fury
  • Crusader Kings III
  • Crusader Kings II: Charlemagne
  • 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
  • Cities: Skylines
  • Rome Gold
  • Pillars of Eternity
  • Victoria 2
  • Rome: Vae Victis
  • Europa Universalis IV: El Dorado
  • Crusader Kings II: Way of Life
  • Stellaris
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?
 

Anyasia

Lightbringer
60 Badges
Aug 5, 2015
165
56
  • Crusader Kings II
  • Europa Universalis IV: Cossacks
  • The Showdown Effect
  • Victoria 2
  • Warlock: Master of the Arcane
  • War of the Roses
  • Cities: Skylines
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV: Pre-order
  • Magicka: Wizard Wars Founder Wizard
  • Pride of Nations
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Horse Lords
  • Starvoid
  • Crusader Kings II: Conclave
  • Europa Universalis IV: Mare Nostrum
  • Hearts of Iron IV Sign-up
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Rights of Man
  • Crusader Kings II: Monks and Mystics
  • Europa Universalis IV: Mandate of Heaven
  • Crusader Kings Complete
  • Europa Universalis IV: Third Rome
  • Age of Wonders III
  • Europa Universalis IV: Cradle of Civilization
  • Europa Universalis III
  • Arsenal of Democracy
  • Cities in Motion 2
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings III
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Commander: Conquest of the Americas
  • Darkest Hour
  • Teleglitch: Die More Edition
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Wealth of Nations
  • Gettysburg
  • Leviathan: Warships
  • The Kings Crusade
  • Majesty 2
  • March of the Eagles
  • Naval War: Arctic Circle
  • Europa Universalis IV: Res Publica
  • Sengoku
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:

Vasoli

Corporal
48 Badges
Mar 21, 2015
30
15
  • Cities in Motion
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Semper Fi
  • Victoria: Revolutions
  • Europa Universalis IV: Res Publica
  • Magicka
  • Hearts of Iron III
  • For the Motherland
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis III
  • Europa Universalis IV: Art of War
  • Crusader Kings II
  • Crusader Kings II: Horse Lords
  • Crusader Kings III: Royal Edition
  • Cities: Skylines - After Dark
  • Crusader Kings II: Conclave
  • Cities: Skylines - Snowfall
  • Hearts of Iron IV Sign-up
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Cities: Skylines - Natural Disasters
  • Hearts of Iron IV: Together for Victory
  • Hearts of Iron IV: Death or Dishonor
  • Crusader Kings II: Jade Dragon
  • Cities: Skylines - Parklife Pre-Order
  • Cities: Skylines - Parklife
  • Crusader Kings II: Holy Fury
  • Crusader Kings III
  • Crusader Kings II: Charlemagne
  • 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
  • Cities: Skylines
  • Rome Gold
  • Pillars of Eternity
  • Victoria 2
  • Rome: Vae Victis
  • Europa Universalis IV: El Dorado
  • Crusader Kings II: Way of Life
  • Stellaris
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:

Tatterhood

Conscientious Objector
29 Badges
Jun 9, 2016
1.569
1.442
  • Stellaris: Digital Anniversary Edition
  • Crusader Kings III: Royal Edition
  • Crusader Kings III
  • Crusader Kings II: Holy Fury
  • Shadowrun: Hong Kong
  • Shadowrun: Dragonfall
  • Shadowrun Returns
  • Stellaris: Distant Stars
  • Stellaris: Apocalypse
  • Stellaris: Humanoids Species Pack
  • Crusader Kings II: Jade Dragon
  • Stellaris - Path to Destruction bundle
  • Crusader Kings II: Monks and Mystics
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Reapers Due
  • Stellaris
  • Crusader Kings II: Conclave
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Way of Life
  • Crusader Kings II
  • Stellaris: Synthetic Dawn
  • 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
  • Crusader Kings II: Charlemagne
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.
 

Mixael

Private
53 Badges
Jun 26, 2015
13
0
  • Cities in Motion 2
  • Stellaris - Path to Destruction bundle
  • Cities: Skylines - After Dark
  • Victoria 2: A House Divided
  • Sword of the Stars II
  • Sengoku
  • Semper Fi
  • Europa Universalis IV: Res Publica
  • Magicka
  • Knights of Pen and Paper +1 Edition
  • Impire
  • Hearts of Iron III
  • For the Motherland
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Art of War
  • Hearts of Iron III: Their Finest Hour
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II
  • Stellaris: Leviathans Story Pack
  • Prison Architect
  • Cities: Skylines - Mass Transit
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis 4: Emperor
  • Age of Wonders III
  • Cities: Skylines - Green Cities
  • Crusader Kings III
  • Stellaris: Apocalypse
  • Europa Universalis IV: Rule Britannia
  • Cities: Skylines - Parklife Pre-Order
  • Cities: Skylines - Parklife
  • Europa Universalis IV: Dharma
  • Europa Universalis IV: Golden Century
  • Europa Universalis IV: Rights of Man
  • Victoria 2
  • War of the Roses
  • Cities: Skylines
  • Europa Universalis IV: El Dorado
  • Magicka: Wizard Wars Founder Wizard
  • Crusader Kings II: Way of Life
  • Pillars of Eternity
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Mare Nostrum
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Third Rome
I don't think it 's possible, but could you make knights counter certain unit types? They are only defined in the defines.lua and you can't really add new defines afaik.
 

akkaro

Second Lieutenant
2 Badges
Jun 10, 2011
158
77
  • Hearts of Iron III
  • 500k Club
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?
 

Anyasia

Lightbringer
60 Badges
Aug 5, 2015
165
56
  • Crusader Kings II
  • Europa Universalis IV: Cossacks
  • The Showdown Effect
  • Victoria 2
  • Warlock: Master of the Arcane
  • War of the Roses
  • Cities: Skylines
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV: Pre-order
  • Magicka: Wizard Wars Founder Wizard
  • Pride of Nations
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Horse Lords
  • Starvoid
  • Crusader Kings II: Conclave
  • Europa Universalis IV: Mare Nostrum
  • Hearts of Iron IV Sign-up
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Rights of Man
  • Crusader Kings II: Monks and Mystics
  • Europa Universalis IV: Mandate of Heaven
  • Crusader Kings Complete
  • Europa Universalis IV: Third Rome
  • Age of Wonders III
  • Europa Universalis IV: Cradle of Civilization
  • Europa Universalis III
  • Arsenal of Democracy
  • Cities in Motion 2
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings III
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Commander: Conquest of the Americas
  • Darkest Hour
  • Teleglitch: Die More Edition
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Wealth of Nations
  • Gettysburg
  • Leviathan: Warships
  • The Kings Crusade
  • Majesty 2
  • March of the Eagles
  • Naval War: Arctic Circle
  • Europa Universalis IV: Res Publica
  • Sengoku
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?
 

Tatterhood

Conscientious Objector
29 Badges
Jun 9, 2016
1.569
1.442
  • Stellaris: Digital Anniversary Edition
  • Crusader Kings III: Royal Edition
  • Crusader Kings III
  • Crusader Kings II: Holy Fury
  • Shadowrun: Hong Kong
  • Shadowrun: Dragonfall
  • Shadowrun Returns
  • Stellaris: Distant Stars
  • Stellaris: Apocalypse
  • Stellaris: Humanoids Species Pack
  • Crusader Kings II: Jade Dragon
  • Stellaris - Path to Destruction bundle
  • Crusader Kings II: Monks and Mystics
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Reapers Due
  • Stellaris
  • Crusader Kings II: Conclave
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Way of Life
  • Crusader Kings II
  • Stellaris: Synthetic Dawn
  • 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
  • Crusader Kings II: Charlemagne
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:

DYLAN_1

Sergeant
20 Badges
Aug 4, 2014
60
21
  • Crusader Kings III: Royal Edition
  • Crusader Kings III
  • Crusader Kings II
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Res Publica
  • Imperator: Rome Sign Up
  • Age of Wonders III
  • Hearts of Iron IV: Cadet
  • Stellaris Sign-up
  • Hearts of Iron IV Sign-up
  • Stellaris
  • Magicka: Wizard Wars Founder Wizard
  • Europa Universalis IV: El Dorado
  • Cities: Skylines
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Victoria 2
  • Magicka
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.
 

osoerk

Recruit
28 Badges
Nov 26, 2020
2
0
  • Stellaris - Path to Destruction bundle
  • Crusader Kings III
  • Stellaris: Lithoids
  • Stellaris: Ancient Relics
  • Cities: Skylines - Campus
  • Stellaris: Megacorp
  • Cities: Skylines Industries
  • Stellaris: Distant Stars
  • Cities: Skylines - Parklife
  • Cities: Skylines - Parklife Pre-Order
  • Stellaris: Apocalypse
  • Stellaris: Humanoids Species Pack
  • Cities: Skylines - Green Cities
  • Stellaris: Synthetic Dawn
  • Crusader Kings II
  • Cities: Skylines - Natural Disasters
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris
  • Cities: Skylines - Snowfall
  • Cities: Skylines - After Dark
  • Pillars of Eternity
  • Cities: Skylines Deluxe Edition
  • Cities: Skylines
  • Sword of the Stars II
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: