Page 1 of 2 12 LastLast
Results 1 to 20 of 44

Thread: Turbo's AI FACTION SURVIVAL SCRIPT

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Turbo's Avatar Civitate
    Join Date
    Oct 2004
    Location
    New Jersey
    Posts
    2,152

    Default Turbo's AI FACTION SURVIVAL SCRIPT

    Revision 1 of the Script is out.

    Fixes some bugs that caused the script to become overactive. I dropped the capital lost trigger as I couldn't get it to work reliably. Anyway, the spawn occurs near the capital regardless, so the impact if any is minimal.

    ----------------------------------------------------------------------

    WHAT IS THE AI FACTION SURVIVAL SCRIPT?
    This is not a script that allows eliminated factions to re-emerge. Rather, it is a simple script designed to help prevent AI factions from being eliminated in the first place.

    WHAT DOES THE SCRIPT DO?
    The script is a campaign_script file that runs when you start a new game. The script monitors the number of settlements the AI factions have and if an AI faction is losing settlements it creates an army near the capital city. The army will have a general and 9 other units, mostly lower/intermediate tier infantry some cavalry and archers. There is a 10 turn wait between spawns. Conditions are re-evaluated and no army is created if the script evaluates that the AI faction is back on its feet. The AI receives a small militia army on turn 1 to help it expand.

    ADVANTAGES
    1) Absolutely no slowdown in execution unlike some garrison scripts
    2) Helps all the AI factions survive much longer in the game
    3) Helps the AI factions recover their homelands when they are captured
    4) Helps stop early decline of some AI Factions and aids them in recovery
    5) Provides military aid, not more money which the AI doesn't seem to spend
    6) Helps the AI recover its homelands - which normally have its most advanced building structures.
    7) Creates a balanced army with a general that is not overpowered but is a threat.
    8) Encourages the AI to expand outwards from its homelands.
    9) Realistic - recruited armies almost always came from the heartlands of a kingdom where he could rely on his loyal subjects.


    ESSENTIALS:
    Echad 1.90 Mod is a must even if you don't use this script. This script seems to work best with his mod. I haven't tested the script without his mod.

    RELEASED TO THE PUBLIC DOMAIN:
    Please feel free to modify this script and hopefully improve on it. There are scriptors a lot more talented than me out there so if there are any ideas, enhancement, better ways of accomplishing what I have set out to do, make the changes and post. No permission from me is needed but some mention in the credits would be nice.

    ISSUES:
    Echad has a field cost script that shoudl be kept disabled. I couldn't get my script to run when it is enabled. I am still trying to figure out why.. I suspect there is something wrong with the field cost script itself as my script runs fine without it.

    CREDITS:
    I learned a great deal of scripting from DLV, Klink and GreenEyeDevil by studying their scripts.
    Last edited by Turbo; February 09, 2008 at 06:33 PM. Reason: REVISION 1 IS OUT
    Work of God

  2. #2
    Indefinitely Banned
    Join Date
    Nov 2007
    Location
    Odessa...
    Posts
    3,429

    Default Re: Turbo's AI FACTION SURVIVAL SCRIPT

    Would you mind, if I'll include it in my 2.00 version as optional install? =)

  3. #3

    Default Re: Turbo's AI FACTION SURVIVAL SCRIPT

    I ll start new campaign and try this one, will post feedback, gj m8 btw.

  4. #4
    Turbo's Avatar Civitate
    Join Date
    Oct 2004
    Location
    New Jersey
    Posts
    2,152

    Default Re: Turbo's AI FACTION SURVIVAL SCRIPT

    Quote Originally Posted by Echad View Post
    Would you mind, if I'll include it in my 2.00 version as optional install? =)
    Sure, feel free to include. It is really designed around your mod anyway.

    Quote Originally Posted by IZ-Master View Post
    any feed back on slowdown ? i cant give a right feed back on slowdown because my pc is beyond average ^^ also will test it out asap
    It won't slow your system down at all. The code is very small.

    The code is pretty simplistic and I've played through about 100 turns with it using Echad's mod. The Turks were very prone to getting wiped out so I i added some additional triggers for them. Overall, survival is higher than before but not fool proof.

    England for example got dominated fairly early by scotland and lost most of central england. Once the trigger was activated and the army created, the English AI started reconquering much of its lost territory plus all of wales. Things then stablized until the norwegians who had taken York landed and took London. Another army got created near london and this army immediately went and beseiged London and took it easily (knowing the AI logic, probably a very weak garrison).
    Last edited by Turbo; February 08, 2008 at 01:17 PM.
    Work of God

  5. #5

    Default Re: Turbo's AI FACTION SURVIVAL SCRIPT

    This looks very interesting, look forward to feedback.

  6. #6
    IZ-Master's Avatar Centenarius
    Join Date
    Dec 2006
    Location
    Puerto Rico
    Posts
    843

    Default Re: Turbo's AI FACTION SURVIVAL SCRIPT

    any feed back on slowdown ? i cant give a right feed back on slowdown because my pc is beyond average ^^ also will test it out asap

    Stainless Steel Beta Tester Version 6.0->6.1
    DarthMod 1.4 D: The Last Episode Beta Tester

  7. #7
    Ketchup's Avatar Senator
    Join Date
    Jan 2007
    Location
    London (well around there anyway...)
    Posts
    1,420

    Default Re: Turbo's AI FACTION SURVIVAL SCRIPT

    Nice work turbo looks good! dling now... BTW what exactly are the conditions for an army to appear. For example if I took the enemies capital but they had 3 full stacks in the neighbouring province, I wouldn't want another army to be spawned. Basically, does your script take into account the factions overall military power.

    Roma Surrectum 2.0 Team Member
    R.I.P Calvin

  8. #8
    Turbo's Avatar Civitate
    Join Date
    Oct 2004
    Location
    New Jersey
    Posts
    2,152

    Default Re: Turbo's AI FACTION SURVIVAL SCRIPT

    Quote Originally Posted by Ketchup View Post
    Nice work turbo looks good! dling now... BTW what exactly are the conditions for an army to appear. For example if I took the enemies capital but they had 3 full stacks in the neighbouring province, I wouldn't want another army to be spawned. Basically, does your script take into account the factions overall military power.
    An army is created if the capital is taken or if the faction drops one settlement below the number it starts the campaign at. There is a wait of 10 turns after an army has been created before another can be created.

    The settlement condition is proactive. If the AI starts losing provinces early, then they will be likely in homelands. I don't want the AI to decline in power so much that one army becomes moot.

    Losing the capital had to be a separate trigger as this is the single most advanced settlement the AI has. This is a major blow to the AI faction.

    The condition you describe can happen however keep in mind that you playing against Creative Assembly's AI which is dumb enough to leave those 3 armies just sitting there or have them go after another target. If the army is created nearby, the army tends to go after the capital to reconquer it.
    Work of God

  9. #9
    Ketchup's Avatar Senator
    Join Date
    Jan 2007
    Location
    London (well around there anyway...)
    Posts
    1,420

    Default Re: Turbo's AI FACTION SURVIVAL SCRIPT

    Fair point Turbo, I'll try it out anyways so thanks!

    Roma Surrectum 2.0 Team Member
    R.I.P Calvin

  10. #10

    Default Re: Turbo's AI FACTION SURVIVAL SCRIPT

    Hi Turbo,

    Really a very interesting script. Thanks for posting it here!

    If it really doesn't affect the turn length this would be great!
    Well, I will check it out soon.


    ...added to the user mods threads...

    Winner of 'Favorite M2TW Mod' and 'Favorite M2TW Modder' Award 2007 & 2008

  11. #11
    Turnus's Avatar il Flagello dei Buffoni
    Join Date
    Oct 2004
    Location
    Melbourne, Australia
    Posts
    1,093

    Default Re: Turbo's AI FACTION SURVIVAL SCRIPT

    For some reason it says that the link to the script is invalid. Is there an alternate location for the file?
    Force Diplomacy Modifications for Rise of Persia 2.11 Beta and Roma Surrectum 1.5a.
    Member of S.I.N.
    Under the patronage of Obi Wan Asterix

  12. #12
    Indefinitely Banned
    Join Date
    Nov 2007
    Location
    Odessa...
    Posts
    3,429

    Default Re: Turbo's AI FACTION SURVIVAL SCRIPT

    Quote Originally Posted by Turbo View Post
    NEWS 2-8
    ------------
    A bug fix and update will be released on Feb 9th. I missed an error that requires some code rewrite. The spawn code works a bit too well

    While I am at it I am looking at some small enhancements:

    - A small army will be created in the province on the same turn a homeland settlement is taken. This will be a one time spawn (5 low level militia).
    - A small army will be created on turn one to help the AI expand. This is a one time spawn (5 low level militia) on the first turn.

    The script will still be small and fast.
    ----------------------------------------------------------------------
    Last edited by Turbo : Today at 03:28 AM. Reason: UPDATE AND BUGFIX BEING RELEASED 2-9
    See? I managed to release the Fix Pack 2.00 with the old version, under the Optional folder. B) I am always in time.

  13. #13
    Borsook's Avatar Artifex
    Join Date
    Feb 2005
    Location
    Radom, Poland
    Posts
    681

    Default Re: Turbo's AI FACTION SURVIVAL SCRIPT

    Great idea, one of the things I miss from MTW1 is coming back factions, this falls in that fine spirit.

    One suggestion though - instead of 10 turn interval make it a random number of turns (with a limit of course). It might slow the script a tiny bit, but I don't think it will noticeable too much.
    Under Patronage of Necrobrit

  14. #14
    Turbo's Avatar Civitate
    Join Date
    Oct 2004
    Location
    New Jersey
    Posts
    2,152

    Default Re: Turbo's AI FACTION SURVIVAL SCRIPT

    Quote Originally Posted by Borsook View Post
    Great idea, one of the things I miss from MTW1 is coming back factions, this falls in that fine spirit.

    One suggestion though - instead of 10 turn interval make it a random number of turns (with a limit of course). It might slow the script a tiny bit, but I don't think it will noticeable too much.
    You are a much better modder than myself so maybe you could take a look at the code and offer/implement some ideas. I started out very ambitious however I am perplexed as to why some code simply won't execute. For example, I wanted to have the capital city monitored to see if it was captured then spawn an army regardless of how well the AI was doing. This proved to be beyond my skills apparently. The code seemed to work for most factions but there were always a couple of factions that spawn an army even if the capital was still under faction control. I finally threw in the towel. I've asked Klink to take a look and see if he can figured out how to add that functionality.

    Quote Originally Posted by Echad View Post
    See? I managed to release the Fix Pack 2.00 with the old version, under the Optional folder. B) I am always in time.
    Sorry about that mate. The only issue was the size of the initial spawn and some factions were somehow getting the larger spawns earlier. The old code doesn't cause any issues but there are some strange anomolies that drove me up the wall. I tried fixing the script yet the same code that worked for one faction wouldn't work right for another. Its interesting, but a lot of the scripts that worked in MTW2 will not work in Kingdoms, particularly the garrison scripts. Anyway, I spent the whole day rewriting the script and testing it. The newer script behaves more reliably.
    Last edited by Turbo; February 09, 2008 at 06:50 PM.
    Work of God

  15. #15

    Default Re: Turbo's AI FACTION SURVIVAL SCRIPT

    Turbo

    As I try and keep things down to one thread: http://www.twcenter.net/forums/showt...02#post2672402

    This works fine with the field cost script , it could be your terminate monitor statement? Still learning myself.

    I like the idea of the reduced settlements mointor, but not sure if this will effect the Ai more than the player ie if the Ai takes a settlement the 'defender' gets stronger so the Ai borders will tend towards a static position. The player, who can focus his troops better will be able to overcome this more than the Ai.

    Nice to see a post
    Last edited by Quark; February 10, 2008 at 02:23 AM.

    To err is human, but to really foul things up you need a computer.
    Paul Ehrlich

  16. #16

    Default Re: Turbo's AI FACTION SURVIVAL SCRIPT

    Dunno if this could be helpful but in medieval1 uprising was based on public order if i am not mistaken, so u conquered someone's capital and if public order was around 50-60 there was a very high chance for an army to be generated but if u had public order above 120, there was almost no chance for such army to be generated. That is something that makes sense to me ^^

  17. #17
    Borsook's Avatar Artifex
    Join Date
    Feb 2005
    Location
    Radom, Poland
    Posts
    681

    Default Re: Turbo's AI FACTION SURVIVAL SCRIPT

    Quote Originally Posted by Quark View Post
    Turbo
    I like the idea of the reduced settlements mointor, but not sure if this will effect the Ai more than the player ie if the Ai takes a settlement the 'defender' gets stronger so the Ai borders will tend towards a static position. The player, who can focus his troops better will be able to overcome this more than the Ai.
    How about adding a condition to check whether the faction in question is in war with the player and only then spawn the army?
    Quote Originally Posted by Turbo View Post
    You are a much better modder than myself so maybe you could take a look at the code and offer/implement some ideas.
    I'll gladly have a look at the code and try to help, though I wouldn't be so sure about being a better modder btw a +rep for the idea and work for you!
    Quote Originally Posted by Mafiozo View Post
    Dunno if this could be helpful but in medieval1 uprising was based on public order if i am not mistaken, so u conquered someone's capital and if public order was around 50-60 there was a very high chance for an army to be generated but if u had public order above 120, there was almost no chance for such army to be generated. That is something that makes sense to me ^^
    Oh, yes, and then CA got lazy... unfortunately I for one do not know how to check in a script the order of the settlement... we can check for a rebelling settlement though, but that would probably not often enough.
    EDIT>Silly me, we can indeed check for riot risk.
    Last edited by Borsook; February 10, 2008 at 08:54 AM.
    Under Patronage of Necrobrit

  18. #18
    Turbo's Avatar Civitate
    Join Date
    Oct 2004
    Location
    New Jersey
    Posts
    2,152

    Default Re: Turbo's AI FACTION SURVIVAL SCRIPT

    Quote Originally Posted by Quark View Post
    Turbo

    As I try and keep things down to one thread: http://www.twcenter.net/forums/showt...02#post2672402

    This works fine with the field cost script , it could be your terminate monitor statement? Still learning myself.

    I like the idea of the reduced settlements mointor, but not sure if this will effect the Ai more than the player ie if the Ai takes a settlement the 'defender' gets stronger so the Ai borders will tend towards a static position. The player, who can focus his troops better will be able to overcome this more than the Ai.

    Nice to see a post
    The terminate monitor means that the monitor runs once -- eg. it 'terminates'. I have found that many combinations of commands that used to work in MTW2 don't work in kingdoms. For example, Klink's garrison script (which I consider to be a masterpiece of scripting) will not run in kingdoms as neither will Nicolai's Hardgame garrison. I've asked Klink to look at this.

    On a strategic level, I appreciate your comments and they are good points. In this case however, there are counterpoints that I would raise:

    On an AI versus AI, the homelands will tend to be static and AI will rarely eliminate another AI faction since the AI rarely garrisons appropriately. Thats a plus -- in my opinion, the more factions in play a player must contend with, the more the game is difficult.

    It does favor defense but thats where in my opinion the AI needs help. The AI has no issue attacking and does so even recklessly. It doesn't however know how to defend anything and often you see it leaving a sole general in a settlement as the 'garrison'. A garrison script fixes that issue but it has its drawbacks.

    Another approach is the counterattack which is what I am trying to accomplish in the script. There will be more resistance in capturing the homelands and constant threat of counterattack by the AI with an army. It isn't foolproof as we are dealing with an AI with its own limitations, but at least it gives the AI something to work with.

    Some other advantages are:

    - Blitzing either by the AI or a player more difficult.
    - The AI desperately needs a core area to expand from. A fragmented empire inevitably ends up as fatal for the AI. The player expands logically, the AI doesnt. This script keeps forcing the AI back to its starting areas.
    - Loss of the starting positions and the advanced structures usually results in an AI faction that is weak and anemic. Recovery is rare. The player will fight tooth and nail for these areas, the AI usually doesn't.
    - Damaged or weakened AI factions keep raising armies in the core areas. While these areas can be heavily garrisoned, the player will be tying down military forces that could be used elsewhere.
    Work of God

  19. #19
    IZ-Master's Avatar Centenarius
    Join Date
    Dec 2006
    Location
    Puerto Rico
    Posts
    843

    Default Re: Turbo's AI FACTION SURVIVAL SCRIPT

    Waiting for upgrade to start campaign as I know ITs not save compatible

    Stainless Steel Beta Tester Version 6.0->6.1
    DarthMod 1.4 D: The Last Episode Beta Tester

  20. #20

    Default Re: Turbo's AI FACTION SURVIVAL SCRIPT

    Is this fix compatible with Echad's 2.0 fix?

Page 1 of 2 12 LastLast

Posting Permissions

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