• 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 have a custom religion that the player can found by decision. I would like to randomly decide what its holy sites are based on proximity to the player at the time the religion is founded. (Similar to how Alternate Start randomly generates holy sites based on proximity to centers of that religion.)

I know of the set_holy_site command, but I'm not sure how to tell the game to choose holy sites based on proximity in the same manner as Alternate Start's holy site randomization. Can someone point me in a direction for this, please? Thanks.

The holy_site_spread parameter in \common\alternate_start\01_spread.txt gives some ideas, but I'm completely lost on how to translate that to a scripted command activated by the religion-founding decision.

A rough idea that'll need some expansion:

Code:
set_up_holy_sites_effect = { # Put in the scripted_effects folder, call from the religion creator after swapping their religion to the new religion
    any_province = {
        limit = {
            is_holy_site = ROOT
        }
        remove_holy_site = ROOT
    }
    
    # Creator's capital should probably be a holy site
    capital_scope = {
        county = {
            save_event_target_as = holy_site_1
        }
    }
    
    # Add four additional holy site locations
    any_province = {
        limit = {
            is_land = yes
            has_owner = yes
            NOR = {
                province = event_target:holy_site_1
                any_neighbor_province = {
                    province = event_target:holy_site_1
                }
            }
            # Possibly add more limits, e.g. having a temple holding, being within a certain distance, being further than a certain distance
        }
        
        score_value = {
            value = 10
            holy_site_province_selection_score = yes
        }
        
        county = {
            save_event_target_as = holy_site_2
        }
    }
    
    any_province = {
        limit = {
            is_land = yes
            has_owner = yes
            NOR = {
                province = event_target:holy_site_1
                any_neighbor_province = {
                    province = event_target:holy_site_1
                }
                province = event_target:holy_site_2
                any_neighbor_province = {
                    province = event_target:holy_site_2
                }
            }
            # Possibly add more limits, e.g. having a temple holding, being within a certain distance, being further than a certain distance
        }
        
        score_value = {
            value = 10
            holy_site_province_selection_score = yes
        }
        
        county = {
            save_event_target_as = holy_site_3
        }
    }
    
    any_province = {
        limit = {
            is_land = yes
            has_owner = yes
            NOR = {
                province = event_target:holy_site_1
                any_neighbor_province = {
                    province = event_target:holy_site_1
                }
                province = event_target:holy_site_2
                any_neighbor_province = {
                    province = event_target:holy_site_2
                }
                province = event_target:holy_site_3
                any_neighbor_province = {
                    province = event_target:holy_site_3
                }
            }
            # Possibly add more limits, e.g. having a temple holding, being within a certain distance, being further than a certain distance
        }
        
        score_value = {
            value = 10
            holy_site_province_selection_score = yes
        }
        
        county = {
            save_event_target_as = holy_site_4
        }
    }
    
    any_province = {
        limit = {
            is_land = yes
            has_owner = yes
            NOR = {
                province = event_target:holy_site_1
                any_neighbor_province = {
                    province = event_target:holy_site_1
                }
                province = event_target:holy_site_2
                any_neighbor_province = {
                    province = event_target:holy_site_2
                }
                province = event_target:holy_site_3
                any_neighbor_province = {
                    province = event_target:holy_site_3
                }
                province = event_target:holy_site_4
                any_neighbor_province = {
                    province = event_target:holy_site_4
                }
            }
            # Possibly add more limits, e.g. having a temple holding, being within a certain distance, being further than a certain distance
        }
        
        score_value = {
            value = 10
            holy_site_province_selection_score = yes
        }
        
        county = {
            save_event_target_as = holy_site_5
        }
    }
    
    # Actually add the new holy sites
    event_target:holy_site_1 = {
        set_holy_site = ROOT
    }
    
    event_target:holy_site_2 = {
        set_holy_site = ROOT
    }
    
    event_target:holy_site_3 = {
        set_holy_site = ROOT
    }
    
    event_target:holy_site_4 = {
        set_holy_site = <ROOT
    }
    
    event_target:holy_site_5 = {
        set_holy_site = ROOT
    }
}


holy_site_province_selection_score = { # Put in the scripted_score_values folder
    # Put weights here
}

The above, with some distance checks and possibly some weights should allow you to get five holy sites with a reasonable spread.
 
  • 1
Reactions:
A rough idea that'll need some expansion:

Code:
set_up_holy_sites_effect = { # Put in the scripted_effects folder, call from the religion creator after swapping their religion to the new religion
    any_province = {
        limit = {
            is_holy_site = ROOT
        }
        remove_holy_site = ROOT
    }
   
    # Creator's capital should probably be a holy site
    capital_scope = {
        county = {
            save_event_target_as = holy_site_1
        }
    }
   
    # Add four additional holy site locations
    any_province = {
        limit = {
            is_land = yes
            has_owner = yes
            NOR = {
                province = event_target:holy_site_1
                any_neighbor_province = {
                    province = event_target:holy_site_1
                }
            }
            # Possibly add more limits, e.g. having a temple holding, being within a certain distance, being further than a certain distance
        }
       
        score_value = {
            value = 10
            holy_site_province_selection_score = yes
        }
       
        county = {
            save_event_target_as = holy_site_2
        }
    }
   
    any_province = {
        limit = {
            is_land = yes
            has_owner = yes
            NOR = {
                province = event_target:holy_site_1
                any_neighbor_province = {
                    province = event_target:holy_site_1
                }
                province = event_target:holy_site_2
                any_neighbor_province = {
                    province = event_target:holy_site_2
                }
            }
            # Possibly add more limits, e.g. having a temple holding, being within a certain distance, being further than a certain distance
        }
       
        score_value = {
            value = 10
            holy_site_province_selection_score = yes
        }
       
        county = {
            save_event_target_as = holy_site_3
        }
    }
   
    any_province = {
        limit = {
            is_land = yes
            has_owner = yes
            NOR = {
                province = event_target:holy_site_1
                any_neighbor_province = {
                    province = event_target:holy_site_1
                }
                province = event_target:holy_site_2
                any_neighbor_province = {
                    province = event_target:holy_site_2
                }
                province = event_target:holy_site_3
                any_neighbor_province = {
                    province = event_target:holy_site_3
                }
            }
            # Possibly add more limits, e.g. having a temple holding, being within a certain distance, being further than a certain distance
        }
       
        score_value = {
            value = 10
            holy_site_province_selection_score = yes
        }
       
        county = {
            save_event_target_as = holy_site_4
        }
    }
   
    any_province = {
        limit = {
            is_land = yes
            has_owner = yes
            NOR = {
                province = event_target:holy_site_1
                any_neighbor_province = {
                    province = event_target:holy_site_1
                }
                province = event_target:holy_site_2
                any_neighbor_province = {
                    province = event_target:holy_site_2
                }
                province = event_target:holy_site_3
                any_neighbor_province = {
                    province = event_target:holy_site_3
                }
                province = event_target:holy_site_4
                any_neighbor_province = {
                    province = event_target:holy_site_4
                }
            }
            # Possibly add more limits, e.g. having a temple holding, being within a certain distance, being further than a certain distance
        }
       
        score_value = {
            value = 10
            holy_site_province_selection_score = yes
        }
       
        county = {
            save_event_target_as = holy_site_5
        }
    }
   
    # Actually add the new holy sites
    event_target:holy_site_1 = {
        set_holy_site = ROOT
    }
   
    event_target:holy_site_2 = {
        set_holy_site = ROOT
    }
   
    event_target:holy_site_3 = {
        set_holy_site = ROOT
    }
   
    event_target:holy_site_4 = {
        set_holy_site = <ROOT
    }
   
    event_target:holy_site_5 = {
        set_holy_site = ROOT
    }
}


holy_site_province_selection_score = { # Put in the scripted_score_values folder
    # Put weights here
}

The above, with some distance checks and possibly some weights should allow you to get five holy sites with a reasonable spread.
Thank you very much for going to the trouble! That looks much easier for my brain to parse and work with.
 
Every-time I try to mod an event in this game I feel like am hitting my head against the theodosian walls.

So basically I want to create an event chain. So I write up the code, checking if it works in-game bit by bit. First event works as intended however when I add the second event and trigger the first event in-game the second event comes up instead. I used the charinfo to check the event and the id reads 'eventId 0' so am going to throw the event code up here hoping someone smarter than me can give me some advice. THANK YOU!
 

Attachments

  • test_event.txt
    2,8 KB · Views: 0
Every-time I try to mod an event in this game I feel like am hitting my head against the theodosian walls.

So basically I want to create an event chain. So I write up the code, checking if it works in-game bit by bit. First event works as intended however when I add the second event and trigger the first event in-game the second event comes up instead. I used the charinfo to check the event and the id reads 'eventId 0' so am going to throw the event code up here hoping someone smarter than me can give me some advice. THANK YOU!
Your namespace.

The event namespaces have to be the same as the declared namespace at the top. You either have to have namespace = oedipus_rex at the top, or change the event namespaces so they're id = test.1, test.2, etc. Now, I believe I've read before that namespaces aren't as important as I thought they were, so that may not be the issue, but it does immediately leap out at me.
 
Namespaces are absolutely of the utmost importance. You can do without them, but doing so is about as wise as trying to prolong your life without water and food.
 
Your namespace.

The event namespaces have to be the same as the declared namespace at the top. You either have to have namespace = oedipus_rex at the top, or change the event namespaces so they're id = test.1, test.2, etc. Now, I believe I've read before that namespaces aren't as important as I thought they were, so that may not be the issue, but it does immediately leap out at me.
Much appreciated changing the namespace worked.
 
Last edited:
Good morning. I have another question about event modding. I have run into an issue where I trigger an event it says id not found.

'There is no event with ID #2200005'

The character events work up to .004, but the events after are the ones the game says can't find. I have edited the code to see if each event works on its own, which they do, but all together is when issues arise.
 

Attachments

  • greektale_events.txt
    4 KB · Views: 0
Last edited:
Good morning. I have another question about event modding. I have run into an issue where I trigger an event it says id not found.

'There is no event with ID #2200005'

The character events work up to .004, but the events after are the ones the game says can't find. I have edited the code to see if each event works on its own, which they do, but all together is when issues arise.
You're missing a closing curly-bracket "}" in .004 and .006. (From your indentation, it looks like the } is missing from the option block.)

If you still get errors, I suggest you install the Validator and see if it can find anything.
 
  • 1Like
Reactions:
Darn, you have good eyes! Thank you, all the events are working down.
FYI, I loaded it up in Notepad++ and used the built-in function that allows you to expand/collapse blocks of code. Those two events did not collapse correctly, so I investigated further.
 
  • 1
  • 1Like
Reactions:
FYI, I loaded it up in Notepad++ and used the built-in function that allows you to expand/collapse blocks of code. Those two events did not collapse correctly, so I investigated further.
If you're going to do a significant amount of modding, it really is worth using The Validator. It will catch many errors and tell you exactly what's wrong. Also, frequently check that your mod is working. Don't work on it for a week before trying it out, as a lot could be broken, or you could simply be on the wrong track of how to do something.
 
  • 1
Reactions:
If you're going to do a significant amount of modding, it really is worth using The Validator. It will catch many errors and tell you exactly what's wrong. Also, frequently check that your mod is working. Don't work on it for a week before trying it out, as a lot could be broken, or you could simply be on the wrong track of how to do something.
I second this. I learned this the hard way.
 
Thirded; it's definitely better to know that a CTD or other issue was caused by something you've done in e.g. the last day than "At any point after <thing further back>".
 
Thirded; it's definitely better to know that a CTD or other issue was caused by something you've done in e.g. the last day than "At any point after <thing further back>".
Fourthed; it may be annoying to have to reload the game constantly, but debugging is so so so much worse.
 
A few questions regarding councillor model interface file modding, because I've not touched that in a long time:

- Looking at some of the relevant interface files, the "name" entry seems to be structured as <culturegfx or religiongfx>_<job title><possibly female>. If there's both an available culturegfx model and an available religiongfx model, which takes precedence?

- Do fallbacks work as they do for portraits, i.e. "Pick the first gfx for the culture/religion that's defined in an interface file", or is there some other logic for the models?

- If a gfx is defined in an interface file but the model is missing due to a missing DLC, does that result in an invisible councillor or will it select the first fallback that has an existing model?

- If a specific councillor for a certain gfx is defined in multiple files, which definition takes precedence?
 
Hi!

Any idea how I could edit the alternate starts, namely to limit "religions = random" and "cultures = random" options to certain macro-regions? Essentially, a mix between historical and random, where Indian cultures for example would stay in India, but shift around there? Or Catholicism would stay in Europe and the Middle-East?

I always use historical religions and culture, because I don't like Somali culture in Iceland, or Catholicism in India. But some variety would be nice.

Edit: Also, how come there's no proper map anywhere of the world regions? Do I really have to add EVERY SINGLE PROVINCE to a blank map with MS paint? Why are the modding resources for this game so bad?
 
Last edited:
Does the scope any_dejure_vassal_title only look at created/held titles? I have a decision that combines held empires into one, by making the de jure kingdom titles of the non-primary empires into the de jure vassals of the primary empire, then destroying the secondary empires, but it doesn't seem to affect every kingdom that was de jure vassal to the forfeited empires, and the only thing that leaps to mind is that those kingdom titles aren't created or held by anyone.
 
Is there a way to check if a ruler's current heir is a fallback heir due to there being no valid heir at all under their current succession law, e.g. the case where the game is picking one of the highest tier vassals because there's no valid Primo heir (and not because that vassal is a distant Primo heir)?
 
Does the scope any_dejure_vassal_title only look at created/held titles? I have a decision that combines held empires into one, by making the de jure kingdom titles of the non-primary empires into the de jure vassals of the primary empire, then destroying the secondary empires, but it doesn't seem to affect every kingdom that was de jure vassal to the forfeited empires, and the only thing that leaps to mind is that those kingdom titles aren't created or held by anyone.
After looking through my mod which does much the same thing (shameless plug), I suspect the answer is "yes".

The reason is that the method I used to decide whether a kingdom is completely controlled uses a double-negative: there are no de jure vassal counties or duchies that are held by characters that are not root or his vassals. I don't think I would have used a double-negative if there was a more straightforward way.

Code:
expd_cef_root_controls_this_kingdom = {
	tier = KING
	OR = {
		custom_tooltip = {
			text = expd_cef_root_completely_controls_this_kingdom_tt
			OR = {
				ROOT = { completely_controls = PREV }
				AND = {
					is_titular = yes
					holder_scope = { character = ROOT }
				}
			}
		}
		custom_tooltip = {
			text = expd_cef_every_county_and_duchy_in_this_kingdom_is_controlled_by_root_tt
			NOT = {
				any_de_jure_vassal_title = {
					OR = {
						tier = COUNT
						tier = DUKE
					}
					has_holder = yes
					holder_scope = {
						NOT = { character = ROOT }
						NOT = { is_vassal_or_below_of = ROOT }
					}
				}
			}
		}
	}
}
 
Last edited:
Hi!

Any idea how I could edit the alternate starts, namely to limit "religions = random" and "cultures = random" options to certain macro-regions? Essentially, a mix between historical and random, where Indian cultures for example would stay in India, but shift around there? Or Catholicism would stay in Europe and the Middle-East?

I always use historical religions and culture, because I don't like Somali culture in Iceland, or Catholicism in India. But some variety would be nice.
Anyone???