I can make a mod that decreases the ScoreOfDeclaringWar if the faction is already at war. But later, now I'm busy with other things.
This would be fantastic if you could do this and if you do, thank you in advance.
I can make a mod that decreases the ScoreOfDeclaringWar if the faction is already at war. But later, now I'm busy with other things.
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);
}
}
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
@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.
Sorry, I should have explained that haha. The randomFloat value is a random decimal between 0 and 1. See the line where it says:What this range exactly does?
Sound like a plan .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
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.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 .