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

Thread: AI suport mod assistance

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Tiro
    Join Date
    Oct 2009
    Location
    South Dakota
    Posts
    243

    Default AI suport mod assistance

    Hay guys I started talking about a couple of ideas I had for modding the AI's treasury bonus script on another thread and thought I should start my own. Anyway here's what I posted on the other thread:

    ~~~~~~~~~~~~~~~~~~~~~~

    Spoiler Alert, click show to read: 

    Quote Originally Posted by Twist of Cain View Post
    I'd be curious to hear what sort of results you get, though bear in mind the AI is dumb as bricks, and once it enters a debt spiral, I doubt would be smart enough to force itself out.

    Go to default install location:

    C:\Program Files\SEGA\Medieval II Total War\mods\Third_Age\data\world\maps\campaign\imperial_campaign

    Edit the file: campaign_script.txt

    Search for: MONEY DEPT SCRIPT

    You will see the following, repeated once for every faction:

    Spoiler Alert, click show to read: 
    Code:
    ;########################### MONEY DEPT SCRIPT ##############################
     monitor_event FactionTurnStart FactionType england
      and IsFactionAIControlled
      and Treasury < -500
     
       add_money england 10000
     
     end_monitor


    If you wanted to play with the code, I suppose you could try making multiple triggers for each faction instead of just one per, and tweak the amount given to them based on how much they are in debt. That way, they'd still get bailed out, but would not be able to get as much gold out of getting into minor debt.

    Spoiler Alert, click show to read: 
    Code:
     monitor_event FactionTurnStart FactionType england
      and IsFactionAIControlled
      and Treasury < 0
      and Treasury >= -1000
       add_money england 1500
     end_monitor
     
     monitor_event FactionTurnStart FactionType england
      and IsFactionAIControlled
      and Treasury < -1000
      and Treasury >= -2000
       add_money england 2500
     end_monitor
     
     monitor_event FactionTurnStart FactionType england
      and IsFactionAIControlled
      and Treasury < -2000
      and Treasury >= -3000
       add_money england 3500
     end_monitor
     
    ;(etc)


    The example given would bail them out if their debt per turn doesn't get worse than -3000, but it will only leave them between 500 and 1500 gold. I'm sure there are more elegant ways to do this, maybe a scripting guru will chime in.


    I actully have two ideas I thought of that might be kinda interesting to try but I'm not all that great a coder(I can only do the most basic changes right now) and wasn't quite sure how to implament them.

    Option A: Every other turn Bonus


    I was thinking of setting it so that instead of the AI getting 10,000 gold if their bank is at -500 every turn, set it so they get 20,000 if their bank is at -500 but have it set so it only checks the AI's balance every other turn. While at first this may seem to do the same thing it could potentially change things in 3 ways that I could think of (only two of which I can remember at this moment ):

    1. Since any faction can only build so many units per turn, if the AI runs out of money on one of the odd turns they'll have to wait until the next turn to continue building units. Hence it COULD potentially slow down the AI's ability to spawn units without actully stopping them from doing so.

    2. If a faction happens to loose enough units during a turn it may be possible that during the next even turn their treasury manages to stay just above the -500 mark. Hence they will not recieve the bonus until the next even turn. In a way this could on occation give the AI faction the apearance that they've taken enough damage that they need a few moments to take a step back to recupe, rather than the "we just lost five thousand men, oh well here's the next five thousand" that it seems to have right now.

    As well maybe altering the income from 20,000 to 15,000 or changing the negative balance from -500 to -1000 might worth considering with this idea as well. Or possibly even make it check every third turn and give 30,000.


    Option B: Demishing returns baised on unit upkeep

    At the moment it seems the AI is being rewarded for over building huge hard to mantain armies, hence one of the reasons Dwarves are probably doing so well. This idea would be that while the AI still gets bonuses once their bank hits -500 however the amount they get will decrease depending on how much of it is already being spent on unit upkeep.

    For example if unit upkeep is =<10,000 they would get 10,000 gold. If unit upkeep is >10,000 but =<15,000 they'll recieve 9,000, and so on and so forth. (I'm not certain what the typical AI unit upkeep is so these numbers would probably be different)

    By doing this you would be able to allow the AI to build units quickly at first, but as their armys get larger they'll grow slower. Then should the AI take a large lose of units in a given turn their income would jump up again giving them the chance to build up once more.

    This one could also help balance factions with high upkeep units vrs factions with low upkeep units. As a faction like the Dwarves would begin slowing down in their ability to pump out new units faster than a faction like OotMM who's units are cheaper to maintain. At least thoredically .

    ~~~~~~~~~~~~~~~~~~~~~

    Now I've already finished Option A and am ganna test it tonight. If anyone else wants ta bata test it with me, feel free to upload the file at the end of this post. It should be save compatable (and hopefully coded right ), but I'm not sure as I won't be testing it until I'm done with this post.

    edit: Tested it works

    As for Option B, if someone could tell me what I'd need to write to code in the unit upkeep as well I'd really apreaciate it. I'm hoping this mod will help curb the sudden power explosion of the AI Dwarves as well.
    Last edited by trueblaze; January 15, 2010 at 08:41 PM.

  2. #2

    Default Re: AI suport mod assistance

    Is this 1.4 compatible? I'll try it out because this issue does my head in as well. Looking forward to Opt B.

  3. #3

    Default Re: AI suport mod assistance

    So far I've found a few bugs due to mistypes ie (correct me if I'm wrong):

    monitor_event FactionTurnStart FactionType sicily
    and IsFactionAIControlled
    and Treasury < -500
    and I_CompareCounter quarter = 1

    add_money venice 10000

    end_monitor

    Theres a few like this.

  4. #4

    Default Re: AI suport mod assistance

    Great idea this is much needed. The army spam is really a pain. Maybe with this idea we can crush an army and actually cause the enemy some harm for a change

  5. #5
    Muffer Nl's Avatar Praefectus
    Join Date
    Oct 2008
    Location
    Sommelsdijk, Zuid-Holland, Netherlands
    Posts
    6,305

    Default Re: AI suport mod assistance

    Clearly submod section...


  6. #6
    Tiro
    Join Date
    Oct 2009
    Location
    South Dakota
    Posts
    243

    Default Re: AI suport mod assistance

    Quote Originally Posted by yobi_uk View Post
    So far I've found a few bugs due to mistypes ie (correct me if I'm wrong):

    monitor_event FactionTurnStart FactionType sicily
    and IsFactionAIControlled
    and Treasury < -500
    and I_CompareCounter quarter = 1

    add_money venice 10000

    end_monitor

    Theres a few like this.
    I looked at the lines I changed and added and I didn't see any where the factionturnstart and the add_money faction names were different.


    Quote Originally Posted by yobi_uk View Post
    Is this 1.4 compatible? I'll try it out because this issue does my head in as well. Looking forward to Opt B.
    Yes this is 1.4 compatible and it is also save game compatable. Though I'm uncertain if it is compatable to previous mods or to RC/RR.


    Quote Originally Posted by Muffer Nl View Post
    Clearly submod section...
    Yes I do plan on moving this to the submod section. Unfortiantly as I said, I'm still pretty new at modding (about all I can do is copy and past lines and make minor changes to the number stats) and I am currently uncertain of what I need to write to make unit upkeep part of the conditions (which is the main reason for this thread). Once I learn that, I'll be able to work on Option B and I'll start a thread in the submod section.

    As for right now, my plans for Option B are to actully give the AI an increased amount of scripted cash (12,000) if their unit upkeep is 10,000 or below. Then for every 5,000 up keep I'd drop the amount by 1,000 gold down to 5,000 at 45,000+ unit upkeep. I estemated that, depending on the level of units in play as well as factions, that 5,000 upkeep is somewhere between 20-35 units.

    If anyone has any other ideas let me know and I'll consider them. And if anyone knows what line I need to add to do the scripting let me know and I'll be VERY grateful.
    What if your entire purpose in life was to be "dead teen #2".

  7. #7

    Default Re: AI suport mod assistance

    So far your script has appeared to help in stopping the endless horde of enemies. To what extent I'm not quite sure the friendly factions seems to last longer, the Silvan Elves for one (before they end up just having their capitol left).

    I cant wait for option B mate. I checked and compared your file with Notepad ++. I've modified it a bit because I didn't want the AI to get too much money (only a little bit, just the amount of cash they get).

    please find file attached:

  8. #8
    Tiro
    Join Date
    Oct 2009
    Location
    South Dakota
    Posts
    243

    Default Re: AI suport mod assistance

    Quote Originally Posted by yobi_uk View Post
    So far your script has appeared to help in stopping the endless horde of enemies. To what extent I'm not quite sure the friendly factions seems to last longer, the Silvan Elves for one (before they end up just having their capitol left).

    I cant wait for option B mate. I checked and compared your file with Notepad ++. I've modified it a bit because I didn't want the AI to get too much money (only a little bit, just the amount of cash they get).

    please find file attached:
    If your intention was to give all factions 15,000 gold instead of 20,000 it seems you missed the second half of France, All of hre, and the first half of Spain (their all lined up in a row just as I posted here so they should be easy to find).

    As for Option B, I'm still hoping someone can tell me the line I need in order to make that one work. Maybe I'll try bugging someone I know to be a moder to see if they could tell me, or if all else fails I'll just have to search through the game's text files and hope I can find what I need.

    BTW, the AI is still able to produce large armies right? Just not as quickly?
    Last edited by trueblaze; January 15, 2010 at 09:26 PM.
    What if your entire purpose in life was to be "dead teen #2".

  9. #9

    Default Re: AI suport mod assistance

    Yep they are still producing large armies but as you say not as quickly. It only seems a remedy, but now I see Eriador and other weak factions spouting large armies strong enough even to go against OOTM.

    Well I wasn't against large armies, its just that I wanted the other factions to feel the loss when defeated just as I do when I'm defeated. It ain't welfare after all, if I have to build up my economy to sustain a large army then they should too. So I hope you find someone to get the vital piece of your puzzle 'cos I can't wait.

    (do you know what Russian Gondor meant? He's a veteran, maybe he can help?)

  10. #10
    Tiro
    Join Date
    Oct 2009
    Location
    South Dakota
    Posts
    243

    Default Re: AI suport mod assistance

    Quote Originally Posted by yobi_uk View Post
    (do you know what Russian Gondor meant? He's a veteran, maybe he can help?)
    Not sure, I think he's either asking why I added the AI money script. To which if he is I'd say: I didn't, I simply altered them. Or he's asking why I'd give them more money at the start with option B. To which I'd say: Because if the AI has 10,000 or less in unit upkeep AND there at -500 or lower, they're probably on their last legs and probably only have one or two cities left and could use all the cash they could get just to hang on.

    Also while where on the subject I think I'll also ask: Hay, RG, do you know the line I need to add to make Option B a realty?
    What if your entire purpose in life was to be "dead teen #2".

  11. #11

    Default Re: AI suport mod assistance

    Why the heck would you want that? I checked nation line graph.... money below zero and going down more while military is going up up up up up up.....

  12. #12

    Default Re: AI suport mod assistance

    Quote Originally Posted by Russian Gondor View Post
    Why the heck would you want that? I checked nation line graph.... money below zero and going down more while military is going up up up up up up.....
    que? could you care to elaborate so I understand where its all going wrong. To be honest I haven't got a clue

  13. #13

    Default Re: AI suport mod assistance

    Note that RC/RR does not give factions 10000 when they hit -500. Instead, AI settlements get an income bonus depending on their size and type.

  14. #14

    Default Re: AI suport mod assistance

    Quote Originally Posted by Point Blank View Post
    Note that RC/RR does not give factions 10000 when they hit -500. Instead, AI settlements get an income bonus depending on their size and type.
    @trueblaze: this looks interesting...
    ;================== AI Economy Script ===================
    ;########################### MONEY DEPT SCRIPT ##############################

    monitor_event SettlementTurnStart not FactionIsLocal
    and FactionType england
    and SettlementType city
    and SettlementBuildingExists = wooden_pallisade
    console_command add_money england, 100
    end_monitor

    monitor_event SettlementTurnStart not FactionIsLocal
    and FactionType england
    and SettlementType city
    and SettlementBuildingExists = wooden_wall
    console_command add_money england, 200
    end_monitor

    monitor_event SettlementTurnStart not FactionIsLocal
    and FactionType england
    and SettlementType city
    and SettlementBuildingExists = stone_wall
    console_command add_money england, 300
    end_monitor

    ....etc

    @Point Blank: I'm gonna try to implement this script, cheers mate.

  15. #15
    Tiro
    Join Date
    Oct 2009
    Location
    South Dakota
    Posts
    243

    Default Re: AI suport mod assistance

    lol, I'll have to check out the differences in RC/RR though I'm not sure if people are having problems with wave after wave of attacks in that one?? By the way Point Blank YOU wouldn't happen to know the line I need to make Option B work now would you . Come one some one's gatta know the answer to this question.....anyone?......*crickets churping*...anyone at all?.....*tumble weed rolls by*.....
    What if your entire purpose in life was to be "dead teen #2".

  16. #16

    Default Re: AI suport mod assistance

    ;---- Empire money
    monitor_event FactionTurnStart FactionType hre
    and not FactionIsLocal
    and I_TurnNumber < 50
    and I_NumberOfSettlements hre < 14
    and I_NumberOfSettlements hre > 3

    console_command add_money hre, 4000

    end_monitor

    monitor_event FactionTurnStart FactionType moors
    and not FactionIsLocal
    and I_TurnNumber < 50
    and I_NumberOfSettlements moors < 13
    and I_NumberOfSettlements moors > 3

    console_command add_money moors, 4000

    end_monitor

    ====== this looks interesting as well. maybe good for major players like Gondor and Morder, etc.

  17. #17
    Baron Samedi's Avatar Citizen
    Join Date
    Apr 2009
    Location
    The Netherlands
    Posts
    1,414

    Default Re: AI suport mod assistance

    Quote Originally Posted by yobi_uk View Post
    ;---- Empire money
    monitor_event FactionTurnStart FactionType hre
    and not FactionIsLocal
    and I_TurnNumber < 50
    and I_NumberOfSettlements hre < 14
    and I_NumberOfSettlements hre > 3

    console_command add_money hre, 4000

    end_monitor

    monitor_event FactionTurnStart FactionType moors
    and not FactionIsLocal
    and I_TurnNumber < 50
    and I_NumberOfSettlements moors < 13
    and I_NumberOfSettlements moors > 3

    console_command add_money moors, 4000

    end_monitor

    ====== this looks interesting as well. maybe good for major players like Gondor and Morder, etc.
    So it seems this script gives the A.I. money based on the number of settlements they have during the first 50 turns.
    Under the patronage of MasterBigAb

  18. #18

    Default Re: AI suport mod assistance

    er, whose permission need we ask to use it by the way? I'll be using it for personal use at the mo and see how it goes, but if anyone else wants to have a look I don't want to distribute things that aren't mine.
    Last edited by yobi_uk; January 16, 2010 at 09:50 AM. Reason: mis-grammer

  19. #19

    Default Re: AI suport mod assistance

    Quote Originally Posted by yobi_uk View Post
    er, whose permission need we ask to use it by the way? I'll be using it for personal use at the mo and see how it goes, but if anyone else wants to have a look I don't want to distribute things that aren't mine.
    er... If I read where I was downloading it I would know it was you Point Blank...thanks for the advice

  20. #20
    Tiro
    Join Date
    Oct 2009
    Location
    South Dakota
    Posts
    243

    Default Re: AI suport mod assistance

    Ooooooooookay, I'm assuming no one knows how to do the unit upkeep mod since no one has answered so far >.>
    What if your entire purpose in life was to be "dead teen #2".

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
  •