• 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.
Would anyone know anything about modding succession laws? I am trying to get a dynastic succession where only the rulers dynasty is considered but also follows primogeniture. I have something that kind of works but it is done through elective gravelkind and first heir gets older the game will vote for the 2nd youngest heir. I would like for it to go from the rulers children, grandchildren and if they dont have any to go to siblings then uncles/aunts etc. Hopefully this makes sense, would anyone be willing to help?
Maybe it'll work better if you base it off feudal_elective instead of elective gavelkind? Because that approach sounds like it should work - maybe it's the "gavelkind" part that's messing up?

However, writing a script that encodes the primogeniture rules for the purpose of elections could be very tricky. Especially since you might have to go up and down 5-10 generations to find the next valid heir. On second thoughts, make that very very very tricky...

Can you give some more background on your high-level goal? There may be a better way...
 
  • 1Like
Reactions:
It's worth noting that while succession laws can be modded, succession types are hard-coded and cannot be modded. Succession laws are what show up in the player's interface and can be enacted; upon a succession law being enacted, it institutes the succession type that is listed in the succession law's entry.
 
Maybe it'll work better if you base it off feudal_elective instead of elective gavelkind? Because that approach sounds like it should work - maybe it's the "gavelkind" part that's messing up?

However, writing a script that encodes the primogeniture rules for the purpose of elections could be very tricky. Especially since you might have to go up and down 5-10 generations to find the next valid heir. On second thoughts, make that very very very tricky...

Can you give some more background on your high-level goal? There may be a better way...
Sure. I would like titles to stay with the dynasty for as long as possible. So instead of the title going to a child that is of a different dynasty the heir of the title will be a family member no matter how distant. I would also like the ai to prefer this over other succession laws all the way down to baron. I am trying to figure out how to get the ai to land unlanded family to baron level titles either city or castle.
 
Sure. I would like titles to stay with the dynasty for as long as possible. So instead of the title going to a child that is of a different dynasty the heir of the title will be a family member no matter how distant. I would also like the ai to prefer this over other succession laws all the way down to baron. I am trying to figure out how to get the ai to land unlanded family to baron level titles either city or castle.
As per my previous post, I think coding primogeniture succession logic into an elective system would be "extremely ambitious". (IE: Massively time-consuming, verging on impossible.)

I think the best solution in your situation is to accept a compromise. For example, is there a reason that eldership succession wouldn't work for you? It's basically guaranteed to give the titles to a youngish dynast, although it will be the "best" candidate rather than the first son. If that's an OK starting point, you could add weights so that common primogeniture scenarios are covered. (Eg: Eldest son gets +10000 points, eldest son of eldest son gets +9900, 2nd son of eldest son gets +9800,... second son gets +9000 points, eldest son of second son gets +8900 points,... etc.) This will not cover all scenarios (eg. great-great-grandsons or uncles being the correct successor under primo), but this compromise solution seems actually achievable.
 
Last edited:
As per my previous post, I think coding primogeniture succession logic into an elective system would be "extremely ambitious". (IE: Massively time-consuming, verging on impossible.)

I think the best solution in your situation is to accept a compromise. For example, is there a reason that eldership succession wouldn't work for you? It's basically guaranteed to give the titles to a youngish dynast, although it will be the "best" candidate rather than the first son. If that's an OK starting point, you could add weights so that common primogeniture scenarios are covered. (Eg: Eldest son gets +10000 points, eldest son of eldest son gets +9900, 2nd son of eldest son gets +9800,... second son gets +9000 points, eldest son of second son gets +8900 points,... etc.) This will not cover all scenarios (eg. great-great-grandsons or uncles being the correct successor under primo), but this compromise solution seems actually achievable.
Yes I could try that out. How would you add weights to target eldest son then 2nd son and so on?
 
Yes I could try that out. How would you add weights to target eldest son then 2nd son and so on?
Important references:
--- The succession modding page on the wiki
--- Existing succession voting rules (...\common\succession_voting\00_succession_voting.txt)

Important untested assumption:
--- Does is_older_than work correctly when comparing against dead characters?
--- Eg: If ROOT is 45 and his elder brother died at 30, does ROOT = { any_sibling_even_if_dead = { is_older_than = PREV } } return true? If not, that's very bad.

Then you should be able to do something like this:
Code:
mymod_dynastic_primo_voting = {
	
...copy other things from base game eldership...
	
	# Determines who can be voted for.
	# ROOT is the title holder, FROM is the potential candidate, FROMROM is the title.
	# *** RULE: Candidates are only valid if they are same dynasty as the ruler ***
	candidate_trigger = {
		dynasty = FROM
	}
	
	# Determines the score an elector will assign to a candidate.
	# The candidate with the highest score will recieve the elector's votes.
	# ROOT is the elector, FROM is the candidate. Undocumented: FROMFROM is the title.
	candidate_vote_score = {
		
...copy other things from base game eldership, so that voting can proceed as normal if these massive modifiers are ineffective...
		
		additive_modifier = { # Eldest child of first-preference gender
			value = 100000
			localisation_key = mymod_voting_weight_explanation_generic # Replace this with a custom loc tailored to each level, if you can be bothered
			FROMFROM = {
				holder_scope = {
					any_child_even_if_dead = {
						character = FROM
						mymod_this_character_is_first_preference_under_fromfroms_gender_law = yes
						NOT = {
							any_sibling_even_if_dead = {
								mymod_this_character_is_first_preference_under_fromfroms_gender_law = yes
								is_older_than = PREV
							}
						}
					}
				}
			}
		}
		
		additive_modifier = { # Eldest child of first-preference gender of eldest child of first-preference gender
			value = 99000
			localisation_key = mymod_voting_weight_explanation_generic # Replace this with a custom loc tailored to each level, if you can be bothered
			FROMFROM = {
				holder_scope = {
					any_child_even_if_dead = {
						mymod_this_character_is_first_preference_under_fromfroms_gender_law = yes
						NOT = {
							any_sibling_even_if_dead = {
								mymod_this_character_is_first_preference_under_fromfroms_gender_law = yes
								is_older_than = PREV
							}
						}
						any_child_even_if_dead = {
							character = FROM
							mymod_this_character_is_first_preference_under_fromfroms_gender_law = yes
							NOT = {
								any_sibling_even_if_dead = {
									mymod_this_character_is_first_preference_under_fromfroms_gender_law = yes
									is_older_than = PREV
								}
							}
						}
					}
				}
			}
		}
		
		additive_modifier = { # Second child of first-preference gender of eldest child of first-preference gender
			value = 98000
			localisation_key = mymod_voting_weight_explanation_generic # Replace this with a custom loc tailored to each level, if you can be bothered
			FROMFROM = {
				holder_scope = {
					any_child_even_if_dead = {
						mymod_this_character_is_first_preference_under_fromfroms_gender_law = yes
						NOT = {
							any_sibling_even_if_dead = {
								mymod_this_character_is_first_preference_under_fromfroms_gender_law = yes
								is_older_than = PREV
							}
						}
						any_child_even_if_dead = {
							character = FROM
							mymod_this_character_is_first_preference_under_fromfroms_gender_law = yes
							any_sibling_even_if_dead = {
								mymod_this_character_is_first_preference_under_fromfroms_gender_law = yes
								is_older_than = PREV
								count == 1 # There are exactly this many **older** children
							}
						}
					}
				}
			}
		}
		
		additive_modifier = { # Third child of first-preference gender of eldest child of first-preference gender
			value = 97000
			localisation_key = mymod_voting_weight_explanation_generic # Replace this with a custom loc tailored to each level, if you can be bothered
			FROMFROM = {
				holder_scope = {
					any_child_even_if_dead = {
						mymod_this_character_is_first_preference_under_fromfroms_gender_law = yes
						NOT = {
							any_sibling_even_if_dead = {
								mymod_this_character_is_first_preference_under_fromfroms_gender_law = yes
								is_older_than = PREV
							}
						}
						any_child_even_if_dead = {
							character = FROM
							mymod_this_character_is_first_preference_under_fromfroms_gender_law = yes
							any_sibling_even_if_dead = {
								mymod_this_character_is_first_preference_under_fromfroms_gender_law = yes
								is_older_than = PREV
								count == 2 # There are exactly this many **older** children
							}
						}
					}
				}
			}
		}
		
		additive_modifier = { # Fourth child of first-preference gender of eldest child of first-preference gender
			value = 96000
			localisation_key = mymod_voting_weight_explanation_generic # Replace this with a custom loc tailored to each level, if you can be bothered
			FROMFROM = {
				holder_scope = {
					any_child_even_if_dead = {
						mymod_this_character_is_first_preference_under_fromfroms_gender_law = yes
						NOT = {
							any_sibling_even_if_dead = {
								mymod_this_character_is_first_preference_under_fromfroms_gender_law = yes
								is_older_than = PREV
							}
						}
						any_child_even_if_dead = {
							character = FROM
							mymod_this_character_is_first_preference_under_fromfroms_gender_law = yes
							any_sibling_even_if_dead = {
								mymod_this_character_is_first_preference_under_fromfroms_gender_law = yes
								is_older_than = PREV
								count == 3 # There are exactly this many **older** children
							}
						}
					}
				}
			}
		}
		
		additive_modifier = { # First child of second-preference gender of eldest child of first-preference gender
			value = 95000
			localisation_key = mymod_voting_weight_explanation_generic # Replace this with a custom loc tailored to each level, if you can be bothered
			FROMFROM = {
				holder_scope = {
					any_child_even_if_dead = {
						mymod_this_character_is_first_preference_under_fromfroms_gender_law = yes
						NOT = {
							any_sibling_even_if_dead = {
								mymod_this_character_is_first_preference_under_fromfroms_gender_law = yes
								is_older_than = PREV
							}
						}
						any_child_even_if_dead = {
							character = FROM
							mymod_this_character_is_second_preference_under_fromfroms_gender_law = yes
							NOT = {
								any_sibling_even_if_dead = {
									mymod_this_character_is_second_preference_under_fromfroms_gender_law = yes
									is_older_than = PREV
								}
							}
						}
					}
				}
			}
		}
		
		additive_modifier = { # Second child of second-preference gender of eldest child of first-preference gender
			value = 94000
			localisation_key = mymod_voting_weight_explanation_generic # Replace this with a custom loc tailored to each level, if you can be bothered
			FROMFROM = {
				holder_scope = {
					any_child_even_if_dead = {
						mymod_this_character_is_first_preference_under_fromfroms_gender_law = yes
						NOT = {
							any_sibling_even_if_dead = {
								mymod_this_character_is_first_preference_under_fromfroms_gender_law = yes
								is_older_than = PREV
							}
						}
						any_child_even_if_dead = {
							character = FROM
							mymod_this_character_is_second_preference_under_fromfroms_gender_law = yes
							any_sibling_even_if_dead = {
								mymod_this_character_is_second_preference_under_fromfroms_gender_law = yes
								is_older_than = PREV
								count == 1 # There are exactly this many **older** children
							}
						}
					}
				}
			}
		}
		
		additive_modifier = { # Third child of second-preference gender of eldest child of first-preference gender
			value = 93000
			localisation_key = mymod_voting_weight_explanation_generic # Replace this with a custom loc tailored to each level, if you can be bothered
			FROMFROM = {
				holder_scope = {
					any_child_even_if_dead = {
						mymod_this_character_is_first_preference_under_fromfroms_gender_law = yes
						NOT = {
							any_sibling_even_if_dead = {
								mymod_this_character_is_first_preference_under_fromfroms_gender_law = yes
								is_older_than = PREV
							}
						}
						any_child_even_if_dead = {
							character = FROM
							mymod_this_character_is_second_preference_under_fromfroms_gender_law = yes
							any_sibling_even_if_dead = {
								mymod_this_character_is_second_preference_under_fromfroms_gender_law = yes
								is_older_than = PREV
								count == 2 # There are exactly this many **older** children
							}
						}
					}
				}
			}
		}
		
		additive_modifier = { # Fourth child of second-preference gender of eldest child of first-preference gender
			value = 92000
			localisation_key = mymod_voting_weight_explanation_generic # Replace this with a custom loc tailored to each level, if you can be bothered
			FROMFROM = {
				holder_scope = {
					any_child_even_if_dead = {
						mymod_this_character_is_first_preference_under_fromfroms_gender_law = yes
						NOT = {
							any_sibling_even_if_dead = {
								mymod_this_character_is_first_preference_under_fromfroms_gender_law = yes
								is_older_than = PREV
							}
						}
						any_child_even_if_dead = {
							character = FROM
							mymod_this_character_is_second_preference_under_fromfroms_gender_law = yes
							any_sibling_even_if_dead = {
								mymod_this_character_is_second_preference_under_fromfroms_gender_law = yes
								is_older_than = PREV
								count == 3 # There are exactly this many **older** children
							}
						}
					}
				}
			}
		}
		
		
		
		
		
		additive_modifier = { # Second child of first-preference gender
			value = 90000
			localisation_key = mymod_voting_weight_explanation_generic # Replace this with a custom loc tailored to each level, if you can be bothered
			FROMFROM = {
				holder_scope = {
					any_child_even_if_dead = {
						character = FROM
						mymod_this_character_is_first_preference_under_fromfroms_gender_law = yes
						any_sibling_even_if_dead = {
							mymod_this_character_is_first_preference_under_fromfroms_gender_law = yes
							is_older_than = PREV
							count == 1 # There are exactly this many **older** children
						}
					}
				}
			}
		}
		
		additive_modifier = { # Eldest child of first-preference gender of second child of first-preference gender
			value = 99000
			localisation_key = mymod_voting_weight_explanation_generic # Replace this with a custom loc tailored to each level, if you can be bothered
			FROMFROM = {
				holder_scope = {
					any_child_even_if_dead = {
						mymod_this_character_is_first_preference_under_fromfroms_gender_law = yes
						any_sibling_even_if_dead = {
							mymod_this_character_is_first_preference_under_fromfroms_gender_law = yes
							is_older_than = PREV
							count == 1
						}
						any_child_even_if_dead = {
							character = FROM
							mymod_this_character_is_first_preference_under_fromfroms_gender_law = yes
							NOT = {
								any_sibling_even_if_dead = {
									mymod_this_character_is_first_preference_under_fromfroms_gender_law = yes
									is_older_than = PREV
								}
							}
						}
					}
				}
			}
		}
		
		...etc...
	}
	
...copy other things from base game eldership...
	
}

Code:
mymod_this_character_is_first_preference_under_fromfroms_gender_law = {
	OR = {
		FROMFROM = { has_law = true_cognatic_succession } # Abs Cog
		AND = {
			FROMFROM = {
				OR = {
					has_law = cognatic_succession # Ag-Cog
					has_law = agnatic_succession  # Ag
				}
			}
			is_female = no
		}
		AND = {
			FROMFROM = {
				OR = {
					has_law = enatic_cognatic_succession # En-Cog
					has_law = enatic_succession          # En
				}
			}
			is_female = yes
		}
	}
}

mymod_this_character_is_second_preference_under_fromfroms_gender_law = {
	OR = {
		AND = {
			FROMFROM = { has_law = cognatic_succession } # Ag-Cog
			is_female = yes
		}
		AND = {
			FROMFROM = { has_law = enatic_cognatic_succession } # En-Cog
			is_female = no
		}
	}
}

(Replace mymod_ with some unique identifier for your mod.)
 
What is causing the error log to spam "invalid character" for this trait - conqueror - in this CB? It works in game, AFAIK, but spams the log alot.

Code:
pagan_county_conquest = {
    name = CB_NAME_COUNTY_CONQUEST
    war_name = WAR_NAME_COUNTY_CONQUEST
    sprite = 22
    truce_days = 730
    hostile_against_others = yes
    is_permanent = yes
    check_all_titles = yes # if permanent, setting this to true will check against all of someones titles, including vassal held titles
    can_ask_to_join_war = no
    
    allow_distant = yes
    allowed_to_target_tributaries = no
    
    sort_priority = 700
    
    can_use = {
        ROOT = {
            mercenary = no
            conditional_tooltip = {
                trigger = {
                    NOT = {
                        trait = conqueror
                    }
                }
                NOT = {
                    has_character_modifier = county_conquest_timer
                }
            }
        }
        OR = {
            ROOT = {
                is_nomadic = yes
                NOT = { same_realm = FROM }
                FROM = {
                    OR = {
                        is_nomadic = yes
                        is_tribal = yes
                    }
                }
            }
            AND = {
                ROOT = {
                    OR = {
                        religion_group = pagan_group
                        religion_group = oceanic
                        religion = trotskyite
                        trait = conqueror
                        religion = khanist
                        religion = gnostic
                        religion = vagarna
                        religion = thelemic
                        primary_title = {
                        title = e_druze
                        }
                    }
                    NOT = { same_realm = FROM }
                }
                conditional_tooltip = {
                    trigger = {
                        NOT = {
                            trait = conqueror
                        }
                    }
                    FROM = {
                        NOT = { religion = ROOT }
                    }
                }
            }
        }
    }

    can_use_title = {
        ROOT = { bhutan_medium_cb = yes    }
        tier = count
        OR = {
            FROM = {
                has_landed_title = PREV
            }
            holder_scope = {
                is_liege_or_above = FROM
                NOT = { same_realm = ROOT }
            }
        }

        NOT = {
            OR = {
                ROOT = {
                    has_landed_title = PREV
                }
                holder_scope = {
                    is_liege_or_above = ROOT
                }
            }
        }
        
        OR = {
            AND = {
                ROOT = {
                    OR = {
                        religion_group = oceanic
                        religion = celtic_pagan
                        trait = conqueror
                        religion = inuit_pagan
                        religion = lakefolk_pagan
                        religion = hellenic_pagan
                        religion = gnostic
                        religion = vagarna
                        religion = thelemic
                        seafaring_doctrine_trigger = yes
                    }
                }
                location = {
                    port = yes
                }
            }
            location = {
                any_neighbor_province = {
                    owner = {
                        OR = {
                            character = ROOT
                            is_liege_or_above = ROOT
                        }
                    }
                }
            }
        }
    }

    is_valid_title = {
        OR = {
            ROOT = {
                is_nomadic = yes
            }
            AND = {
                ROOT = {
                    OR = {
                        religion_group = pagan_group
                        religion_group = oceanic
                        trait = conqueror
                        religion = trotskyite
                        religion = khanist
                        religion = gnostic
                        religion = vagarna
                        religion = thelemic
                        primary_title = {
                        title = e_druze
                        }
                    }
                    NOT = { same_realm = FROM }
                }
                conditional_tooltip = {
                    trigger = {
                        NOT = {
                            trait = conqueror
                        }
                    }
                    FROM = {
                        NOT = { religion = ROOT }
                    }
                }
            }
        }
    
        OR = {
            FROM = {
                has_landed_title = PREV
            }
            holder_scope = {
                is_liege_or_above = FROM
            }
        }
    }

    on_add = {
        general_on_add_effect = yes
    }

    on_success_title = { #winning the war
        usurp_title_plus_barony_if_unlanded = { target = ROOT type = invasion }
        
        any_de_jure_vassal_title = { # take all baronies too
            limit = {
                has_holder = yes
                holder_scope = {
                    OR = {
                        character = FROM
                        is_liege_or_above = FROM
                        AND = {
                            is_liege_or_above = ROOT
                            NOT = { culture = ROOT }
                            NOT = { religion = ROOT }
                        }
                    }
                }
            }
            show_scope_change = no
            usurp_title = ROOT
        }
        
        ROOT = {
            show_scope_change = no
            participation_scaled_prestige = 100
            participation_scaled_piety = 50
            add_character_modifier = {
                name = county_conquest_timer
                duration = 90
                hidden = yes
            }
        }
        any_attacker = {
            limit = { NOT = { character = ROOT } }
            hidden_tooltip = {
                participation_scaled_prestige = 100
                participation_scaled_piety = 50
            }
        }
        
        if = {
            limit = {
                NOT = { FROM = { religion = ROOT } }
            }
            ROOT = {
                show_scope_change = no
                religion_authority = {
                    modifier = won_county_conquest
                }
            }
        }

        #To handle Warrior Lodge mission "Wage War" completion...
        attacker = { save_event_target_as = attacker_target }
        defender = { save_event_target_as = defender_target }

        if = {
            limit = {
                event_target:attacker_target = { has_quest = quest_warrior_lodge_war }
                is_quest_target_of = event_target:attacker_target
            }
            event_target:attacker_target = {
                show_scope_change = no
                tooltip = { clr_quest = quest_warrior_lodge_war }
                set_character_flag = won_war@event_target:defender_target
                #character_event = { id = HF.10514 days = 3 } #Sent from on_action instead
            }
        }
    }

    on_fail_title = { #white peace
        ROOT = {
            show_scope_change = no
            prestige = -100
        }
        
        if = {
            limit = {
                NOT = { FROM = { religion = ROOT } }
            }
            ROOT = {
                show_scope_change = no
                religion_authority = {
                    modifier = lost_county_conquest
                }
            }
        }
    
        FROM = {
            show_scope_change = no
            participation_scaled_prestige = 50
        }
        any_defender = {
            limit = { NOT = { character = FROM } }
            hidden_tooltip = { participation_scaled_prestige = 50 }
        }

        #To handle Warrior Lodge mission "Wage War" completion...
        attacker = { save_event_target_as = attacker_target }
        defender = { save_event_target_as = defender_target }

        if = {
            limit = {
                event_target:attacker_target = { has_quest = quest_warrior_lodge_war }
                is_quest_target_of = event_target:attacker_target
            }
            event_target:attacker_target = {
                show_scope_change = no
                tooltip = { clr_quest = quest_warrior_lodge_war }
                set_character_flag = white_peace@event_target:defender_target
                #character_event = { id = HF.10514 days = 3 } #Sent from on_action instead
            }
        }
    }

    on_reverse_demand = { #losing the war
        ROOT = {
            show_scope_change = no
            prestige = -200
            transfer_scaled_wealth = {
                to = FROM
                value = 4.0
            }
        }
        
        if = {
            limit = {
                NOT = { FROM = { religion = ROOT } }
            }
            ROOT = {
                show_scope_change = no
                religion_authority = {
                    modifier = lost_county_conquest
                }
            }
        }
        
        FROM = {
            show_scope_change = no
            participation_scaled_prestige = 100
            participation_scaled_piety = 50
        }
        any_defender = {
            limit = { NOT = { character = FROM } }
            hidden_tooltip = {
                participation_scaled_prestige = 100
                participation_scaled_piety = 50
            }
        }
    }
    on_reverse_demand_title = {
        #To handle Warrior Lodge mission "Wage War" completion...
        attacker = { save_event_target_as = attacker_target }
        defender = { save_event_target_as = defender_target }

        if = {
            limit = {
                event_target:attacker_target = { has_quest = quest_warrior_lodge_war }
                is_quest_target_of = event_target:attacker_target
            }
            event_target:attacker_target = {
                show_scope_change = no
                tooltip = { clr_quest = quest_warrior_lodge_war }
                set_character_flag = lost_war@event_target:defender_target
                #character_event = { id = HF.10514 days = 3 } #Sent from on_action instead
            }
        }
    }

    attacker_ai_victory_worth = {
        factor = -1 # always accept
    }
    
    attacker_ai_defeat_worth = {
        factor = 100
    }

    defender_ai_victory_worth = {
        factor = -1 # always accept
    }
    
    defender_ai_defeat_worth = {
        factor = 100
    }
    
    ai_will_do = {
        factor = 1
        
        modifier = {
            factor = 3.0
            ROOT = {
                religion_group = oceanic
            }
            location = { port = yes }
        }
        modifier = {
            factor = 0.01
            ROOT = {
                religion = vagarna
            }
            NOT = {
                location = {
                    any_neighbor_province = {
                        owner = {
                            OR = {
                                character = ROOT
                                is_liege_or_above = ROOT
                            }
                        }
                    }
                }
            }
            location = { port = yes }
        }
        modifier = {
            factor = 0
            FROM = {
                is_nomadic = yes
            }
            ROOT = {
                is_nomadic = no
                NOT = {
                    is_tribal = yes
                }
            }
            NOT = {
                any_direct_de_jure_vassal_title = {
                    any_direct_de_jure_vassal_title = {
                        OR = {
                            holding_type = castle
                            holding_type = city
                        }
                    }
                }
            }
        }
        modifier = {
            factor = 0
            FROM = {
                is_nomadic = yes
            }
            ROOT = {
                is_tribal = yes
            }
            NOT = {
                any_direct_de_jure_vassal_title = {
                    any_direct_de_jure_vassal_title = {
                        OR = {
                            holding_type = castle
                            holding_type = city
                            holding_type = tribal
                        }
                    }
                }
            }
        }
    }
}
 
What is causing the error log to spam "invalid character" for this trait - conqueror - in this CB? It works in game, AFAIK, but spams the log alot.

In is_valid_title, conditional_tooltip is not in character scope, but in title scope.
Tip: Move everything there that's not related to the title into is_valid, so the game doesn't check it against each title, but before even checking anything against any title.
 
  • 1
Reactions:
If I make these rivers go to the ocean the game won't start anymore, what would be happening?
1731721967667.png

I'm saving like this
1731721976919.png
 
If I make these rivers go to the ocean the game won't start anymore, what would be happening?

[Snip]

Make sure you follow the instructions here regarding the colours used.

Other than that, the northern branch of the northern unconnected river appears to be lacking a source, which potentially could be part of the issue.
 
  • 1Like
Reactions:
Make sure you follow the instructions here regarding the colours used.

Other than that, the northern branch of the northern unconnected river appears to be lacking a source, which potentially could be part of the issue.
I think you only need one source per river system. At least the rivers.bmp on the wiki only has one green dot per system. (i.e. that doesn't look like the problem.) I don't know anything about map modding past what I read in the last 5 minutes, so I cannot offer any further advice.
 
Hello everyone, I would like to design an event: For any independent ruler who has many Skull of an Enemy, every ten years he would trigger an event to randomly select one Skull of an Enemy and remind him of the enemy from whom the artifact came, so he would gain piety or prestige.
But I'm not sure how to ensure that the event will select random Skull of an Enemy and how to mention the previous owner of the artifact. Could anyone help me?
 
Hello everyone, I would like to design an event: For any independent ruler who has many Skull of an Enemy, every ten years he would trigger an event to randomly select one Skull of an Enemy and remind him of the enemy from whom the artifact came, so he would gain piety or prestige.
But I'm not sure how to ensure that the event will select random Skull of an Enemy and how to mention the previous owner of the artifact. Could anyone help me?
In theory, you would want something like this:
Code:
# From character scope (eg. effect/immediate block of an event on the character who owns a qualifying skull)
random_artifact = {
	
	limit = {
		
		# Artifact is a rival's skull
		artifact_type = rival_skull
		
		# The artifact has been owned by exactly one person. IE: The current owner created the artifact.
		# (In the base game, the beheader is the artifact creator, and the beheadee doesn't show up in the history.)
		any_artifact_owner = { count == 1 }
		
	}
	
	original_owner = {
		# Either directly do something in here (not sure HOW exactly you'd do it though...)
		# Or save the original owner so you can use it in a subsequent event (eg. overriding the FROM portrait, including their name in localisation).
		save_event_target_as = mymod_event_target_rival_skull_beheadee
	}
	
	# And it might be useful to save a reference to the specific artifact that was randomly chosen.
	save_event_target_as = mymod_event_target_rival_skull
	
}

However, I'm not sure this would work in practice, as the "original owner" of rival skulls is only noted in the tooltip in-game (they are not present in the history). I suggest you do a quick test to be sure that this approach will actually work.
 
Last edited:
  • 1Like
Reactions:
In theory, you would want something like this:
Code:
# From character scope (eg. effect/immediate block of an event on the character who owns a qualifying skull)
random_artifact = {
   
    limit = {
       
        # Artifact is a rival's skull
        artifact_type = rival_skull
       
        # The artifact has been owned by exactly one person. IE: The current owner created the artifact.
        # (In the base game, the beheader is the artifact creator, and the beheadee doesn't show up in the history.)
        any_artifact_owner = { count == 1 }
       
    }
   
    original_owner = {
        # Either directly do something in here (not sure HOW exactly you'd do it though...)
        # Or save the original owner so you can use it in a subsequent event (eg. overriding the FROM portrait, including their name in localisation).
        save_event_target_as = mymod_event_target_rival_skull_beheadee
    }
   
    # And it might be useful to save a reference to the specific artifact that was randomly chosen.
    save_event_target_as = mymod_event_target_rival_skull
   
}

However, I'm not sure this would work in practice, as the "original owner" of rival skulls is only noted in the tooltip in-game (they are not present in the history). I suggest you do a quick test to be sure that this approach will actually work.
Thank you, I will conduct the test!
 
In theory, you would want something like this:
Code:
# From character scope (eg. effect/immediate block of an event on the character who owns a qualifying skull)
random_artifact = {
   
    limit = {
       
        # Artifact is a rival's skull
        artifact_type = rival_skull
       
        # The artifact has been owned by exactly one person. IE: The current owner created the artifact.
        # (In the base game, the beheader is the artifact creator, and the beheadee doesn't show up in the history.)
        any_artifact_owner = { count == 1 }
       
    }
   
    original_owner = {
        # Either directly do something in here (not sure HOW exactly you'd do it though...)
        # Or save the original owner so you can use it in a subsequent event (eg. overriding the FROM portrait, including their name in localisation).
        save_event_target_as = mymod_event_target_rival_skull_beheadee
    }
   
    # And it might be useful to save a reference to the specific artifact that was randomly chosen.
    save_event_target_as = mymod_event_target_rival_skull
   
}

However, I'm not sure this would work in practice, as the "original owner" of rival skulls is only noted in the tooltip in-game (they are not present in the history). I suggest you do a quick test to be sure that this approach will actually work.
Thank you, this is effective! And so on, I can write other events with similar functions! Thanks again!
 
  • 1Like
Reactions:
Has anyone used any_known_enemy_plotter in an effect scope before? The wiki indicates you can do it, but Validator throws up an error:

Invalid node "any_known_enemy_plotter" in scope CharCommand (value is: <a complex type>)

I have it in the immediate = {} clause of a hidden character event.

I also have it in the limit = {} clause of a character scope, and Validator doesn't like that either. (That is, I'm checking if any friends have a known enemy plotter with a specific flag, so it reads like this.)
Code:
immediate = {
     any_friend = {
          limit = {
               any_known_enemy_plotter = {
                    has_character_flag = mymodhasmarkedyou_flag
               }
          }
          character_event = { id = mymod.8999 }
     }
}
 
Last edited:
Has anyone used any_known_enemy_plotter in an effect scope before? The wiki indicates you can do it, but Validator throws up an error:

Invalid node "any_known_enemy_plotter" in scope CharCommand (value is: <a complex type>)

I have it in the immediate = {} clause of a hidden character event.

I also have it in the limit = {} clause of a character scope, and Validator doesn't like that either. (That is, I'm checking if any friends have a known enemy plotter with a specific flag, so it reads like this.)
Code:
immediate = {
     any_friend = {
          limit = {
               any_known_enemy_plotter = {
                    has_character_flag = mymodhasmarkedyou_flag
               }
          }
          character_event = { id = mymod.8999 }
     }
}
I haven't used it, but the Validator is not always correct - especially in these edge cases.

It's worth trying to set up some tests - eg. in the immediate block of a character event triggered on yourself: any_known_enemy_plotter = { ROOT = { character_event = mymod.8901 } } (and make 8901 a visible event) (you should receive 1 event per enemy plotter, where the plotter is in the FROM portrait - if you know you have enemy plotters then you should get lots of popups).
 
  • 1Like
Reactions:
Has anyone used any_known_enemy_plotter in an effect scope before? The wiki indicates you can do it, but Validator throws up an error:

Invalid node "any_known_enemy_plotter" in scope CharCommand (value is: <a complex type>)

I have it in the immediate = {} clause of a hidden character event.

I also have it in the limit = {} clause of a character scope, and Validator doesn't like that either. (That is, I'm checking if any friends have a known enemy plotter with a specific flag, so it reads like this.)
Code:
immediate = {
     any_friend = {
          limit = {
               any_known_enemy_plotter = {
                    has_character_flag = mymodhasmarkedyou_flag
               }
          }
          character_event = { id = mymod.8999 }
     }
}

This is likely due to nobody ever using it. It doesn't help that Paradox never documented what it even does.

I haven't used it, but the Validator is not always correct - especially in these edge cases.

It's worth trying to set up some tests - eg. in the immediate block of a character event triggered on yourself: any_known_enemy_plotter = { ROOT = { character_event = mymod.8901 } } (and make 8901 a visible event) (you should receive 1 event per enemy plotter, where the plotter is in the FROM portrait - if you know you have enemy plotters then you should get lots of popups).

This is indeed a decent way to find out if something works, whatever error.log and the Validator claim.
 
  • 1Like
Reactions:
This is likely due to nobody ever using it. It doesn't help that Paradox never documented what it even does.
@GodModder I guess I'll add that, if you do discover exactly how this is used and what it does, it'd be really good if you updated the wiki and submitted a Validator bug report.
 
  • 1Like
Reactions: