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

VorpalNeko

First Lieutenant
4 Badges
Jul 20, 2012
281
20
  • Crusader Kings II
  • Europa Universalis IV
  • 500k Club
  • Europa Universalis IV: Pre-order
What exactly does as_if_liege = yes do in an opinion_diff condition?

There's three relevant character scopes: THIS, first, and second. So my guess would be that it checks if first would have a higher opinion of THIS if THIS were first's liege. But it might be the opposite: if first were the liege of THIS. Or some other combination, the other possibilities would probably make less sense.
 

richvh

Preserver of the Light
63 Badges
Dec 1, 2001
14.691
1.999
Visit site
  • Stellaris: Leviathans Story Pack
  • Pillars of Eternity
  • Crusader Kings II: Horse Lords
  • Cities: Skylines - After Dark
  • Knights of Pen and Paper 2
  • Crusader Kings II: Conclave
  • Stellaris
  • Hearts of Iron IV Sign-up
  • Stellaris Sign-up
  • Crusader Kings II: Reapers Due
  • Tyranny: Archon Edition
  • Tyranny: Archon Edition
  • Tyranny: Gold Edition
  • Crusader Kings II: Way of Life
  • Crusader Kings II: Monks and Mystics
  • Stellaris - Path to Destruction bundle
  • Surviving Mars
  • Stellaris: Synthetic Dawn
  • Tyranny - Tales from the Tiers
  • Tyranny - Bastards Wound
  • Age of Wonders III
  • Age of Wonders: Shadow Magic
  • Age of Wonders
  • Age of Wonders II
  • Crusader Kings II: Jade Dragon
  • Crusader Kings III: Royal Edition
  • Europa Universalis IV: Call to arms event
  • 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
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Europa Universalis IV
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • A Game of Dwarves
  • King Arthur II
  • Knights of Pen and Paper +1 Edition
  • Magicka
  • Majesty 2 Collection
  • Europa Universalis IV: Res Publica
  • Europa Universalis: Rome
  • Rome Gold
  • Rome: Vae Victis
  • 500k Club
  • Cities: Skylines
It's used in factions, to decide if you'd like this guy better as liege than that guy (and therefore would join a faction seeking to replace that guy with this guy.)
 
  • 1
Reactions:

richvh

Preserver of the Light
63 Badges
Dec 1, 2001
14.691
1.999
Visit site
  • Stellaris: Leviathans Story Pack
  • Pillars of Eternity
  • Crusader Kings II: Horse Lords
  • Cities: Skylines - After Dark
  • Knights of Pen and Paper 2
  • Crusader Kings II: Conclave
  • Stellaris
  • Hearts of Iron IV Sign-up
  • Stellaris Sign-up
  • Crusader Kings II: Reapers Due
  • Tyranny: Archon Edition
  • Tyranny: Archon Edition
  • Tyranny: Gold Edition
  • Crusader Kings II: Way of Life
  • Crusader Kings II: Monks and Mystics
  • Stellaris - Path to Destruction bundle
  • Surviving Mars
  • Stellaris: Synthetic Dawn
  • Tyranny - Tales from the Tiers
  • Tyranny - Bastards Wound
  • Age of Wonders III
  • Age of Wonders: Shadow Magic
  • Age of Wonders
  • Age of Wonders II
  • Crusader Kings II: Jade Dragon
  • Crusader Kings III: Royal Edition
  • Europa Universalis IV: Call to arms event
  • 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
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Europa Universalis IV
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • A Game of Dwarves
  • King Arthur II
  • Knights of Pen and Paper +1 Edition
  • Magicka
  • Majesty 2 Collection
  • Europa Universalis IV: Res Publica
  • Europa Universalis: Rome
  • Rome Gold
  • Rome: Vae Victis
  • 500k Club
  • Cities: Skylines
To the best of my knowledge, the game executes commands linearly. Preceding code blocks are always executed before following code blocks.
 

ethiopianvampire

Second Lieutenant
40 Badges
Jan 12, 2016
102
10
  • Crusader Kings II: Charlemagne
  • Knights of Pen and Paper 2
  • Crusader Kings II
  • Europa Universalis IV: Art of War
  • Europa Universalis IV
  • 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
  • Stellaris: Necroids
  • Crusader Kings II: Jade Dragon
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Stellaris: Synthetic Dawn
  • Shadowrun: Hong Kong
  • Stellaris: Megacorp
  • Crusader Kings II: Holy Fury
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Crusader Kings II: Monks and Mystics
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Crusader Kings II: Reapers Due
  • Hearts of Iron IV: Cadet
  • Stellaris
  • Crusader Kings II: Conclave
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Pillars of Eternity
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: El Dorado
  • Stellaris - Path to Destruction bundle
  • Knights of Pen and Paper +1 Edition
A comma? I've never seen them in GFX files.
And typos like that are the reason why I was in this position. lol. It was a missing quotation mark.

Question:
I am using the on_birth action to add a trait to a baby. The trait won't appear. Using Gods! as reference again, I noticed that they appear to use a two- step process to A) add a trait called something like "god_baby", and then there is a secondary firing event for children with that trait to give them the trait "young_god." Does anyone know if there is a reason why this is necessary (if it is)?
 
Last edited:

jursamaj

General
125 Badges
Aug 20, 2012
2.360
216
  • Victoria 2: Heart of Darkness
  • Hearts of Iron III
  • Heir to the Throne
  • Knights of Pen and Paper +1 Edition
  • Cities in Motion
  • Europa Universalis IV: Res Publica
  • Victoria: Revolutions
  • Stellaris: Galaxy Edition
  • Stellaris - Path to Destruction bundle
  • Victoria 2: A House Divided
  • Leviathan: Warships
  • Rome: Vae Victis
  • Stellaris
  • Europa Universalis IV: Pre-order
  • Magicka 2 - Signup Campaign
  • Crusader Kings II: Horse Lords
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Cossacks
  • Cities: Skylines - Snowfall
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Call to arms event
  • 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
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Europa Universalis III
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis III Complete
  • Europa Universalis IV: Conquest of Paradise
  • Divine Wind
  • Europa Universalis IV: Art of War
  • Europa Universalis III: Chronicles
  • Crusader Kings II: Way of Life
  • Crusader Kings II: Conclave
  • Europa Universalis III Complete
  • Europa Universalis IV: Common Sense
  • Europa Universalis III Complete
  • Pillars of Eternity
  • Europa Universalis IV
  • Europa Universalis IV: El Dorado
  • 500k Club
  • Stellaris Sign-up
  • Hearts of Iron IV Sign-up
  • Hearts of Iron IV: No Step Back
It can be removed by commenting out the frame border spriteType in your mod's copy of map/statics/00_static.txt. You can change the frame border size to one of the other pre-created borders. To change to anything other size, you would have to actually make a new 3D frame and convert it to .mesh format using the Jorodox tool.
Out of curiosity, couldn't you change the 'scale = 100.00' on an existing frame. I would expect 'scale = 200.00' would double it in size. You might also need to play with the position…

Of course, that would only work of the aspect ratio of one of the frames suits your map.
 

jursamaj

General
125 Badges
Aug 20, 2012
2.360
216
  • Victoria 2: Heart of Darkness
  • Hearts of Iron III
  • Heir to the Throne
  • Knights of Pen and Paper +1 Edition
  • Cities in Motion
  • Europa Universalis IV: Res Publica
  • Victoria: Revolutions
  • Stellaris: Galaxy Edition
  • Stellaris - Path to Destruction bundle
  • Victoria 2: A House Divided
  • Leviathan: Warships
  • Rome: Vae Victis
  • Stellaris
  • Europa Universalis IV: Pre-order
  • Magicka 2 - Signup Campaign
  • Crusader Kings II: Horse Lords
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Cossacks
  • Cities: Skylines - Snowfall
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Call to arms event
  • 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
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Europa Universalis III
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis III Complete
  • Europa Universalis IV: Conquest of Paradise
  • Divine Wind
  • Europa Universalis IV: Art of War
  • Europa Universalis III: Chronicles
  • Crusader Kings II: Way of Life
  • Crusader Kings II: Conclave
  • Europa Universalis III Complete
  • Europa Universalis IV: Common Sense
  • Europa Universalis III Complete
  • Pillars of Eternity
  • Europa Universalis IV
  • Europa Universalis IV: El Dorado
  • 500k Club
  • Stellaris Sign-up
  • Hearts of Iron IV Sign-up
  • Hearts of Iron IV: No Step Back
Hi all,

I haven't tried modding in about 3 years, so I've forgotten everything. I'm trying to add a province to re-learn the process, so to start I wanted to try creating a province of Cambridgeshire, and I am stuck, it loads as a grey unclickable province called Dniester... In game if I search for the province it's in the list, but clicking on it takes me to the lower left of the map. Can anyone help jog my memory and point where I'm going wrong?

Thanks. Here's the process

So first up I created the new mod folder, I have used no replace or extend paths, I copied in the original map folder.
I changed the last province value by +1
I took a new colour and drew in a province in provinces.bmp and noted the RGB value.
I wrote it in as a new province 1464 in definition.csv
I put the new province in a new localisation file for the name.
In history I have provinces & titles.
I've made a new txt file for 1464 - Cambridgeshire.txt
title = c_cambridge
max_settlements = 1
b_cambridge = city

I've also put in 68 - Northampton.txt and removed cambridge from there.
In common I have landed titles, and province setup folders.
In the 00_province_setup file I have added in 1464 to be c_cambridge
In landed_titles I've put c_cambridge with b_cambridge in it under d_norfolk, all { } are there

Audax Validator says "At 1464 - Cambridgeshire.txt c_cambridge is not a valid CountTitle
Have I overlooked something, or put something in the wrong place?

Many thanks
You don't mention putting your province in map/positions.txt. That's probably why search takes you to the lower left (position 0, 0).

The rest is probably because of the c_cambridge error. Make sure you spelled it the same in every location.
 

jursamaj

General
125 Badges
Aug 20, 2012
2.360
216
  • Victoria 2: Heart of Darkness
  • Hearts of Iron III
  • Heir to the Throne
  • Knights of Pen and Paper +1 Edition
  • Cities in Motion
  • Europa Universalis IV: Res Publica
  • Victoria: Revolutions
  • Stellaris: Galaxy Edition
  • Stellaris - Path to Destruction bundle
  • Victoria 2: A House Divided
  • Leviathan: Warships
  • Rome: Vae Victis
  • Stellaris
  • Europa Universalis IV: Pre-order
  • Magicka 2 - Signup Campaign
  • Crusader Kings II: Horse Lords
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Cossacks
  • Cities: Skylines - Snowfall
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Call to arms event
  • 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
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Europa Universalis III
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis III Complete
  • Europa Universalis IV: Conquest of Paradise
  • Divine Wind
  • Europa Universalis IV: Art of War
  • Europa Universalis III: Chronicles
  • Crusader Kings II: Way of Life
  • Crusader Kings II: Conclave
  • Europa Universalis III Complete
  • Europa Universalis IV: Common Sense
  • Europa Universalis III Complete
  • Pillars of Eternity
  • Europa Universalis IV
  • Europa Universalis IV: El Dorado
  • 500k Club
  • Stellaris Sign-up
  • Hearts of Iron IV Sign-up
  • Hearts of Iron IV: No Step Back
I'm trying to create a CB that takes all the target's titles and steals all his vassals, within the de-jure kingdom, however it seems it only works sometimes. Some other times the vassals go free, and some other time I usurp the vassals. I don't want to use the vanilla's vassalize_or_take_under_title since that usurps vassal patricians and has some other invisible rules and I don't want that.

Can anyone verify there's something I'm doing wrong:

Code:
    on_success_title = {
  
        custom_tooltip = {
        name = my_custom_tooltip
            hidden_tooltip = {
                from = {
                    # Usurp all titles held by the target.
                    any_demesne_title = {
                        limit = { de_jure_liege_or_above = prevprev}
                        usurp_title = root
                        any_de_jure_vassal_title = { # take all baronies under the one we're fighting for
                            limit = {
                                has_holder = yes
                                holder_scope = {
                                    OR = {
                                        character = FROM
                                        is_liege_or_above = FROM
                                    }
                                }
                            }

                            usurp_title_plus_barony_if_unlanded = { target = ROOT type = invasion }
                        }
                    }
              
                    #Steal all the target's vassals, since you usurped all the target's titles, they should be lower tier than you.
                    any_vassal = {
                        limit = { de_jure_liege_or_above = prevprev}
                        set_defacto_liege = root                  
                        opinion = {
                            modifier = opinion_subjugated
                            who = root
                        }
                  
                        # If not de-jure vassal, make him independent
                        if = {
                            limit = {
                                higher_tier_than = baron
                                NOT = { de_jure_liege_or_above = prevprev }
                            }
                            set_defacto_liege = this
                        }                      
                    }
                  
                    #Imprison the target
                    imprison = root
              
                }
            }  
        }
    }
It's probably an ordering issue. Usurping the target's titles should probably be the *last* thing you do, after taking and/or usurping his vassals. Because once you take all his titles, he's unlanded and can't *have* vassals, so they go free.
 
  • 1
Reactions:

jursamaj

General
125 Badges
Aug 20, 2012
2.360
216
  • Victoria 2: Heart of Darkness
  • Hearts of Iron III
  • Heir to the Throne
  • Knights of Pen and Paper +1 Edition
  • Cities in Motion
  • Europa Universalis IV: Res Publica
  • Victoria: Revolutions
  • Stellaris: Galaxy Edition
  • Stellaris - Path to Destruction bundle
  • Victoria 2: A House Divided
  • Leviathan: Warships
  • Rome: Vae Victis
  • Stellaris
  • Europa Universalis IV: Pre-order
  • Magicka 2 - Signup Campaign
  • Crusader Kings II: Horse Lords
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Cossacks
  • Cities: Skylines - Snowfall
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Call to arms event
  • 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
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Europa Universalis III
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis III Complete
  • Europa Universalis IV: Conquest of Paradise
  • Divine Wind
  • Europa Universalis IV: Art of War
  • Europa Universalis III: Chronicles
  • Crusader Kings II: Way of Life
  • Crusader Kings II: Conclave
  • Europa Universalis III Complete
  • Europa Universalis IV: Common Sense
  • Europa Universalis III Complete
  • Pillars of Eternity
  • Europa Universalis IV
  • Europa Universalis IV: El Dorado
  • 500k Club
  • Stellaris Sign-up
  • Hearts of Iron IV Sign-up
  • Hearts of Iron IV: No Step Back
And typos like that are the reason why I was in this position. lol. It was a missing quotation mark.

Question:
I am using the on_birth action to add a trait to a baby. The trait won't appear. Using Gods! as reference again, I noticed that they appear to use a two- step process to A) add a trait called something like "god_baby", and then there is a secondary firing event for children with that trait to give them the trait "young_god." Does anyone know if there is a reason why this is necessary (if it is)?
It should not generally be an issue. on_birth fires event 312 for children of concubines, which adds the child_of_consort trait directly. If the god trait uses immortality, *that* modifier has some flakiness. Or perhaps they just want to delay the 2nd trait by some time.
 
  • 1
Reactions:

ethiopianvampire

Second Lieutenant
40 Badges
Jan 12, 2016
102
10
  • Crusader Kings II: Charlemagne
  • Knights of Pen and Paper 2
  • Crusader Kings II
  • Europa Universalis IV: Art of War
  • Europa Universalis IV
  • 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
  • Stellaris: Necroids
  • Crusader Kings II: Jade Dragon
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Stellaris: Synthetic Dawn
  • Shadowrun: Hong Kong
  • Stellaris: Megacorp
  • Crusader Kings II: Holy Fury
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Crusader Kings II: Monks and Mystics
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Crusader Kings II: Reapers Due
  • Hearts of Iron IV: Cadet
  • Stellaris
  • Crusader Kings II: Conclave
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Pillars of Eternity
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: El Dorado
  • Stellaris - Path to Destruction bundle
  • Knights of Pen and Paper +1 Edition
It should not generally be an issue. on_birth fires event 312 for children of concubines, which adds the child_of_consort trait directly. If the god trait uses immortality, *that* modifier has some flakiness. Or perhaps they just want to delay the 2nd trait by some time.

Ahhh. I see. Thank you.

Another Question: If I structure a line like this...
OR = {
random = { chance = 33 add_trait = mage_blood_baby }
random = { chance = 33 add_trait = half_blood_baby }
random = { chance = 33 add_trait = thin_blood_baby }
random = { chance = 1 add_trait = source_blood_baby }}
}

}

A) Is it possible to get more than one of these traits (since the numbers add to 100%)
--I assume this is the case and am going to fire a secondary event to clean out any lower tier traits--

B) Is it possible (despite their being a 100% chance) that, randomness being what it is, a child may be born with no traits.
--- My gut tells me this will be the case if there are three separate "die rolls". Therefore, I expect to see a runt baby (Can always put a decision in to cull him though lol)

and would it make any difference (if that is the case) if I typed it like this...

OR = {
random = {
chance = 33 add_trait = mage_blood_baby
chance = 33 add_trait = half_blood_baby
chance = 33 add_trait = thin_blood_baby
chance = 1 add_trait = source_blood_baby

... effectively tying the four separate rolls together. (This seems likely because there are events that equal up to 100. Probably answered my own question here...
 
Last edited:

richvh

Preserver of the Light
63 Badges
Dec 1, 2001
14.691
1.999
Visit site
  • Stellaris: Leviathans Story Pack
  • Pillars of Eternity
  • Crusader Kings II: Horse Lords
  • Cities: Skylines - After Dark
  • Knights of Pen and Paper 2
  • Crusader Kings II: Conclave
  • Stellaris
  • Hearts of Iron IV Sign-up
  • Stellaris Sign-up
  • Crusader Kings II: Reapers Due
  • Tyranny: Archon Edition
  • Tyranny: Archon Edition
  • Tyranny: Gold Edition
  • Crusader Kings II: Way of Life
  • Crusader Kings II: Monks and Mystics
  • Stellaris - Path to Destruction bundle
  • Surviving Mars
  • Stellaris: Synthetic Dawn
  • Tyranny - Tales from the Tiers
  • Tyranny - Bastards Wound
  • Age of Wonders III
  • Age of Wonders: Shadow Magic
  • Age of Wonders
  • Age of Wonders II
  • Crusader Kings II: Jade Dragon
  • Crusader Kings III: Royal Edition
  • Europa Universalis IV: Call to arms event
  • 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
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Europa Universalis IV
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • A Game of Dwarves
  • King Arthur II
  • Knights of Pen and Paper +1 Edition
  • Magicka
  • Majesty 2 Collection
  • Europa Universalis IV: Res Publica
  • Europa Universalis: Rome
  • Rome Gold
  • Rome: Vae Victis
  • 500k Club
  • Cities: Skylines
You can't use OR in effects, just in triggers. Exactly what are you trying to achieve? If it is that there is a 33% chance of each of this, that and the other thing, and a 1% chance of some other thing, then use random_list:
Code:
random_list = {
   33 = { <this> }
   33 = { <that> }
   33 = { <the other thing> }
   1 = { <some other thing> }
}
Note that the totals of the entries of random_list do not have to add up to 100, as they are weights, not percentages. You can also use modifiers to alter the relative weights of random_list entries.
 
  • 2
Reactions:

VorpalNeko

First Lieutenant
4 Badges
Jul 20, 2012
281
20
  • Crusader Kings II
  • Europa Universalis IV
  • 500k Club
  • Europa Universalis IV: Pre-order
You can't use OR in effects, just in triggers. Exactly what are you trying to achieve? If it is that there is a 33% chance of each of this, that and the other thing, and a 1% chance of some other thing, then use random_list:
Code:
random_list = {
   33 = { <this> }
   33 = { <that> }
   33 = { <the other thing> }
   1 = { <some other thing> }
}
Note that the totals of the entries of random_list do not have to add up to 100, as they are weights, not percentages. You can also use modifiers to alter the relative weights of random_list entries.
Note that if you genuinely want that 1% chance to be there (in this case, 1% for 'add_trait = source_blood_baby'), this code won't work at all because the random_list command is bugged and the engine seems to treat {33,33,33,1} as if it were {34,33,33,0}.

An easy workaround to that sort of problem is to simply multiply all chances by some large number, e.g. use {33000,33000,33000,1000}. The engine will probably treat the first and last as 33001 and 999, but at that point the relative ratios are so close to the intended 33% and 1% that it doesn't practically matter.

Another thing to watch out for is avoiding doing random rolls for multiple-member scope (any_character, any_title, etc.), because there's another bug in the game engine related for that.
 
  • 1
Reactions:

ethiopianvampire

Second Lieutenant
40 Badges
Jan 12, 2016
102
10
  • Crusader Kings II: Charlemagne
  • Knights of Pen and Paper 2
  • Crusader Kings II
  • Europa Universalis IV: Art of War
  • Europa Universalis IV
  • 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
  • Stellaris: Necroids
  • Crusader Kings II: Jade Dragon
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Stellaris: Synthetic Dawn
  • Shadowrun: Hong Kong
  • Stellaris: Megacorp
  • Crusader Kings II: Holy Fury
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Crusader Kings II: Monks and Mystics
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Crusader Kings II: Reapers Due
  • Hearts of Iron IV: Cadet
  • Stellaris
  • Crusader Kings II: Conclave
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Pillars of Eternity
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: El Dorado
  • Stellaris - Path to Destruction bundle
  • Knights of Pen and Paper +1 Edition
You can't use OR in effects, just in triggers. Exactly what are you trying to achieve? If it is that there is a 33% chance of each of this, that and the other thing, and a 1% chance of some other thing, then use random_list:
Code:
random_list = {
   33 = { <this> }
   33 = { <that> }
   33 = { <the other thing> }
   1 = { <some other thing> }
}
Note that the totals of the entries of random_list do not have to add up to 100, as they are weights, not percentages. You can also use modifiers to alter the relative weights of random_list entries.

What I am trying to achieve is to create an inheritance system for a trait. I'm basing it on the one that is included with Gods! for inheriting God, God Blood, Angel, Evil God etc... My system needs to be a little more complex than that however because I want to achieve a certain level of randomness to the results; I do, however, want one of a list of five traits to always appear in any character born to one/two characters that have one of these traits.
Ex: Character 1) has trait A.(3/5 in progressive order of magnitude)
Character 2) has trait B. (2/5 in progressive order of magnitude)
Character 1 and Character 2 have a child
Child has 40% chance to inherit trait 2)
40% chance to inherit trait 3)
19% chance to inherit trait 4)
1% chance to inherit trait 1)

I always want the child to inherit 1 of 5 traits based upon their mother / father traits, if their parents have 1/ 5 traits) . I believe that you solved my problem above, because I didn't know to not use OR in events. This is my first event that I've made and the percentage part seems to be what's holding me up because the rest was pretty much monkey- see- monkey- do.
 

ethiopianvampire

Second Lieutenant
40 Badges
Jan 12, 2016
102
10
  • Crusader Kings II: Charlemagne
  • Knights of Pen and Paper 2
  • Crusader Kings II
  • Europa Universalis IV: Art of War
  • Europa Universalis IV
  • 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
  • Stellaris: Necroids
  • Crusader Kings II: Jade Dragon
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Stellaris: Synthetic Dawn
  • Shadowrun: Hong Kong
  • Stellaris: Megacorp
  • Crusader Kings II: Holy Fury
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Crusader Kings II: Monks and Mystics
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Crusader Kings II: Reapers Due
  • Hearts of Iron IV: Cadet
  • Stellaris
  • Crusader Kings II: Conclave
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Pillars of Eternity
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: El Dorado
  • Stellaris - Path to Destruction bundle
  • Knights of Pen and Paper +1 Edition
Note that if you genuinely want that 1% chance to be there (in this case, 1% for 'add_trait = source_blood_baby'), this code won't work at all because the random_list command is bugged and the engine seems to treat {33,33,33,1} as if it were {34,33,33,0}.

An easy workaround to that sort of problem is to simply multiply all chances by some large number, e.g. use {33000,33000,33000,1000}. The engine will probably treat the first and last as 33001 and 999, but at that point the relative ratios are so close to the intended 33% and 1% that it doesn't practically matter.

Another thing to watch out for is avoiding doing random rolls for multiple-member scope (any_character, any_title, etc.), because there's another bug in the game engine related for that.

Thank you. That would have probably screwed me up. I want the 1% in there as a pleasant surprise. And I appreciate all the help. I've never modded a thing before, but this one is coming together thanks to all the valuable information.
 

loup99

Godogost of Armorica
78 Badges
Jan 22, 2013
16.589
6.380
  • Crusader Kings III
  • Europa Universalis IV
  • Warlock 2: The Exiled
  • 500k Club
  • Pride of Nations
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Crusader Kings Complete
  • Imperator: Rome Deluxe Edition
  • Victoria 2
  • Arsenal of Democracy
  • Cities in Motion
  • Crusader Kings II
  • Darkest Hour
  • Europa Universalis III: Chronicles
  • For The Glory
  • Hearts of Iron III
  • March of the Eagles
  • Rome Gold
  • Sengoku
  • Victoria 2: A House Divided
  • Victoria: Revolutions
  • Cities: Skylines
  • Europa Universalis IV: Pre-order
Why are the conditions scaled_wealth and gold not working if used in the can_use/can_use_gui section of a CB?
 

richvh

Preserver of the Light
63 Badges
Dec 1, 2001
14.691
1.999
Visit site
  • Stellaris: Leviathans Story Pack
  • Pillars of Eternity
  • Crusader Kings II: Horse Lords
  • Cities: Skylines - After Dark
  • Knights of Pen and Paper 2
  • Crusader Kings II: Conclave
  • Stellaris
  • Hearts of Iron IV Sign-up
  • Stellaris Sign-up
  • Crusader Kings II: Reapers Due
  • Tyranny: Archon Edition
  • Tyranny: Archon Edition
  • Tyranny: Gold Edition
  • Crusader Kings II: Way of Life
  • Crusader Kings II: Monks and Mystics
  • Stellaris - Path to Destruction bundle
  • Surviving Mars
  • Stellaris: Synthetic Dawn
  • Tyranny - Tales from the Tiers
  • Tyranny - Bastards Wound
  • Age of Wonders III
  • Age of Wonders: Shadow Magic
  • Age of Wonders
  • Age of Wonders II
  • Crusader Kings II: Jade Dragon
  • Crusader Kings III: Royal Edition
  • Europa Universalis IV: Call to arms event
  • 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
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Europa Universalis IV
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • A Game of Dwarves
  • King Arthur II
  • Knights of Pen and Paper +1 Edition
  • Magicka
  • Majesty 2 Collection
  • Europa Universalis IV: Res Publica
  • Europa Universalis: Rome
  • Rome Gold
  • Rome: Vae Victis
  • 500k Club
  • Cities: Skylines
Another way to do it would be:
Code:
random = {
   chance = 1
   add_trait = <trait 1>
   break = yes
}
#if got here, trait 1 was not assigned
random = {
   chance = 20 #close enough to 19/99
   add_trait = <trait 4>
   break = yes
}
#if got here, neither trait 1 nor trait 4 were assigned
random = {
   chance = 50
   add_trait = <trait 2>
   break = yes
}
add_trait = <trait 3>
 
  • 1
Reactions:

ethiopianvampire

Second Lieutenant
40 Badges
Jan 12, 2016
102
10
  • Crusader Kings II: Charlemagne
  • Knights of Pen and Paper 2
  • Crusader Kings II
  • Europa Universalis IV: Art of War
  • Europa Universalis IV
  • 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
  • Stellaris: Necroids
  • Crusader Kings II: Jade Dragon
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Stellaris: Synthetic Dawn
  • Shadowrun: Hong Kong
  • Stellaris: Megacorp
  • Crusader Kings II: Holy Fury
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Crusader Kings II: Monks and Mystics
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Crusader Kings II: Reapers Due
  • Hearts of Iron IV: Cadet
  • Stellaris
  • Crusader Kings II: Conclave
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Pillars of Eternity
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: El Dorado
  • Stellaris - Path to Destruction bundle
  • Knights of Pen and Paper +1 Edition
Another way to do it would be:
Code:
random = {
   chance = 1
   add_trait = <trait 1>
   break = yes
}
#if got here, trait 1 was not assigned
random = {
   chance = 20 #close enough to 19/99
   add_trait = <trait 4>
   break = yes
}
#if got here, neither trait 1 nor trait 4 were assigned
random = {
   chance = 50
   add_trait = <trait 2>
   break = yes
}
add_trait = <trait 3>
Gotcha'. I'm re- writing the event now. Thanks again for all the help!
 
Last edited:

loup99

Godogost of Armorica
78 Badges
Jan 22, 2013
16.589
6.380
  • Crusader Kings III
  • Europa Universalis IV
  • Warlock 2: The Exiled
  • 500k Club
  • Pride of Nations
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Crusader Kings Complete
  • Imperator: Rome Deluxe Edition
  • Victoria 2
  • Arsenal of Democracy
  • Cities in Motion
  • Crusader Kings II
  • Darkest Hour
  • Europa Universalis III: Chronicles
  • For The Glory
  • Hearts of Iron III
  • March of the Eagles
  • Rome Gold
  • Sengoku
  • Victoria 2: A House Divided
  • Victoria: Revolutions
  • Cities: Skylines
  • Europa Universalis IV: Pre-order
Why are the conditions scaled_wealth and gold not working if used in the can_use/can_use_gui section of a CB?
Is there anyone that knows more about this? Or are conditions in general restricted when used in CBs?
 

ethiopianvampire

Second Lieutenant
40 Badges
Jan 12, 2016
102
10
  • Crusader Kings II: Charlemagne
  • Knights of Pen and Paper 2
  • Crusader Kings II
  • Europa Universalis IV: Art of War
  • Europa Universalis IV
  • 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
  • Stellaris: Necroids
  • Crusader Kings II: Jade Dragon
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Stellaris: Synthetic Dawn
  • Shadowrun: Hong Kong
  • Stellaris: Megacorp
  • Crusader Kings II: Holy Fury
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Crusader Kings II: Monks and Mystics
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Crusader Kings II: Reapers Due
  • Hearts of Iron IV: Cadet
  • Stellaris
  • Crusader Kings II: Conclave
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Pillars of Eternity
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: El Dorado
  • Stellaris - Path to Destruction bundle
  • Knights of Pen and Paper +1 Edition
Just wanted to post the solution to my problem. There were actually several errors in the scripting.
namespace = MISSING. That, important as it is, wasn't the problem. I found an extra bracket, but that wasn't the problem. I renamed the event "bloodrules.2," (as opposed to "bloodrules.1") and that may have been the problem (though I'm not sure). Gods! (the mod I was using as example) was fixed by another modder who appeared to have taken out a series of ANDS, and made the event more fluent, if nothing else. All together, the event didn't work because it was not put together correctly. Thank you for the help again.

namespace = bloodrules <------ Added namespace in lieu of a series of numbers.
##################
# CHILD MAGIC EVENTS
#################
character_event = {
id = "bloodrules.2" <----------- Renamed to "bloodrules.2" rather than "bloodrules.1" (May have nothing to do with it, but I can imagine a possibility for conflict)
hide_window = no
is_triggered_only = yes
immediate = {

immediate = {

#BEFORE
if = { # 1 Father and mother both SOURCE and you get a SOURCE
limit = {
father = { trait = source_blood }
AND = { mother = {trait = source_blood } } <--------------- Removed the AND and second '}'
}
add_trait = source_blood
}

if = { # 1.2 father is SOURCE and mother has NO mage traits
limit = {
father = { trait = source_blood }
AND = { NOT = { mother = { trait = source_blood } } <------------------ Removed the ANDs and tidied up my lines for easy '}' spotting
NOT = { mother = { trait = mage_blood } }
NOT = { mother = { trait = half_blood } }
NOT = { mother = { trait = thin_blood } }

}
}
add_trait = mage_blood
}

#AFTER
if = { # 2 father is a SOURCE and mother is a MAGE and you get a MAGE (add a 10% chance of source when working)
limit = {
father = { trait = source_blood }
mother = {trait = mage_blood }
}
random_list = { <------------Used random_ list with a difference of 1 (as suggested)
94 = { add_trait = mage_blood }
6 = { add_trait = source_blood }
}
}
 
Last edited:

Romulien

Lt. General
19 Badges
Jul 2, 2013
1.404
308
  • Crusader Kings II
  • Major Wiki Contributor
Is there anyone that knows more about this? Or are conditions in general restricted when used in CBs?

I've managed to fix it, with:
Code:
can_use_gui = {
     ROOT = {
       scaled_wealth = 0.5
       wealth = 500
     }
   }
It works in game, the trick is that can_use_gui only appears when it evaluates to false, so not easy for debugging...
Not sure if initiul issue was coming from the lack of ROOT scope, gold vs wealth trigger, or both.
 
  • 1
Reactions: