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

Abrael

Private
40 Badges
Sep 16, 2023
16
14
  • Europa Universalis 4: Emperor
  • Europa Universalis IV: Cradle of Civilization
  • Europa Universalis IV: Third Rome
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Rule Britannia
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Dharma
  • Crusader Kings III: Royal Edition
  • Europa Universalis IV: Golden Century
  • Europa Universalis IV: Conquest of Paradise
  • Crusader Kings III
  • Crusader Kings II
  • Europa Universalis IV
  • Imperator: Rome
  • Majesty 2
  • Hearts of Iron IV: Cadet
  • Crusader Kings II: Horse Lords
  • Imperator: Rome - Magna Graecia
  • Crusader Kings II: Holy Fury
  • Hearts of Iron IV: Expansion Pass
  • Crusader Kings II: Jade Dragon
  • Hearts of Iron IV: Death or Dishonor
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Reapers Due
  • Crusader Kings II: Conclave
  • Crusader Kings II: Way of Life
  • 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
How to make it so that when a child is born, the head of the house with a small chance appears an event in which he can choose this child a trait?

I want to do something like the conqueror trait, which will have a special casus belli against everyone and have a small chance of appearing in a newborn.

I tried to put "birth = 0.05" in the trait, but when I increased the value to see if it works, no one was born with this trait

(sorry if something is unclear, I write through a translator)
 
There is on_action called on_birth_child. I copied this example from my mod. You can see scopes you can use here:
Code:
on_birth_child = {
    on_actions = {
        my_on_birth
    }
}

my_on_birth = {
    trigger = {
        scope:is_bastard = yes
        OR = {
            scope:real_father = {
            }
            scope:mother = {
            }
        }
    }
    effect = {
        scope:father = {
        }
        scope:child = {
        }
    }
}
Just trigger an event inside effect and these scopes will be available in the event
 
Last edited:
  • 2
Reactions:
Here is possible implementation (I didn't try it though):
common/on_action/my_on_action.txt
Code:
on_birth_child = {
    on_actions = {
        my_on_birth
    }
}

my_on_birth = {
    trigger = {
        exists = scope:child.dynasty
    }
    effect = {
        random = {
            chance = 5
            scope:child.house.house_head = {
                trigger_event = {
                    id = my_event.0001
                }
            }
        }
    }
}

events/my_events.txt
Code:
namespace = my_event

my_event.0001 = {
    type = character_event
    #...
 
    immediate = {
        # ...
    }

    option = {
        name = my_trait_1
        scope:child = {
            add_trait = my_trait_1
        }
    }
    option = {
        name = my_trait_2
        scope:child = {
            add_trait = my_trait_2
        }
    }
    option = {
        name = my_trait_3
        scope:child = {
            add_trait = my_trait_3
        }
    }
}

Edit: Added trigger to check if child is not lowborn: exists = scope:child.dynasty
 
Last edited:
  • 3
Reactions:
Here is possible implementation (I didn't try it though):
common/on_action/my_on_action.txt
Code:
on_birth_child = {
    on_actions = {
        my_on_birth
    }
}

my_on_birth = {
    effect = {
        random = {
            chance = 5
            scope:child.house.house_head = {
                trigger_event = {
                    id = my_event.0001
                }
            }
        }
    }
}

events/my_events.txt
Code:
namespace = my_event

my_event.0001 = {
    type = character_event
    #...
 
    immediate = {
        # ...
    }

    option = {
        name = my_trait_1
        scope:child = {
            add_trait = my_trait_1
        }
    }
    option = {
        name = my_trait_2
        scope:child = {
            add_trait = my_trait_2
        }
    }
    option = {
        name = my_trait_3
        scope:child = {
            add_trait = my_trait_3
        }
    }
}
thank you very much!
 
  • 3Like
Reactions:
Here is possible implementation (I didn't try it though):
common/on_action/my_on_action.txt
Code:
on_birth_child = {
    on_actions = {
        my_on_birth
    }
}

my_on_birth = {
    trigger = {
        exists = scope:child.dynasty
    }
    effect = {
        random = {
            chance = 5
            scope:child.house.house_head = {
                trigger_event = {
                    id = my_event.0001
                }
            }
        }
    }
}

events/my_events.txt
Code:
namespace = my_event

my_event.0001 = {
    type = character_event
    #...
 
    immediate = {
        # ...
    }

    option = {
        name = my_trait_1
        scope:child = {
            add_trait = my_trait_1
        }
    }
    option = {
        name = my_trait_2
        scope:child = {
            add_trait = my_trait_2
        }
    }
    option = {
        name = my_trait_3
        scope:child = {
            add_trait = my_trait_3
        }
    }
}

Edit: Added trigger to check if child is not lowborn: exists = scope:child.dynasty
is it possible to increase this chance under certain conditions? For example, if you have a certain dynasty perk, the chance will be higher
 
is it possible to increase this chance under certain conditions? For example, if you have a certain dynasty perk, the chance will be higher
Yes, you can use modifiers and triggers. Here are examples from game files:
Code:
house.house_head = {
    random = {
        chance = 50
        modifier = {
            add = 25
            has_trait = vengeful
        }
        modifier = {
            add = -25
            has_trait = forgiving
        }
        modifier = {
            add = 25
            has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:killer }
        }
        trigger_event = {
            id = bp1_house_feud.0005
            days = { 5 15 }
        }
    }
}
Code:
random = {
    chance = 25
    modifier = { factor = destroy_building_soldier_multiplier_value } # chance increases with more soldiers
    modifier = { add = destroy_building_development_multiplier_value } # chance increases with development
    custom_tooltip = destroy_random_building_tt
    destroy_random_building_variable_effect = yes
}
Code:
random = {
    chance = {
        value = 10
        if = {
            limit = {
                exists = scope:wipe
            }
            add = 90
        }
        if = {
            limit = {
                exists = enemy_side.side_commander.primary_title
                exists = side_commander.primary_title
                enemy_side.side_commander.primary_title.tier >= side_commander.primary_title.tier
            }
            add = 90
        }
    }
   
    # ...
}
 
  • 1
  • 1Like
Reactions: