Discussion Suggestion Settlement distance limit is breaking custom map mods.

Users who are viewing this thread

Hello, just wanted to share that the modding community has been fighting a hard crash. that has been caused by the settlement distance limit of 150 and no safe default. is this something that will be fixed? or the new normal?
 
Hello, just wanted to share that the modding community has been fighting a hard crash. that has been caused by the settlement distance limit of 150 and no safe default. is this something that will be fixed? or the new normal?
(edit) more information on the crash. it is related to village trade bound production due to the village location being closer to (or partially surrounded by) settlements from a different culture. the settlement distance limit of 150 that was introduced in the 1.8.0 stable (with no safe default) has been determined to be the cause.
 
a hard crash. that has been caused by the settlement distance limit of 150 and no safe default
specifically, this is referring to the method TryToAssignTradeBoundForVillage, which (newly as of 1.8 ) returns a value of null if no acceptable town is within a hard cutoff 150 distance of the village. (which is not uncommon on modded maps, and they now have to include a code workaround).

additionally the class, VillageTradeBoundCampaignBehavior, unlike other campaign behaviors is internal, and not for seemingly any reason?
 
I found another solution that may be related to the distance problem, in my case there were so many settlements that I simply don't know which one was giving the distance problem.
I managed to solve it, although being honest it's a bit messy and I'm looking for a more optimal solution.
In my case the error came from a bug in the DefaultMapDistanceModel script in the GetDistance function inside the dll TaleWorlds.CampaignSystem, which caused one of the settlements to come to null and crashed the game.
Putting that if the settlement is null return the maximum distance resolved the error.

public override float GetDistance(Settlement fromSettlement, Settlement toSettlement)
{
if (fromSettlement == null)
{
Debug.Print("From Settlement is a null value");
return MaximumDistanceBetweenTwoSettlements;
}
if (toSettlement == null)
{
Debug.Print("To settlement is null");
return MaximumDistanceBetweenTwoSettlements;
}

To apply this change you will need to modify the TaleWorlds.CampaignSystem dll library, which I recommend you do with extreme caution.
 
I found another solution that may be related to the distance problem, in my case there were so many settlements that I simply don't know which one was giving the distance problem.
I managed to solve it, although being honest it's a bit messy and I'm looking for a more optimal solution.
In my case the error came from a bug in the DefaultMapDistanceModel script in the GetDistance function inside the dll TaleWorlds.CampaignSystem, which caused one of the settlements to come to null and crashed the game.
Putting that if the settlement is null return the maximum distance resolved the error.



To apply this change you will need to modify the TaleWorlds.CampaignSystem dll library, which I recommend you do with extreme caution.
Are you aware that there’s a TradeBoundFix mod? You can find it on this link in the Mount & Blade Modding discord https://discord.com/channels/411286129317249035/677511186295685150/1010704780001280080

It’s existence doesn’t obviate the need for Taleworlds to fix their code, so, it doesn’t impose pointless vanilla restraints on overhaul campaign maps.
 
Oh thank you so much. I am relatively new to this community and there are still many community patches that I am unaware of.

I will apply it and report back if it works as well. Again, thank you so much
 
Back
Top Bottom