• 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.
Where to find "landless sons" penalty? I don't mean the defines, I mean I want to tweak which succession get the penalty for unlanded sons.
Pretty sure that's hardcoded.

any ideas on how to create a CB for if someone has a particular building, or if a province has a particular flag?
Use the any_demesne_province scope on the root character and either check the province for the flag or scope again to the individual holding in the provance and check the building, this will only work if you personally hold the province so you may want to use any_realm_province instead.
 
Use the any_demesne_province scope on the root character and either check the province for the flag or scope again to the individual holding in the provance and check the building, this will only work if you personally hold the province so you may want to use any_realm_province instead.

Sorry, I should have been clearer. My mod randomly adds flags to random provinces that allow either gold or silver mines to be built, which provide a large income.
What I want to do is have it so that other realms can declare war on people who have built a gold/silver mine - a greed CB

I tried some code, which is aimed at the province flags, not the actual buildings, but it doesn't seem to work
Code:
cfh_highvalue_gold_greed = {
    name = CFH_HIGHVALUE_CB_NAME_GOLD_GREED_CONQUEST
    war_name = CFH_HIGHVALUE_WAR_NAME_GOLD_GREED_CONQUEST
    sprite = 27
    truce_days = 3650
    hostile_against_others = yes
    full_hostility = 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
    allowed_to_target_tributaries = no
   
    infamy_modifier = 2
   
    sort_priority = 795
   
    can_use = {
        NOT = { 
            has_game_rule = {
                name = cfh_rule_highvalue
                value = off
            }
        }
        ROOT = {
            NOT = { is_liege_or_above = FROM }
            mercenary = no
            clan = no
            tier = count
        }
    }

    can_use_title = {
        OR = {
            if = {
                limit = { has_global_flag = cfh_gold_mine_1_flag }
                distance = { who = event_target:cfh_gold_mine_1_target value = 1000 }
            }
            if = {
                limit = { has_global_flag = cfh_gold_mine_2_flag }
                distance = { who = event_target:cfh_gold_mine_2_target value = 1000 }
            }
            if = {
                limit = { has_global_flag = cfh_gold_mine_3_flag }
                distance = { who = event_target:cfh_gold_mine_3_target value = 1000 }
            }
            if = {
                limit = { has_global_flag = cfh_gold_mine_4_flag }
                distance = { who = event_target:cfh_gold_mine_4_target value = 1000 }
            }
            if = {
                limit = { has_global_flag = cfh_gold_mine_5_flag }
                distance = { who = event_target:cfh_gold_mine_5_target value = 1000 }
            }
            if = {
                limit = { has_global_flag = cfh_gold_mine_6_flag }
                distance = { who = event_target:cfh_gold_mine_6_target value = 1000 }
            }
            if = {
                limit = { has_global_flag = cfh_gold_mine_7_flag }
                distance = { who = event_target:cfh_gold_mine_7_target value = 1000 }
            }
            if = {
                limit = { has_global_flag = cfh_gold_mine_8_flag }
                distance = { who = event_target:cfh_gold_mine_8_target value = 1000 }
            }
            if = {
                limit = { has_global_flag = cfh_gold_mine_9_flag }
                distance = { who = event_target:cfh_gold_mine_9_target value = 1000 }
            }
            if = {
                limit = { has_global_flag = cfh_gold_mine_10_flag }
                distance = { who = event_target:cfh_gold_mine_10_target value = 1000 }
            }
            if = {
                limit = { has_global_flag = cfh_gold_mine_11_flag }
                distance = { who = event_target:cfh_gold_mine_11_target value = 1000 }
            }
            if = {
                limit = { has_global_flag = cfh_gold_mine_12_flag }
                distance = { who = event_target:cfh_gold_mine_12_target value = 1000 }
            }
            if = {
                limit = { has_global_flag = cfh_gold_mine_13_flag }
                distance = { who = event_target:cfh_gold_mine_13_target value = 1000 }
            }
            if = {
                limit = { has_global_flag = cfh_gold_mine_14_flag }
                distance = { who = event_target:cfh_gold_mine_14_target value = 1000 }
            }
            if = {
                limit = { has_global_flag = cfh_gold_mine_15_flag }
                distance = { who = event_target:cfh_gold_mine_15_target value = 1000 }
            }
        {
    }

    is_valid_title = {
        OR = {
            FROM = {
                has_landed_title = PREV
            }
            holder_scope = {
                is_liege_or_above = FROM
            }
        }
    }

    on_success_title = {
        usurp_title_plus_barony_if_unlanded = { target = ROOT type = invasion }
        any_de_jure_vassal_title = { # take all baronies under the one we're fighting for
    }

    on_fail_title = {
        ROOT = {
            prestige = -100
        }
        FROM = {
            participation_scaled_prestige = 50
        }
        any_defender = {
            limit = { NOT = { character = FROM } }
            hidden_tooltip = { participation_scaled_prestige = 50 }
        }
    }

    on_reverse_demand = {
        ROOT = {
            prestige = -100
            transfer_scaled_wealth = {
                to = FROM
                value = 2.0
            }
        }
        FROM = {
            participation_scaled_prestige = 100
        }
        any_defender = {
            limit = { NOT = { character = FROM } }
            hidden_tooltip = { participation_scaled_prestige = 100 }
        }
    }
   
    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 = 0.1
            ROOT = {
                independent = no
                same_liege = FROM
            }
        }
    }
}

CB modding is admittedly much less straight forward than the other areas I've tried my hand at, and I'm unaware of any similar cb's I could reference
 
Distance can't be used on a title, only a character or province. Try putting the contents of your can_use_title in a location block instead:
Code:
can_use_title = {
   location = {
      OR = {
         # Stuff
      }
   }
}
 
Code:
    make_eunuch = {
        filter = all
        
        from_potential = {
            has_character_flag = cheats_enabled
            ai = no
            trait = eunuch
        }
        potential = {
            ai = yes
        }
        allow = {
            always = yes
        }
        effect = {
            add_trait = eunuch
        }
        revoke_allowed = {
            always = no
        }
        ai_will_do = {
            factor = 0
        }
    }
    
    remove_eunuch = {
        filter = all
        
        from_potential = {
            has_character_flag = cheats_enabled
            ai = no
            trait = eunuch
        }
        potential = {
            ai = yes
        }
        allow = {
            always = yes
        }
        effect = {
            remove_trait = eunuch
        }
        revoke_allowed = {
            always = no
        }
        ai_will_do = {
            factor = 0
        }
    }


Code:
make_eunuch;Make eunuch;;;;;;;;;;;;;x
make_eunuch_desc;Make them eunuch.;;;;;;;;;;;;;x

remove_eunuch;Remove eunuch;;;;;;;;;;;;;x
remove_eunuch_desc;Remove their eunuch trait.;;;;;;;;;;;;;x
What went wrong? I try to make cheaty option but it doesn't appear in game? I must be missing something.
 
In make_eunuch and remove_eunuch, the options are only available if the character taking the decision is a eunuch. Is this intentional?
Also, both decisions would be available regardless of whether the target is a eunuch. This won't stop it from displaying, but could be confusing
 
For make_eunuch, you want to include "NOT = { trait = eunuch }" in the potential, and for remove_eunuch, you want "trait = eunuch" in the potential. Neither should have "trait = eunuch" in the from_potential. For a targetted decision, FROM is the character making the decision and ROOT (default for potential and allow) is the target of the decision
 
I am trying to make a custom background for a wonder, but even after I have defined it in a gfx file and used
Code:
background_overrides = {
    All = GFX_wonder_background_phoenican_port
}
it still refuses to work, any ideas?

unknown.png

Code:
wonder_carthage_harbour = {
    allow_construction = no
    picture = GFX_wonder_strip_carthage_harbour
    show_model = no
    #default_picture_stage = 0
  
    background_overrides = { All = GFX_wonder_background_phoenican_port }
  
    potential = { }

    active = {
        ROOT = {
            culture = punic
        }
    }
  
    flags = {
        is_historical
        is_destructible
        defensive
        cost_medium
    }
    available_upgrades = {
        # UNIQUE:
      
        upgrade_warehouse_trade #Stewardship + Trade value + income
        upgrade_warehouse_war #Martial + Levy size + 1500 Personal Guards
        upgrade_warehouse_naval #Martial + More Boats + Naval something modifier
        upgrade_drydock1 #More Boats - 20
        upgrade_drydock2 #Even More Boats - 25
        upgrade_drydock3 #Too Many More Boats - 30
        upgrade_phoenician_quay #Boats (Not really) Just supply
        upgrade_cothon

        # OTHER:
        upgrade_roads
        upgrade_gatehouse_forts
        upgrade_deep_defense_architecture
        #upgrade_watchtower_network
        #upgrade_spikes
        #upgrade_armory
        upgrade_tower
        #upgrade_hypocausts
        #upgrade_heating_pipes
        upgrade_retinue
        upgrade_road_tolls
        upgrade_walls_sea
        upgrade_studded_bastions
    }
    stage = {
        allow = {
        }
        build_time = 250
        gold_cost_flat = 2450
        gold_cost_ticking = 5
        restore_time = 150
        loot_time = 100
        restore_cost_flat = 400
        restore_cost_ticking = 2
        upgrade_slots = 3
        local_modifier = {
            local_tax_modifier = 0.05
            tradevalue = 25
        }
        owner_modifier = {
            monthly_character_prestige = 0.15
            punic_opinion = 5
        }
    }
    stage = {
        allow = {
        }
        build_time = 300
        gold_cost_flat = 1000
        gold_cost_ticking = 3
        restore_time = 200
        loot_time = 100
        restore_cost_flat = 500
        restore_cost_ticking = 2
        upgrade_slots = 3
        local_modifier = {
            local_tax_modifier = 0.025
            tradevalue = 25
        }
        owner_modifier = {
            monthly_character_prestige = 0.15
            punic_opinion = 5
        }
    }
    stage = {
        allow = {
        }
        build_time = 300
        gold_cost_flat = 1000
        gold_cost_ticking = 3
        restore_time = 200
        loot_time = 20
        restore_cost_flat = 500
        restore_cost_ticking = 2
        upgrade_slots = 2
        local_modifier = {
            local_tax_modifier = 0.05
            tradevalue = 25
        }
        owner_modifier = {
            monthly_character_prestige = 0.15
            punic_opinion = 5
        }
    }
    stage = {
        allow = {
        }
        build_time = 300
        gold_cost_flat = 1000
        gold_cost_ticking = 3
        restore_time = 200
        loot_time = 20
        restore_cost_flat = 500
        restore_cost_ticking = 2
        upgrade_slots = 2
        local_modifier = {
            local_tax_modifier = 0.05
            tradevalue = 25
        }
        owner_modifier = {
            monthly_character_prestige = 0.15
            build_cost_modifier = 0.1
            general_opinion = 3
        }
    }
}

Code:
spriteTypes = {
    #Backgrounds for wonders
    spriteType = {
        name = "GFX_wonder_background_phoenican_port_small"
        texturefile = "gfx\\interface\\wonder_interface\\wonder_backgrounds\\wonder_background_phoenican_port_small.dds"
        noOfFrames = 1
    }
    spriteType = {
        name = "GFX_wonder_background_phoenican_port_medium"
        texturefile = "gfx\\interface\\wonder_interface\\wonder_backgrounds\\wonder_background_phoenican_port_medium.dds"
        noOfFrames = 1
    }
    spriteType = {
        name = "GFX_wonder_background_phoenican_port_large"
        texturefile = "gfx\\interface\\wonder_interface\\wonder_backgrounds\\wonder_background_phoenican_port_large.dds"
        noOfFrames = 1
    }
}

upload_2019-5-11_20-57-32.png

EDIT: I just tested the .dds files with an event, and they didnt appear, so it seems the issue is with the images or the gfx files... but i still have no clue
 
I am trying to make a custom background for a wonder, but even after I have defined it in a gfx file and used
Code:
background_overrides = {
    All = GFX_wonder_background_phoenican_port
}
it still refuses to work, any ideas?

unknown.png

Code:
wonder_carthage_harbour = {
    allow_construction = no
    picture = GFX_wonder_strip_carthage_harbour
    show_model = no
    #default_picture_stage = 0
 
    background_overrides = { All = GFX_wonder_background_phoenican_port }
 
    potential = { }

    active = {
        ROOT = {
            culture = punic
        }
    }
 
    flags = {
        is_historical
        is_destructible
        defensive
        cost_medium
    }
    available_upgrades = {
        # UNIQUE:
     
        upgrade_warehouse_trade #Stewardship + Trade value + income
        upgrade_warehouse_war #Martial + Levy size + 1500 Personal Guards
        upgrade_warehouse_naval #Martial + More Boats + Naval something modifier
        upgrade_drydock1 #More Boats - 20
        upgrade_drydock2 #Even More Boats - 25
        upgrade_drydock3 #Too Many More Boats - 30
        upgrade_phoenician_quay #Boats (Not really) Just supply
        upgrade_cothon

        # OTHER:
        upgrade_roads
        upgrade_gatehouse_forts
        upgrade_deep_defense_architecture
        #upgrade_watchtower_network
        #upgrade_spikes
        #upgrade_armory
        upgrade_tower
        #upgrade_hypocausts
        #upgrade_heating_pipes
        upgrade_retinue
        upgrade_road_tolls
        upgrade_walls_sea
        upgrade_studded_bastions
    }
    stage = {
        allow = {
        }
        build_time = 250
        gold_cost_flat = 2450
        gold_cost_ticking = 5
        restore_time = 150
        loot_time = 100
        restore_cost_flat = 400
        restore_cost_ticking = 2
        upgrade_slots = 3
        local_modifier = {
            local_tax_modifier = 0.05
            tradevalue = 25
        }
        owner_modifier = {
            monthly_character_prestige = 0.15
            punic_opinion = 5
        }
    }
    stage = {
        allow = {
        }
        build_time = 300
        gold_cost_flat = 1000
        gold_cost_ticking = 3
        restore_time = 200
        loot_time = 100
        restore_cost_flat = 500
        restore_cost_ticking = 2
        upgrade_slots = 3
        local_modifier = {
            local_tax_modifier = 0.025
            tradevalue = 25
        }
        owner_modifier = {
            monthly_character_prestige = 0.15
            punic_opinion = 5
        }
    }
    stage = {
        allow = {
        }
        build_time = 300
        gold_cost_flat = 1000
        gold_cost_ticking = 3
        restore_time = 200
        loot_time = 20
        restore_cost_flat = 500
        restore_cost_ticking = 2
        upgrade_slots = 2
        local_modifier = {
            local_tax_modifier = 0.05
            tradevalue = 25
        }
        owner_modifier = {
            monthly_character_prestige = 0.15
            punic_opinion = 5
        }
    }
    stage = {
        allow = {
        }
        build_time = 300
        gold_cost_flat = 1000
        gold_cost_ticking = 3
        restore_time = 200
        loot_time = 20
        restore_cost_flat = 500
        restore_cost_ticking = 2
        upgrade_slots = 2
        local_modifier = {
            local_tax_modifier = 0.05
            tradevalue = 25
        }
        owner_modifier = {
            monthly_character_prestige = 0.15
            build_cost_modifier = 0.1
            general_opinion = 3
        }
    }
}

Code:
spriteTypes = {
    #Backgrounds for wonders
    spriteType = {
        name = "GFX_wonder_background_phoenican_port_small"
        texturefile = "gfx\\interface\\wonder_interface\\wonder_backgrounds\\wonder_background_phoenican_port_small.dds"
        noOfFrames = 1
    }
    spriteType = {
        name = "GFX_wonder_background_phoenican_port_medium"
        texturefile = "gfx\\interface\\wonder_interface\\wonder_backgrounds\\wonder_background_phoenican_port_medium.dds"
        noOfFrames = 1
    }
    spriteType = {
        name = "GFX_wonder_background_phoenican_port_large"
        texturefile = "gfx\\interface\\wonder_interface\\wonder_backgrounds\\wonder_background_phoenican_port_large.dds"
        noOfFrames = 1
    }
}


EDIT: I just tested the .dds files with an event, and they didnt appear, so it seems the issue is with the images or the gfx files... but i still have no clue
Since it is a unique wonder, don't bother with the dynamic background, just include it into your wonder graphics.

"all" is definetly not a correct trigger for backgrounds, iirc it should be something terrain related.
The background graphic file should be a strip of pictures, not individuals.
 
Does anybody knows where I can find the files for the decision to get a concubine (I want to mod it)?

Taking someone as a concubine is hardcoded. You could mod in your own decision to let you do it in different ways (within some limits), but that wouldn't affect how the original decision works, and though you could disable that in the defines if you want to do so that would mean the AI would have to use something else, meaning you'd need to add your own AI logic and likely some loss of performance, so it isn't really recommended.
 
For make_eunuch, you want to include "NOT = { trait = eunuch }" in the potential, and for remove_eunuch, you want "trait = eunuch" in the potential. Neither should have "trait = eunuch" in the from_potential. For a targetted decision, FROM is the character making the decision and ROOT (default for potential and allow) is the target of the decision
Works like a charm, thank you very much.

Code:
    succ_papal_succession = {
        potential = {
            OR = {
                title = k_papal_state
                title = d_baltic_pagan_reformed
                title = d_tengri_pagan_reformed
                title = d_finnish_pagan_reformed
                title = d_aztec_reformed
                title = d_slavic_pagan_reformed
                title = d_west_african_pagan_reformed
                title = d_zun_pagan_reformed
                title = d_zoroastrian
                title = d_jewish
                title = d_fraticelli
            }
        }
        effect = {
            succession = papal_succession
        }
        revoke_allowed = {
            always = no
        }

Code:
    succ_open_elective = {
        potential = {
            NOR = {
                title = k_papal_state
                title = d_baltic_pagan_reformed
                title = d_tengri_pagan_reformed
                title = d_finnish_pagan_reformed
                title = d_aztec_reformed
                title = d_slavic_pagan_reformed
                title = d_west_african_pagan_reformed
                title = d_zun_pagan_reformed
                title = d_zoroastrian
                title = d_jewish
                title = d_fraticelli
                title = e_byzantium
                title = e_roman_empire
            }
            NOT = { title = k_papal_state }
            temporary = no
            OR = {
                is_primary_type_title = yes
                holy_order = yes
                AND = {
                    tier = baron
                    OR = {
                        is_republic = yes
                        AND = {
                            is_theocracy = yes
                            NOT = { holder_scope = { religion_group = muslim } }
                        }
                    }
                }
                holder_scope = {
                    OR = {
                        is_republic = yes
                        AND = {
                            is_theocracy = yes
                            NOT = { religion_group = muslim }
                        }
                    }
                }
            }
            OR = {
                is_landless_type_title = yes
                holder_scope = { is_theocracy = no }
                holder_scope = {
                    NOT = { religion = catholic }
                    NOT = { religion = fraticelli }
                }
            }
            holder_scope = {
                is_patrician = no
                is_merchant_republic = no
                OR = {
                    independent = yes
                    is_feudal = no
                    NOT = {
                        any_liege = {
                            holy_order = yes
                        }
                    }
                }
            }
            NAND = {
                has_law = succession_voting_power_1
                OR = {
                    has_law = succ_feudal_elective
                    has_law = succ_hre_elective
                }
            }
            NOT = { holder_scope = { government = confucian_bureaucracy } }
            NOT = { holder_scope = { government = chinese_imperial_government } }
        }
        
        effect = {
            succession = open_elective
        }
        revoke_allowed = {
            always = no
        }
    }
Well I tried my best to reimplement the "pagan papal" mod to new version of ck2 but something is going wrong here and I can't figure out why. It says no elector for finnish pagan one, and stays open elective for the tengri one :(
 
I haven't successfully gotten papal succession to work outside of Catholicism (though if you can bring up the college of cardinals without crashing, you did better than my attempt).

If you do get it, it would probably be best to attach the functionality to a new leadership reformation option for pagans, which will create a heirocratic head using this succession. This will avoid issues if the player reforms with temporal or autocephalus, which I suspect will cause problems, while also giving reformers a choice on if they want to use it. Related, you can add d_norse_pagan_reformed to the list, since they aren't always playable now.
 
I haven't successfully gotten papal succession to work outside of Catholicism (though if you can bring up the college of cardinals without crashing, you did better than my attempt).

If you do get it, it would probably be best to attach the functionality to a new leadership reformation option for pagans, which will create a heirocratic head using this succession. This will avoid issues if the player reforms with temporal or autocephalus, which I suspect will cause problems, while also giving reformers a choice on if they want to use it. Related, you can add d_norse_pagan_reformed to the list, since they aren't always playable now.

I believe you can get the college of cardinals to not crash if you edit the GUI files - there's actually a wiki page on GUI modding that tells you exactly how to do that. I know you can get anyone to have papal succession if you make enough of the other succession laws unavailable, but I have no idea what happens when multiple people of the same religion have papal succession.
 
Since it is a unique wonder, don't bother with the dynamic background, just include it into your wonder graphics.

"all" is definetly not a correct trigger for backgrounds, iirc it should be something terrain related.
The background graphic file should be a strip of pictures, not individuals.
Well then, I guess the wiki is wrong :confused:. Thanks for the help, I'll just assign it to every terrrain type or just include it in the gfx. I just want that nice highlight behind the wonder.
 
I haven't successfully gotten papal succession to work outside of Catholicism (though if you can bring up the college of cardinals without crashing, you did better than my attempt).

If you do get it, it would probably be best to attach the functionality to a new leadership reformation option for pagans, which will create a heirocratic head using this succession. This will avoid issues if the player reforms with temporal or autocephalus, which I suspect will cause problems, while also giving reformers a choice on if they want to use it. Related, you can add d_norse_pagan_reformed to the list, since they aren't always playable now.
Well I do use heirocratic in this case. And so far I don't get college of cardinals. In that mod there is .gui files but that's not something I know. By the way I know I'm asking much, but would you check that mod file when you have spare time?

Edit: I don't know how to tie heirocratic to papal succession. I just happened to reform my religion as heirocratic in the game.

Edit2: As for temporals any way to make theocratic titles revert back to liege?
 
Last edited: