Page 1 of 7 1234567 LastLast
Results 1 to 20 of 121

Thread: [Submod] Peace Treaty Script (Realistic Expansion) *testers appreciated*

  1. #1

    Default [Submod] Peace Treaty Script (Realistic Expansion) *testers appreciated*

    I no longer recommend using this, as the mod has been updated to likely make this incompatible.
    If someone wants to move the functions that I changed from this file to the new version, it would be great and I fully support this submod being taken over by someone else. (Just compare this file to the one from the mod and copy over the functions that are different.) Until then I expect this to be dead, as I do not have time to update it.

    This is the test version of a script which aims to keep factions from expanding beyond realistic areas. It consists of two parts: A forced peace treaty list, which will declare peace every turn between a list of AI factions that shouldn't expand in each others direction. For example all gauls can't go to war with all iberians, but they can fight and expand within their respective areas. It serves it's purpose, but it can't be used too much, or else the game reacts in somewhat annoying ways, such as declaring war every turn.
    That's why I added the second and much bigger part, an adapted OnPendingBattle script, which gives autoresolve bonuses to factions based region number. The intention was that factions can be continually at war and do battle, but bigger factions just get defeated and cant expand much.
    This seems to work well at restricting AI expansion in my testing. But since the default DeI AI is virulently aggressive, it will always expand as much as I let it, and that fairly quickly, so I had to script it rather tightly. (See CAI component to make AI less aggressive.)
    How much territory factions are allowed to take is low and grows over time, and if you play as the romans is tied to your expansion. I aim to keep most non-major factions down to 2-4 regions. If that is too restrictive, just edit the criteria in the RegionLimit function.
    Testing and feedback is highly appreciated! And so are reports and screenshots of your campaigns.

    Download: Expansion Limit Script - The script is more or less as done as I can get it right now, and I'll be less active for a while. Overall the maps looks very good in my testing now.
    Optional CAI Component (initial test) - At this point it mostly just changes all the AI's aggression settings from very high to medium or low. Not sure what will happen, as I haven't tested it much. Maybe the AI will be too passive.

    Since this is "only" a script, technically it can be applied to an existing campaign without problems. It was not designed for this, however, so outcomes might be bad, because it kind of assumes the starting positions. It should work with all recent and future DeI versions and be compatible with all other submods.
    I would recommend playing this without a submod that increases liberation rates, since this script does not fully account for gen factions, and it might mess with the balance.
    It comes delivered in DeI's 1.2's grand_campaign.lua, which hasn't been changed since 2016 and isn't used by any other submods I know about, because it replaces it's functions.
    I left logging on, so in your Rome II folder there is a file named major_log.txt that will give you information about what the script did.

    Attrition feature fully implemented, for armies that are where they shouldn't be (e.g. egyptians in italy)
    Finally did the region limits for all factions, thanks to SaveParser working again
    WinBonus should work (almost) all the time now
    InEnemyTerritory should work properly now
    Eradicated bug where region() call crashed the script if a character didn't have a region, so the bonuses weren't given
    Major update. Completely reworked most of the script. Factions now lose if they are big enough and in enemy territory. Replaced attrition and movement freeze with battle win functionality
    Added Attrition penalty, and made the freeze effect apply later
    Added movement freeze for big factions
    Peace treaties and autoresolve advantages done
    Initial trial of peace treaty script

    I give full permission to anyone to use my work as they please. (Giving credit would be nice.) Or to update this for future DeI versions in case I'm not around. But since I'm mostly adapting DeI code, I consider this more or less still their belonging.
    Credits: I like to thank Sedulus for help and feedback during the development process.
    Last edited by CIaagent11; June 25, 2018 at 03:38 PM.

  2. #2
    Maetharin's Avatar Senator
    Join Date
    Oct 2013

    Default Re: [Submod] Peace Treaty Script (Realistic Expansion) *testers appreciated*

    Very intriguing, do you plan on further expanding functionalities?
    F.e. by comparing the relative strength of factions so they seek peace?
    "Ceterum censeo Carthaginem delendam esse!"

    Marcus Porcius Cato Censorius

    "I concur!"


  3. #3

    Default Re: [Submod] Peace Treaty Script (Realistic Expansion) *testers appreciated*

    Quote Originally Posted by Maetharin View Post
    Very intriguing, do you plan on further expanding functionalities?
    F.e. by comparing the relative strength of factions so they seek peace?
    Good idea, and my initial thought. But so far I only know how to test the strength of one faction in the script, which can't be used for comparing strength. Also, what should the criteria be? Only equal-strength factions can fight? It might have weird results. If the bigs can't attack the smalls, they might gouge on the mediums and expand too much. One has to think about all the repercussions...
    Last edited by CIaagent11; October 13, 2017 at 12:09 PM.

  4. #4

    Default Re: [Submod] Peace Treaty Script (Realistic Expansion) *testers appreciated*

    Wow, there you have now but with a new version very hurried. Very beautiful. Property synonymous times in the file reingeschaut and what I've seen makes a very good impression. I think the rest is done by different books.
    I just started a new game with version 06 and exchanged the same. I'm just in round 36 and fortunately not much has been done yet. I will gladly again as soon as possible.

    I would search the comparison about the strength of the unit size.
    If the attacker has 20 units and the defender even then they close peace, or it does not take place until war, since no one can actually win the battle.
    It may also be due to the military accounts. This factor, which is quite important as I think, should not be ignored.

  5. #5

    Default Re: [Submod] Peace Treaty Script (Realistic Expansion) *testers appreciated*

    Ok, I have no idea how to do this. Need some help.
    If I wanted to make everyone go to peace with a faction once it has a certain amount of settlements, would I do it like this?
    This crashes the game...

    function PeaceBig(context)
    if context:faction():is_human() == false and context:faction():region_list():num_items() > 3 then
        for i = 0, scripting.game_interface:model():world():faction_list():num_items() - 1 do
    Last edited by CIaagent11; October 14, 2017 at 04:05 PM.

  6. #6

    Default Re: [Submod] Peace Treaty Script (Realistic Expansion) *testers appreciated*

    Hmm, there will be the fractions which have only one settlement but quite problems. Do not you think? I think the barbarians should come to peace when there are no armies left.
    Otherwise, we have the problem again that when Rome comes to this area, then this fraction does not exist there, which should be there.

  7. #7

    Default Re: [Submod] Peace Treaty Script (Realistic Expansion) *testers appreciated*

    I'm not sure that's possible. The AI will always have armies. At least I way don't know how to do it.

    My testing revealed that this runs into issues with the game mechanics. The AI works basically like this: "if not at war with anyone, declare war on random close-by faction you don't like". If you then forbid them from warring all their neighbors via the script, they will declare war on other factions, who might be far away, and eventually you. I saw Epirus ship fleets off to africa, and I was invaded by the Vivisci and some shouthern iberian tribe. Macedon sent two armies to Judea. Ultimately it is pretty lame if you as the player gets invaded by these full stacks from way far away all the time.
    Last edited by CIaagent11; October 16, 2017 at 04:59 PM.

  8. #8

    Default Re: [Submod] Peace Treaty Script (Realistic Expansion) *testers appreciated*

    Maybe it's about the size of the army? Once the faction just says we have a total of 5 units in the pool that makes peace.

    Yes, I must agree with you. Is then already slightly corrosive if you have once strains from anywhere else in the neighborhood. At the Cimbri I would be the yes from a certain date still to be let go ...
    Last edited by Sedulus; October 15, 2017 at 02:39 AM.

  9. #9
    ♔Greek Strategos♔'s Avatar BEARDED MODERATION
    Artifex Content Staff Modding Staff

    Join Date
    Feb 2008

    Default Re: [Submod] Peace Treaty Script (Realistic Expansion) *testers appreciated*

    Hey @Claagnet11
    Total War's AI functionality was always problematic and most scripts aren't very helpful, since it's not as easily manipulated as the AI in other games (Paradox series,Civilization) etc.
    I'll try to play test with this sub mod when I'll have more free time. Your idea looks interesting and I hope it'll have a positive impact.


  10. #10

    Default Re: [Submod] Peace Treaty Script (Realistic Expansion) *testers appreciated*

    Thank you.
    The first "release" version, which has the core functionality in place, is done now. Looking forward to feedback and impressions.
    I'll test this for a while and make changes if I find bugs. The specific balancing will be an ongoing process and is easily adapted to anyones liking. The faction lists now come in blocks by area that can be easily understood (e.g. the iberian block) and lines have been commented out instead of removed for intuitive editing.
    Last edited by CIaagent11; October 18, 2017 at 05:10 PM.

  11. #11

    Default Re: [Submod] Peace Treaty Script (Realistic Expansion) *testers appreciated*

    Very nice! Should I start a new game, or does it work with the started?

  12. #12

    Default Re: [Submod] Peace Treaty Script (Realistic Expansion) *testers appreciated*

    It works just fine, but for best results start a new one.

    Get the new version. The 1.0 had a bug where it considered factions smaller if they were the same size, instead of considering them smaller if there is a difference of two, because the + 1 was on the wrong side of the comparison.
    Last edited by CIaagent11; October 19, 2017 at 03:41 AM.

  13. #13
    Katsumoto's Avatar Quae est infernum es
    Moderator Emeritus

    Join Date
    Feb 2009

    Default Re: [Submod] Peace Treaty Script (Realistic Expansion) *testers appreciated*

    Thanks for this. I've been using it in my new Sparta campaign. It seems to be working well for the most part, limiting expansion of minors but it is causing some strange behaviour. Bithynia declared on Pergamon, my ally, who I joined. However, the next turn I automatically made peace with Bithynia, but they were still at war with Pergamon. It also seems that Galatia is declaring war, capturing a city in one turn and then being forced to make peace the next turn, allowing it to keep the city without retaliation.
    "I pray Heaven to bestow the best of blessings on this house and all that shall hereafter inhabit it. May none but honest and wise men ever rule under this roof."
    - John Adams, on the White House, in a letter to Abigail Adams (2 November 1800)

  14. #14

    Default Re: [Submod] Peace Treaty Script (Realistic Expansion) *testers appreciated*

    Thanks for the report. Seems there is a bug. The player is not supposed to be forced to peace at all. That's the first thing the script tests for. But the problem is that the test doesn't go both ways. It tests whether Sparta is the player before Sparta makes peace with anyone, but it does not test whether Sparta is the player before others make peace with Sparta. There should be a check, but I'm not sure how to implement it right now. To be honest, I kind of designed this with the player as Romans in mind, and no AI faction makes auto-peace with them, so it's not a problem.
    For now, if not playing Rome, I recommend commenting out the lines that make peace with the faction you play as. (And make sure you use the latest version of the submod.)

    Yes, the same turn occupation thing is something the script doesn't quite take into account, since the check happens at every turn start. That's an imperfection, but shouldn't happen often. Also, Galatia is stronger, so we can expect they wouldn't have lost the settlement soon after.
    Last edited by CIaagent11; October 22, 2017 at 12:51 PM.

  15. #15

    Default Re: [Submod] Peace Treaty Script (Realistic Expansion) *testers appreciated*

    Try this, and let me know if the AI still makes peace with you if you are Sparta as the player.

    Edit: This is old. Use the main version.
    Last edited by CIaagent11; October 28, 2017 at 03:28 PM.

  16. #16
    ♔Greek Strategos♔'s Avatar BEARDED MODERATION
    Artifex Content Staff Modding Staff

    Join Date
    Feb 2008

    Default Re: [Submod] Peace Treaty Script (Realistic Expansion) *testers appreciated*

    Quote Originally Posted by CIaagent11 View Post
    Try this, and let me know if the AI still makes peace with you if you are Sparta as the player.
    My play time is limited lately, but I'll give it a look later. What have you changed ???

  17. #17

    Default Re: [Submod] Peace Treaty Script (Realistic Expansion) *testers appreciated*

    This was mostly for Katsumoto, since he plays sparta and noticed a bug where the AI would make peace with you if you're not rome, which wasn't the intention. I built in a quick check whether the player faction is sparta before anyone makes peace with sparta. If this works, I can do it for all AI factions. But it's not high on my priority list, as I dont play as non-roman factions myself currently. I just prefer this submod to be functional for everyone else.
    What would be more interesting would be whether the auto peace treaties still work when the player is not sparta. I.e. whether they do happen if not sparta but won't happen if sparta. To test this, I'd have to put in a bunch of test code, fire up the game a few times and run a turn to see what happens to the AI diplomacy each time. With this scripting, each little step is a bunch of test runs, and I'm kind of tired of it at the moment.

    So far, I found in my testing that the autoresolve advantages I give are not strong enough to really prevent AI expansion. The map looks different now, which is good, but there are still rather large barbarian empires by turn 60. Unfortunately I have no idea what values you can put into the modify_next_autoresolve_battle, and I think strong armies will still win despite a 0.1 to 5 disadvantage. I'd have to build in the win_next_autoresolve_battle function, but so far in my testing I could not get it to work. Also somehow testing for siege battles would be cool, so I can make the defender win. I would appreciate some input, if anyone knows...
    Last edited by CIaagent11; October 24, 2017 at 01:03 PM.

  18. #18

    Default Re: [Submod] Peace Treaty Script (Realistic Expansion) *testers appreciated*

    Released new version, which adds a third function that finally works at keeping AI expansion down! It freezes their movement and recruitment completely once they get too big, as I could not come up with anything better. Probably a little drastic, so added a check that enables movement for factions the player is close to.
    Also, I implemented checks that avoid undesired peace declarations if the player is not rome.
    Last edited by CIaagent11; October 28, 2017 at 03:06 PM.

  19. #19

    Default Re: [Submod] Peace Treaty Script (Realistic Expansion) *testers appreciated*

    As you can see, the AI makes whatever she wants despite all the efforts. The Lusitani, Cantabri and the Thraci invade areas where they have no business of their own. I have even tried to capture provinces from the Thraci and then liberate them, but in principle it is useless, except that I can conquer them later.
    I have the feeling that the version before, in the propagation of AI was more stable. But I can also be wrong.
    I think that in such cases AI should be forced to either form client states or to liberate the provinces from me. Otherwise it will not work.
    Last edited by Sedulus; November 03, 2017 at 08:49 AM.

  20. #20

    Default Re: [Submod] Peace Treaty Script (Realistic Expansion) *testers appreciated*

    That's odd, it seemed to work well in my testing. I definitely haven't seen iberians in gaul in quite a while. Maybe this scripting just doesn't work very well in TW games, as someone said in another thread. In that case, there's nothing I can do. But the freezing effect of 1.3 does not get applied if one of your armies or settlements is close to the faction, so that you don't fight enemies that are frozen. So maybe you had an army around Thrace? But that does not seem to be the case with Massilia or the Cantabri. You are nowhere close to them. Also, factions are blocked from attacking smaller neighbors, but if smaller factions eat each others, then the bigger factions then attack those medium factions and get really big. The cantabri might have taken that settlement from Massilia, I dont think they are forbidden from going to war. Or you caught an old version. I uploaded a new version just now, that might even out some bugs and uses attrition first, and only freezes a faction later. That should make the map somewhat more movable.

Page 1 of 7 1234567 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts