• 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.
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?
 
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:
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:
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
                        }
                    }
 
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?
 
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.
 
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.
 
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?".
 
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
 
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.)
 
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.
 
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 }
}
 
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
     }
}
 
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.
 
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.
 
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).
 
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.
Thanks. I read the wiki page, but it didn't understand it much.
 
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.
Btw, do you know if random in condition blocks rolls a random number with a new seed every time? Like, if I have something like:
Code:
if = {
    limit = {
        OR = {
            AND = {
                trait = quick
                random <= 70
            }
            AND = {
                trait = fair
                random <= 80
            }
        }
        OR = {
            AND = {
                trait = patient
                random <= 10
            }
            AND = {
                trait = diligent
                random <= 20
            }
        }
    }
    #<...>
}

1) Do we get different random numbers rolled for every time random is called, or do we have the same number throughout?
2) Can you use trigger_if here? The wiki said something about trigger_else_if chains having to end in trigger_else, but I kinda have no else condition in mind.