neutrondecay

Colonel
23 Badges
Oct 1, 2015
996
592
  • Crusader Kings II
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings III
  • Crusader Kings II: Holy Fury
  • Crusader Kings II: Holy Fury Pre-order
  • Crusader Kings II: Jade Dragon
  • Cities: Skylines - Mass Transit
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Reapers Due
  • Crusader Kings II: Conclave
  • Cities: Skylines - After Dark
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Way of Life
  • Cities: Skylines
  • Europa Universalis IV
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
Thank you good sir.

I didn't know what to do so I just scoured all the modding pages, tried the gfx_culture_scope, when that didn't work I tried the portrait_culture value in the portraitt modding page. I literally tried every basic variation of code I could think of trying to get it to work for 4 hours this morning. Didn't know that save_event_target_as = was a thing.
In general, A = B = C (no brackets) will never work.

nd
 

kiannameiou

Sergeant
1 Badges
Apr 27, 2021
51
5
  • Crusader Kings II
Code:
character_event = {
    id = immortality.88
    desc = "Build Fort"
    picture = GFX_evt_throne_room
    border = GFX_event_normal_frame_economy
    
    only_playable = yes
    ai = no
    
    
    mean_time_to_happen  = {
        months = 1
    }
    
    trigger = {
        any_realm_province = {
            
                has_fort = no
                
                OR = {
                    
                        any_province_holding = {
                            has_siege = no
                        }
                        any_province_holding = {
                            is_occupied = no
                        }
                    
                }
            
            
        }
        
        
        
    }
    
    option = {
        name = "Build Fort"
        scaled_wealth = { value = -0.1 max = -5000 }
        
            any_realm_province = {
                limit = {
                    has_fort = no
                    
                    OR = {
                    
                        any_province_holding = {
                            has_siege = no
                        }
                        any_province_holding = {
                            is_occupied = no
                        }
                    
                    }
                    
                    
                }
                holder_scope = {
                    create_fort = PREV
                }
            }
        
    }
}

How to make the event NOT build forts in countys that are being occupied/sieged?? I dont want to interrupt revoke wars and also vassal only wars like holy war for a duchy. has_siege, is_occupied doesnt seem to work, the fort gets built in a province that is being sieged.
 

Rockphed

Uncultured Barbarian
19 Badges
Jan 31, 2017
1.060
60
  • Crusader Kings II
  • Crusader Kings II: Way of Life
  • Crusader Kings II: Holy Fury
  • Shadowrun Returns
  • Surviving Mars: Digital Deluxe Edition
  • Crusader Kings II: Jade Dragon
  • Surviving Mars
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Reapers Due
  • Crusader Kings II: Conclave
  • Crusader Kings II: Horse Lords
  • 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 am trying to prevent an event from firing if somebody or any of their lieges is at war. I tried trigger = {war = no}, but in my test game yesterday the event still went off for somebody even though their top liege had like 3 wars going on. Did I use a wrong trigger, or should I throw in an "any_liege = {war = no}" in the trigger?
 

Whizzer

CKPlus Triumvirate
76 Badges
Jun 17, 2014
1.120
287
  • Semper Fi
  • Hearts of Iron III Collection
  • Heir to the Throne
  • King Arthur II
  • Knights of Pen and Paper +1 Edition
  • Leviathan: Warships
  • The Kings Crusade
  • Magicka
  • Victoria: Revolutions
  • Rome Gold
  • Cities in Motion
  • Sengoku
  • Sword of the Stars
  • Sword of the Stars II
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Rome: Vae Victis
  • Warlock: Master of the Arcane
  • Europa Universalis IV: Mare Nostrum
  • Hearts of Iron III
  • A Game of Dwarves
  • 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
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sword of Islam
  • Dungeonland
  • Crusader Kings II: Sunset Invasion
  • Europa Universalis III
  • Divine Wind
  • Hearts of Iron III: Their Finest Hour
  • For the Motherland
  • Europa Universalis IV: Rights of Man
  • Crusader Kings II: Reapers Due
  • Crusader Kings II: Conclave
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Way of Life
  • Magicka: Wizard Wars Founder Wizard
  • Europa Universalis IV: El Dorado
  • Cities: Skylines
  • War of the Roses
  • Crusader Kings III
  • Europa Universalis IV
I am trying to prevent an event from firing if somebody or any of their lieges is at war. I tried trigger = {war = no}, but in my test game yesterday the event still went off for somebody even though their top liege had like 3 wars going on. Did I use a wrong trigger, or should I throw in an "any_liege = {war = no}" in the trigger?

A ruler's top liege may not be their direct liege, so yes, check for all lieges (and the ruler too), but like this:

Code:
war = no

NOT = {
	any_liege = { war = yes }
}

The trigger checks if that character is a direct participant in a war. A player vassal will see the war in the bottom right if their liege is at war, but it's somewhat greyed out and the player is not a direct participant in that war and could thus be at peace if not in any other wars.
 
  • 1
Reactions:

havenost

Captain
49 Badges
Dec 9, 2013
396
72
  • Crusader Kings II
  • Pillars of Eternity
  • Crusader Kings II: Sword of Islam
  • Mount & Blade: Warband
  • Cities: Skylines - Campus
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Conclave
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Rights of Man
  • Crusader Kings II: Monks and Mystics
  • Cities: Skylines - Mass Transit
  • Surviving Mars
  • Age of Wonders III
  • Cities: Skylines - Green Cities
  • Crusader Kings II: Jade Dragon
  • Surviving Mars: Digital Deluxe Edition
  • Cities: Skylines - Parklife
  • Shadowrun Returns
  • Cities: Skylines Industries
  • Crusader Kings II: Holy Fury
  • Cities: Skylines
  • War of the Roses
  • Crusader Kings II: Sons of Abraham
  • Europa Universalis IV
  • Europa Universalis III: Collection
  • 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
  • Hearts of Iron III: Their Finest Hour
  • Cities in Motion 2
  • Europa Universalis III
  • Divine Wind
  • Europa Universalis IV: Art of War
  • For the Motherland
  • Hearts of Iron III
  • Stellaris
  • Cities: Skylines - Snowfall
  • Hearts of Iron III Collection
  • Europa Universalis IV: Cossacks
  • Cities: Skylines - After Dark
  • Heir to the Throne
  • Majesty 2 Collection
  • Magicka 2
  • Semper Fi
  • Europa Universalis IV: El Dorado
Is there anyway to do a decision condition check to make sure two characters are betrothed to each?

For instance check if my character is betrothed to another character to give the character they are betrothed to a present.

Edit: Never mind found it.

betrothed = { character = FROM }
 
Last edited:

jursamaj

General
121 Badges
Aug 20, 2012
2.334
202
  • 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
  • Stellaris: Nemesis
Code:
character_event = {
    id = immortality.88
    desc = "Build Fort"
    picture = GFX_evt_throne_room
    border = GFX_event_normal_frame_economy
 
    only_playable = yes
    ai = no
 
 
    mean_time_to_happen  = {
        months = 1
    }
 
    trigger = {
        any_realm_province = {
         
                has_fort = no
             
                OR = {
                 
                        any_province_holding = {
                            has_siege = no
                        }
                        any_province_holding = {
                            is_occupied = no
                        }
                 
                }
         
         
        }
     
     
     
    }
 
    option = {
        name = "Build Fort"
        scaled_wealth = { value = -0.1 max = -5000 }
     
            any_realm_province = {
                limit = {
                    has_fort = no
                 
                    OR = {
                 
                        any_province_holding = {
                            has_siege = no
                        }
                        any_province_holding = {
                            is_occupied = no
                        }
                 
                    }
                 
                 
                }
                holder_scope = {
                    create_fort = PREV
                }
            }
     
    }
}

How to make the event NOT build forts in countys that are being occupied/sieged?? I dont want to interrupt revoke wars and also vassal only wars like holy war for a duchy. has_siege, is_occupied doesnt seem to work, the fort gets built in a province that is being sieged.
You have to be careful with logic. "any_province_holding = { has_siege = no }" is true if Holding A is not under siege but Holding B is. Worse, If holding A is under siege, it is not occupied, and vice versa, so one of the 2 tests will always be true, so the OR will always be true. Instead:
Code:
                    NOR = {
                        any_province_holding = {
                            has_siege = yes
                        }
                        any_province_holding = {
                            is_occupied = yes
                        }
                    }
 

swampy111

Second Lieutenant
9 Badges
Apr 3, 2019
125
7
  • Cities: Skylines
  • Magicka 2
  • Cities: Skylines - Parklife
  • Shadowrun Returns
  • Prison Architect
  • Crusader Kings II
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Sons of Abraham
  • Magicka
Two quick questions here.
1) Does anyone know how to hide artifacts? Like how traits have a is_visible property.
2) Does anyone know how to prevent an artifact from being looted? I'm considering setting up something like this:
Code:
on_artifact_inheritance = {
    effect = {
        any_artifact = {
            limit = {
                artifact_type = contract
                previous_artifact_owner = { is_alive = yes }
            }
            transfer_artifact = {
                from = PREV
                to = previous_artifact_owner
            }
        }
    }
}

I want an artifact to stay with the owner no matter what (can't be gifted, can't be stolen, can't be looted, and etc.)
As an alternative, I guess I could create a custom character to hold these artifacts (I mostly need them for the dynamic flags and variables attached to them). Think like AGOT ruins except it doesn't hold any provinces.
In that case, how should I prevent the court from being populated? Or do I have to banish/kill everyone?
 

Silversweeeper

Ichi no Hito
58 Badges
Aug 24, 2012
3.626
2.343
  • Crusader Kings II: Monks and Mystics
  • Pillars of Eternity
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Conclave
  • Stellaris
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Rights of Man
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Europa Universalis IV: Common Sense
  • Stellaris - Path to Destruction bundle
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis IV: Cradle of Civilization
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Crusader Kings II: Holy Fury
  • Imperator: Rome Deluxe Edition
  • Stellaris: Ancient Relics
  • Imperator: Rome Sign Up
  • Crusader Kings II: Way of Life
  • Magicka: Wizard Wars Founder Wizard
  • Europa Universalis IV: El Dorado
  • 500k Club
  • Europa Universalis IV
  • Europa Universalis III Complete
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Europa Universalis III Complete
  • Stellaris: Nemesis
  • Stellaris: Necroids
  • Europa Universalis IV: Mare Nostrum
  • Crusader Kings II: Charlemagne
  • Stellaris Sign-up
  • Europa Universalis IV: Third Rome
  • Europa Universalis IV: Res Publica
  • Crusader Kings II
  • 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 Complete
  • Magicka
1) Does anyone know how to hide artifacts? Like how traits have a is_visible property.

I don't believe it's possible to hide them.

2) Does anyone know how to prevent an artifact from being looted? I'm considering setting up something like this:

The easiest way to do that would probably be to set a flag (e.g. do_not_loot) on the relevant artefacts and to update various decisions for looting/stealing/etc. artefacts to ensure that artefacts with that flag can't be looted. Gifting is specifically handled in the artefact definition (allowed_gift = { always = no }, or e.g. allowed_gift = { NOT = { has_artifact_flag = do_not_gift }}), unless you've scripted your own way of gifting artefacts.
 

swampy111

Second Lieutenant
9 Badges
Apr 3, 2019
125
7
  • Cities: Skylines
  • Magicka 2
  • Cities: Skylines - Parklife
  • Shadowrun Returns
  • Prison Architect
  • Crusader Kings II
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Sons of Abraham
  • Magicka
Thanks. About 2, is the do_not_loot used in vanilla? Like, will it stop vikings for getting it, for example?
I don't believe it's possible to hide them.



The easiest way to do that would probably be to set a flag (e.g. do_not_loot) on the relevant artefacts and to update various decisions for looting/stealing/etc. artefacts to ensure that artefacts with that flag can't be looted. Gifting is specifically handled in the artefact definition (allowed_gift = { always = no }, or e.g. allowed_gift = { NOT = { has_artifact_flag = do_not_gift }}), unless you've scripted your own way of gifting artefacts.
 

Silversweeeper

Ichi no Hito
58 Badges
Aug 24, 2012
3.626
2.343
  • Crusader Kings II: Monks and Mystics
  • Pillars of Eternity
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Conclave
  • Stellaris
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Rights of Man
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Europa Universalis IV: Common Sense
  • Stellaris - Path to Destruction bundle
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis IV: Cradle of Civilization
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Crusader Kings II: Holy Fury
  • Imperator: Rome Deluxe Edition
  • Stellaris: Ancient Relics
  • Imperator: Rome Sign Up
  • Crusader Kings II: Way of Life
  • Magicka: Wizard Wars Founder Wizard
  • Europa Universalis IV: El Dorado
  • 500k Club
  • Europa Universalis IV
  • Europa Universalis III Complete
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Europa Universalis III Complete
  • Stellaris: Nemesis
  • Stellaris: Necroids
  • Europa Universalis IV: Mare Nostrum
  • Crusader Kings II: Charlemagne
  • Stellaris Sign-up
  • Europa Universalis IV: Third Rome
  • Europa Universalis IV: Res Publica
  • Crusader Kings II
  • 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 Complete
  • Magicka
Thanks. About 2, is the do_not_loot used in vanilla? Like, will it stop vikings for getting it, for example?

Not to my knowledge, but as the looting is (as far as I know) handled by an event triggered from an on_action (on_settlement_looted, I believe) and that event can be adjusted it should be simple enough to change that event to check for the flag when checking "Does this character have a lootable artefact?" and when checking "Can I loot this artefact?".
 

swampy111

Second Lieutenant
9 Badges
Apr 3, 2019
125
7
  • Cities: Skylines
  • Magicka 2
  • Cities: Skylines - Parklife
  • Shadowrun Returns
  • Prison Architect
  • Crusader Kings II
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Sons of Abraham
  • Magicka
Not to my knowledge, but as the looting is (as far as I know) handled by an event triggered from an on_action (on_settlement_looted, I believe) and that event can be adjusted it should be simple enough to change that event to check for the flag when checking "Does this character have a lootable artefact?" and when checking "Can I loot this artefact?".
Ah, thanks! I was looking at on_siege_won_leader, so, i assumed those events were hardcoded XD
 

kiannameiou

Sergeant
1 Badges
Apr 27, 2021
51
5
  • Crusader Kings II
After inheriting an artifact, there is a 5% chance that it will require maintenance. The cost to keep the artifact ranges from 30% yearly income for Q1 artifacts to 100% yearly income for Q4+ artifacts.

When a non-ruler dies, their artifacts are inherited by their employer, but destructible artifacts have a 50% chance to be destroyed instead. (Indestructible artifacts are exempt.)
 

Rockphed

Uncultured Barbarian
19 Badges
Jan 31, 2017
1.060
60
  • Crusader Kings II
  • Crusader Kings II: Way of Life
  • Crusader Kings II: Holy Fury
  • Shadowrun Returns
  • Surviving Mars: Digital Deluxe Edition
  • Crusader Kings II: Jade Dragon
  • Surviving Mars
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Reapers Due
  • Crusader Kings II: Conclave
  • Crusader Kings II: Horse Lords
  • 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
A ruler's top liege may not be their direct liege, so yes, check for all lieges (and the ruler too), but like this:

Code:
war = no

NOT = {
    any_liege = { war = yes }
}

The trigger checks if that character is a direct participant in a war. A player vassal will see the war in the bottom right if their liege is at war, but it's somewhat greyed out and the player is not a direct participant in that war and could thus be at peace if not in any other wars.
Thank you for the info and the code that will actually work. Now to go update all my triggers for these events.
 

swampy111

Second Lieutenant
9 Badges
Apr 3, 2019
125
7
  • Cities: Skylines
  • Magicka 2
  • Cities: Skylines - Parklife
  • Shadowrun Returns
  • Prison Architect
  • Crusader Kings II
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Sons of Abraham
  • Magicka
1) Can someone explain me how trigger_if works?
2) how does the random in if work? Here's a snippet from vanilla's WoL seduction (the one where you send a note):
Code:
random_courtier = {
    limit = {
        OR = {
            character = PREV # The target
            AND = {
                prisoner = no
                is_adult = yes
                NOT = { character = ROOT }
                NOT = { character = PREV }
                NOT = { trait = incapable }
                NOR = {
                    trait = on_hajj
                    trait = on_pilgrimage
                    trait = in_hiding
                    in_command = yes
                    has_character_modifier = in_meditation
                    has_character_modifier = doing_penance
                }
                
                at_location = PREV
                OR = {
                    AND = {
                        OR = {
                            has_opinion_modifier = {
                                who = ROOT
                                modifier = opinion_chasing_friend
                            }
                            has_opinion_modifier = {
                                who = ROOT
                                modifier = opinion_chasing_spouse
                            }
                            has_opinion_modifier = {
                                who = ROOT
                                modifier = opinion_chasing_child
                            }
                        }
                        random = 50 # 50% chance
                    }
                    AND = {
                        OR = {
                            any_spouse = { character = PREVPREV }
                            is_father = PREV
                            is_liege_of = PREV
                        }
                        random = 90 # 10% chance
                    }
                    random = 98 # 2% chance
                }
            }
        }
    }
    character_event = { id = WoL.417 days = 1 }
}
 

GodModder

Sergeant
21 Badges
May 10, 2021
62
6
  • Stellaris
  • Crusader Kings III
  • Crusader Kings II: Holy Fury
  • Stellaris: Megacorp
  • Shadowrun: Hong Kong
  • Shadowrun Returns
  • Stellaris: Apocalypse
  • Age of Wonders III
  • Stellaris - Path to Destruction bundle
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Reapers Due
  • Crusader Kings II
  • Crusader Kings II: Conclave
  • Magicka 2
  • Pillars of Eternity
  • Crusader Kings II: Way of Life
  • Majesty 2 Collection
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: Charlemagne
1) Can someone explain me how trigger_if works?
2) how does the random in if work? Here's a snippet from vanilla's WoL seduction (the one where you send a note):
Code:
random_courtier = {
    limit = {
        OR = {
            character = PREV # The target
            AND = {
                prisoner = no
                is_adult = yes
                NOT = { character = ROOT }
                NOT = { character = PREV }
                NOT = { trait = incapable }
                NOR = {
                    trait = on_hajj
                    trait = on_pilgrimage
                    trait = in_hiding
                    in_command = yes
                    has_character_modifier = in_meditation
                    has_character_modifier = doing_penance
                }
               
                at_location = PREV
                OR = {
                    AND = {
                        OR = {
                            has_opinion_modifier = {
                                who = ROOT
                                modifier = opinion_chasing_friend
                            }
                            has_opinion_modifier = {
                                who = ROOT
                                modifier = opinion_chasing_spouse
                            }
                            has_opinion_modifier = {
                                who = ROOT
                                modifier = opinion_chasing_child
                            }
                        }
                        random = 50 # 50% chance
                    }
                    AND = {
                        OR = {
                            any_spouse = { character = PREVPREV }
                            is_father = PREV
                            is_liege_of = PREV
                        }
                        random = 90 # 10% chance
                    }
                    random = 98 # 2% chance
                }
            }
        }
    }
    character_event = { id = WoL.417 days = 1 }
}
Everything except random_courtier = { } needs to be nested inside an if = { } block. Like so.
Code:
random_courtier = {
     if = {
          limit = {
               # the trigger conditions here
          }
          character_event = { id = WoL.417 days = 11 } # or whatever other effects you want when the trigger conditions inside the limit = { } block are met
     }
}
 

Whizzer

CKPlus Triumvirate
76 Badges
Jun 17, 2014
1.120
287
  • Semper Fi
  • Hearts of Iron III Collection
  • Heir to the Throne
  • King Arthur II
  • Knights of Pen and Paper +1 Edition
  • Leviathan: Warships
  • The Kings Crusade
  • Magicka
  • Victoria: Revolutions
  • Rome Gold
  • Cities in Motion
  • Sengoku
  • Sword of the Stars
  • Sword of the Stars II
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Rome: Vae Victis
  • Warlock: Master of the Arcane
  • Europa Universalis IV: Mare Nostrum
  • Hearts of Iron III
  • A Game of Dwarves
  • 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
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sword of Islam
  • Dungeonland
  • Crusader Kings II: Sunset Invasion
  • Europa Universalis III
  • Divine Wind
  • Hearts of Iron III: Their Finest Hour
  • For the Motherland
  • Europa Universalis IV: Rights of Man
  • Crusader Kings II: Reapers Due
  • Crusader Kings II: Conclave
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Way of Life
  • Magicka: Wizard Wars Founder Wizard
  • Europa Universalis IV: El Dorado
  • Cities: Skylines
  • War of the Roses
  • Crusader Kings III
  • Europa Universalis IV
1) Can someone explain me how trigger_if works?
2) how does the random in if work? Here's a snippet from vanilla's WoL seduction (the one where you send a note):

1. It's the condition variant of 'if'. Rather than 'if this is true, execute this effect', it's 'if this is true, check this condition'. It allows you to do simplify some checks, and make the logical structure much clearer than nested logical gates (AND, OR, etc.). Did you read this yet?

2. A random integer between 0 and 100 (inclusive) is rolled. If it's equal or greater than the number on the right side of the trigger, if evaluates to true. That means 'random = 90' has a 10% of evaluating to true. It's therefore better to instead write 'random < 10' so that the chance matches the number.

Everything except random_courtier = { } needs to be nested inside an if = { } block. Like so.

No, it doesn't. any_ and random_ scopes can be filtered to desired requirements this way.
 

Rockphed

Uncultured Barbarian
19 Badges
Jan 31, 2017
1.060
60
  • Crusader Kings II
  • Crusader Kings II: Way of Life
  • Crusader Kings II: Holy Fury
  • Shadowrun Returns
  • Surviving Mars: Digital Deluxe Edition
  • Crusader Kings II: Jade Dragon
  • Surviving Mars
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Reapers Due
  • Crusader Kings II: Conclave
  • Crusader Kings II: Horse Lords
  • 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
1. It's the condition variant of 'if'. Rather than 'if this is true, execute this effect', it's 'if this is true, check this condition'. It allows you to do simplify some checks, and make the logical structure much clearer than nested logical gates (AND, OR, etc.). Did you read this yet?

2. A random integer between 0 and 100 (inclusive) is rolled. If it's equal or greater than the number on the right side of the trigger, if evaluates to true. That means 'random = 90' has a 10% of evaluating to true. It's therefore better to instead write 'random < 10' so that the chance matches the number.



No, it doesn't. any_ and random_ scopes can be filtered to desired requirements this way.
Am I correct in thinking that the snippet is going to select at random from a list that includes PREV, but might also include other people? So each courtier has a 2% chance to be on the list, and any spouse of the seducer has a 10% chance, and something about chasing friend, spouse, or child has a 50% chance. Then after the list is built each person on it has an equal chance to be chosen.
 

Whizzer

CKPlus Triumvirate
76 Badges
Jun 17, 2014
1.120
287
  • Semper Fi
  • Hearts of Iron III Collection
  • Heir to the Throne
  • King Arthur II
  • Knights of Pen and Paper +1 Edition
  • Leviathan: Warships
  • The Kings Crusade
  • Magicka
  • Victoria: Revolutions
  • Rome Gold
  • Cities in Motion
  • Sengoku
  • Sword of the Stars
  • Sword of the Stars II
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Rome: Vae Victis
  • Warlock: Master of the Arcane
  • Europa Universalis IV: Mare Nostrum
  • Hearts of Iron III
  • A Game of Dwarves
  • 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
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sword of Islam
  • Dungeonland
  • Crusader Kings II: Sunset Invasion
  • Europa Universalis III
  • Divine Wind
  • Hearts of Iron III: Their Finest Hour
  • For the Motherland
  • Europa Universalis IV: Rights of Man
  • Crusader Kings II: Reapers Due
  • Crusader Kings II: Conclave
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Way of Life
  • Magicka: Wizard Wars Founder Wizard
  • Europa Universalis IV: El Dorado
  • Cities: Skylines
  • War of the Roses
  • Crusader Kings III
  • Europa Universalis IV
Am I correct in thinking that the snippet is going to select at random from a list that includes PREV, but might also include other people? So each courtier has a 2% chance to be on the list, and any spouse of the seducer has a 10% chance, and something about chasing friend, spouse, or child has a 50% chance. Then after the list is built each person on it has an equal chance to be chosen.

That's probably how it works internally, yes. Each character meeting the requirements should certainly have an equal chance of being selected (but clearly not all characters have an equal chance of meeting the requirements, due to the random-condition).