Part of the problem with Sturgia getting rolled early:

Users who are viewing this thread

I made a test mod that sets ScoreOfDeclaringWar to zero if the (attacker) faction is already at war. So clans will not support the new war.
NOTE: this mod made just for tests, it probably incompatible with the other "Diplomacy" mods.

The mod overrides DefaultDiplomacyModel method GetScoreOfDeclaringWar
C#:
    internal class TestDiplomacyModel : DefaultDiplomacyModel
    {
        public override float GetScoreOfDeclaringWar(IFaction factionDeclaresWar, IFaction factionDeclaredWar, IFaction evaluatingClan)
        {
            if (Kingdom.All.Any(k => k.IsAtWarWith(factionDeclaresWar)))
            {
                return 0;
            }

            return base.GetScoreOfDeclaringWar(factionDeclaresWar, factionDeclaredWar, evaluatingClan);
        }
    }

You can download compiled DLL from the GitHub:
File: https://github.com/zenDzeeMods/zenD...ad/v1.0.0.2/zenDzeeMods_TestDiplomacyModel.7z
Source code: https://github.com/zenDzeeMods/zenDzeeMods_ZenFixes/tree/master/zenDzeeMods_TestDiplomacyModel
 
I made a test mod that sets ScoreOfDeclaringWar to zero if the (attacker) faction is already at war. So clans will not support the new war.
NOTE: this mod made just for tests, it probably incompatible with the other "Diplomacy" mods.

The mod overrides DefaultDiplomacyModel method GetScoreOfDeclaringWar
C#:
    internal class TestDiplomacyModel : DefaultDiplomacyModel
    {
        public override float GetScoreOfDeclaringWar(IFaction factionDeclaresWar, IFaction factionDeclaredWar, IFaction evaluatingClan)
        {
            if (Kingdom.All.Any(k => k.IsAtWarWith(factionDeclaresWar)))
            {
                return 0;
            }

            return base.GetScoreOfDeclaringWar(factionDeclaresWar, factionDeclaredWar, evaluatingClan);
        }
    }

You can download compiled DLL from the GitHub:
File: https://github.com/zenDzeeMods/zenD...ad/v1.0.0.2/zenDzeeMods_TestDiplomacyModel.7z
Source code: https://github.com/zenDzeeMods/zenDzeeMods_ZenFixes/tree/master/zenDzeeMods_TestDiplomacyModel

Thank you very much for this mate. If I want to make it just hard but not impossible to happens, if I increase the score a bit it will be enough to see eventually some wars being declarated or this code just sets the war score to fix number (zero). If it is a fixed number, would be possible to set that fcurrently fighting a war would decrease by a big amount the ScoreOfDeclaringWar instead of giving a fixed number? Thanks and no problem if you are bussy and have no time to do this. I am going to try to learn a bit of coding to try to make for myself. Really thank you for this!

EDIT: Testing the mod and work great for what you have done it. Thanks :smile:
 
Last edited:
@Dabos37 you could also try narrowing the range that the randomFloat variable can be to meet the conditions to consider war. Currently, the range is between 0.3 and 0.7. If you change those numbers to say, 0.5 to 0.6, then there should be ~4x fewer clans considering war each day.

Daily-Tick-Clan-Kingdom-Decision.png
 
@Dabos37 you could also try narrowing the range that the randomFloat variable can be to meet the conditions to consider war. Currently, the range is between 0.3 and 0.7. If you change those numbers to say, 0.5 to 0.6, then there should be ~4x fewer clans considering war each day.

Daily-Tick-Clan-Kingdom-Decision.png

Ok great, thank you very much! What this range exactly does? I mean, I understand the second part where the clan has to have more than 200 influence but do not get this randomFloat range actually means (I get the part about this is a number between 0.3 and 0.7, but what does this number define?).
 
What this range exactly does?
Sorry, I should have explained that haha. The randomFloat value is a random decimal between 0 and 1. See the line where it says:
float randomFloat = MBRandom.RandomFloat;​
That is their in-house way of generating a random decimal, and you will see that a lot in the code.

So the part in the red box means that the random value that is generated must be greater than 0.3 and less than 0.7, or in other words, there is a 40% chance for the random number to be within that range and trigger a clan proposing war (if they meet the influence requirement too).

By tightening that range, you are lowering the chance that any given clan will consider/propose war each day. If the random value falls outside of that range, then the clan skips over the war decision code that day.
 
Nice, thanks for the info. Then yes, it is a pretty good way to reduce the war chance. I am going to try to make a mod using the zenDzee code to reduce the War Score if attacking kingdom is already at war instead of getting a fixed 0 number (I do not want to make a second war impossible, just hard to happen). Plus I am going to reduce the range as suggested becuase currently there are too much war declarations every few days and I dislike it. I am really happy with this info, thanks :smile:
 
Nice, thanks for the info. Then yes, it is a pretty good way to reduce the war chance. I am going to try to make a mod using the zenDzee code to reduce the War Score if attacking kingdom is already at war instead of getting a fixed 0 number. Plus I am going to reduce the range as suggested becuase currently there too much war declarations every few days and I dislike it. I ma really happy with this info, thanks :smile:
Sound like a plan (y).

I wouldn't put too much effort into it if I were you (or zenDee) though, because mexxico stated that he is going to take a look at the war score code this week for possible improvements.
 
Yeah I know, but I also know that mexxico is pretty busy and maybe does not have time to check it. Plus there is always a chance that I dislike the devs changes because everyone has its own tastes, so it is good if I learn how to make these changes.

BTW, concerning peace chance, I am looking this:

float randomFloat = MBRandom.RandomFloat;
if ((double)randomFloat < 0.9 && clan.Influence > 200f)
{
kingdomDecision = this.GetRandomPeaceDecision(clan);

This means that if random decimal x 2 is lower than 0.9 and the clan influece is higher than 200, then there is a decision to try make peace, right? Can I make easier that factions ask for peace when they are currently losing wars? I have been thinking on increasing the numbers in fatigue score, for example if loyalty is lower than 75 instead of 65 like it is currently, but not sure if you have a better idea about how to do it. Plus would be great if I could score higher for peace if the faction is figthing against +2 kingdoms at the same time. Thanks again and if you think that I am asking too much, no problem at all if you want to stop answering my questions and sorry for that :smile:.
 
Last edited:
BTW, concerning peace chance, I am looking this:

float randomFloat = MBRandom.RandomFloat;
if ((double)randomFloat < 0.9 && clan.Influence > 200f)
{
kingdomDecision = this.GetRandomPeaceDecision(clan);

This means that if random decimal 1 + random decimal 2 is lower than 0.9 and the clan influecen is higher than 200, then there is a vote to try make peace, right? Do you know could I make easier that factions ask for peace when losing wars? I have been thinking on increasing the numbers in fatigue score, for example if loyalty is lower than 75 instead of 65 like it is currently, but not sure if you have a better idea about how to do it. Thanks again and if you think that I am asking too much, no problem at all if you want to stop answering my questions and sorry for that :smile:.
No, "double" is just the data type. It means that it's a decimal with many digits. It's still only one random number that must be < 0.9. But otherwise, yes, that means there is a 90% chance that a clan will consider proposing peace each day. Peace declarations aren't something that I've looked at too much, however, I do know that they also utilize the WarScore method that zenDee and I talked about. That's something I'd have to look at it, but I don't think it's any less complicated than the war declaration code lol.

That (double) actually shouldn't be there.
 
Oki. There should be any kind of bug because when I have changed this:


if (0.3f < randomFloat && randomFloat < 0.7f && kingdomDecision == null && clan.Influence > 200f)
{
kingdomDecision = this.GetRandomWarDecision(clan);



To this (in order to test if actually works):


if (0.55f < randomFloat && randomFloat < 0.56f && kingdomDecision == null && clan.Influence > 200f)
{
kingdomDecision = this.GetRandomWarDecision(clan);



It actually totally reduce the chance wars AND peace declarations, not just war declarations. Anyway, I have enough information to continue investigating and testing :smile:.
 
Sturgian settlements are scattered way too far from each other. This and not the greatest AI ever makes sturgian lords be defencive and, eventually, lose everything. They can't be aggressive because as soon as they try to besiege an enemy settlement - their towns are getting instantly besieged and conquered.
 
Back
Top Bottom