Results 1 to 3 of 3

Thread: [Submod]changed AI money assistance script [help/advice needed]

  1. #1
    Terrible Tactician Member Shadowwalker's Avatar
    Join Date
    Nov 2007
    Location
    Germania Libera *g*
    Posts
    299

    Default [Submod] changed AI money assistance script [help/advice needed]

    So I have been pondering about this quite for some time even before the release of EB II.
    My idea has been to adjust the AI money bonus according to the factions' size.

    In the following spoilers I'll don't include the whole script changes but only use one faction as an example.

    The is how it is currently set by the EB team:

    Spoiler Alert, click show to read: 

    monitor_event FactionTurnStart FactionType f_rome
    and IsFactionAIControlled
    and Treasury < 600
    if I_LosingMoney f_rome
    increment_kings_purse f_rome 1000
    end_if
    if not I_LosingMoney f_rome
    console_command add_money f_rome, 400
    end_if
    end_monitor
    ;;;;;;;;;;;;;;;;;;
    monitor_event FactionTurnStart FactionType f_rome
    and IsFactionAIControlled
    and not LosingMoney
    and Treasury > 20000
    increment_kings_purse f_rome -1000
    end_monitor


    And this is what I changed it to:

    Spoiler Alert, click show to read: 

    monitor_event FactionTurnStart FactionType f_rome
    and IsFactionAIControlled
    if not I_NumberOfSettlements f_rome > 6
    set_kings_purse f_rome 4000
    end_if
    end_monitor
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;
    monitor_event FactionTurnStart FactionType f_rome
    and IsFactionAIControlled
    if I_NumberOfSettlements f_rome > 6
    if not I_NumberOfSettlements f_rome > 8
    set_kings_purse f_rome 2000
    end_if
    end_monitor
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    monitor_event FactionTurnStart FactionType f_rome
    and IsFactionAIControlled
    if I_NumberOfSettlements f_rome > 8
    set_kings_purse f_rome 0
    end_if
    end_monitor
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    monitor_event FactionTurnStart FactionType f_rome
    and IsFactionAIControlled
    and Treasury < 600
    if I_LosingMoney f_rome
    console_command add_money f_rome, 2000
    end_if
    end_monitor
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;
    monitor_event FactionTurnStart FactionType f_rome
    and IsFactionAIControlled
    and not LosingMoney
    and Treasury > 20000
    console_command add_money f_rome -3000
    end_monitor



    (1) small factions and factions that haven't grown beyond their starting size +1 province receive a significant bonus (4000 mnai) to their income.
    (2) factions that have grown a bit (stating provinces +3) still receive a moderate money bonus (2000 mnai)
    (3) larger factions (>starting provinces +3) receive no automatic bonus to their income anymore, unless they are losing money.
    (4) the "take away some money from the AI if they have too much" script has been altered a bit, but I didn't change the basic approach there.
    (4) the slave faction hasn't been touched because they are actually developing their settlements and recruting nicely, no need to change much there in my opinion.
    (5) No changes to the player setting, all the changes are affecting the AI exclusively.

    In theory this is meant to provide the following changes:

    Small factions (in particular all the 1-province factions) don't start with an immediate debt when AI-controlled.
    Growing factions are slowed down a bit.
    There is hopefully less chance (or even no chance, can't say for sure yet as the whole thing lacks serious testing so far) for factions who own only 1 or two provinces (Pergamon! Massylia! Lusotannan!) to spam 5 or even 6 stacks without doing anything.

    I tested it at least a bit yet, the altered campaign script doesn't crash the game (started 3 games with different factions and hit "end turn" for 20 turns).

    I ran into a really odd bug though. My changes seem to have caused the "select potential successor" script ceasing to work. Which is rather mysterious as I didn't touch that script at all. Does any of you have an idea what may have caused this?



    I attach the file nevertheless, just in case you want to have a look at it.
    I don't recommend using the file yet due to the mentioned bug, though.
    Attached Files Attached Files
    Last edited by Shadowwalker; 09-12-2014 at 07:23.
    Finished EB Campaigns: Kart-Hadast 1.0/1.2 | Pontos 1.1 | Arche Seleukeia 1.2 | Hayasdan 1.2 | Sab'yn 1.2 | Makedonia 1.2 (Alex)
    Lost Campaigns (1.2, Alex. exe): Getai | Sab'Yn
    Ongoing campaigns (1.2): SPQR (110 BC) | Sab'yn (217 BC) | Pontos (215 BC)
    from Populus Romanus

    "The state of human ethics can be summarized in two sentences: We ought to. But we don't." (Tucholsky)

  2. #2
    Speaker of Truth Senior Member Moros's Avatar
    Join Date
    Jan 2005
    Location
    Belgium
    Posts
    13,469

    Default Re: [Submod]changed AI money assistance script [help/advice needed]

    This likely means you've broken the script. After pressing the end trun button toggle the command box and press the up key when in the ablility to type in the box. This way you can see previous console commands even those performed by script, such as the add_money command done by your script. This way you can check for sure whether this is actually working. Have you used Notepad++ to edit the file?

    Also shouldn't this:
    monitor_event FactionTurnStart FactionType f_rome
    and IsFactionAIControlled
    if I_NumberOfSettlements f_rome > 6
    if not I_NumberOfSettlements f_rome > 8
    set_kings_purse f_rome 2000
    end_if
    end_monitor

    Here you don't start with an if, use multiple ifs and only use on end if. I don't know much about MTW2 scripting but this seems like a big no-no, to me.

    be:
    Code:
     
    monitor_event FactionTurnStart FactionType f_rome
    if IsFactionAIControlled
    and I_NumberOfSettlements f_rome > 6 and not I_NumberOfSettlements f_rome > 8 set_kings_purse f_rome 2000
    end_if end_monitor
    Make sure you're structure of coding is always good. One if followed by and's to set multiple conditions that need to be jointly set for following actions. Also not tab spacing. A secondary if and "and sequence" for further specification of certain event with an additionally increased indent (tab) can be set but then you also need an additional end_if. At least this is the way other parts of the script seem to be coded.

    Member thankful for this post:



  3. #3
    Terrible Tactician Member Shadowwalker's Avatar
    Join Date
    Nov 2007
    Location
    Germania Libera *g*
    Posts
    299

    Default Re: [Submod]changed AI money assistance script [help/advice needed]

    Quote Originally Posted by Moros View Post
    Here you don't start with an if
    I just copied that part from the original EB code, as you can see in the first spoiler, there are parts that don't start with an "if" but an "and" and there are even parts that have no single "if" at all in all their conditions.

    Main part of the problem is that I still have little idea what I'm doing, I'm just no programmer/scripter.
    I just need to read more tutorials, hehe.

    Anyway, thanks a lot for the tips, Moros.
    Last edited by Shadowwalker; 09-12-2014 at 07:25.
    Finished EB Campaigns: Kart-Hadast 1.0/1.2 | Pontos 1.1 | Arche Seleukeia 1.2 | Hayasdan 1.2 | Sab'yn 1.2 | Makedonia 1.2 (Alex)
    Lost Campaigns (1.2, Alex. exe): Getai | Sab'Yn
    Ongoing campaigns (1.2): SPQR (110 BC) | Sab'yn (217 BC) | Pontos (215 BC)
    from Populus Romanus

    "The state of human ethics can be summarized in two sentences: We ought to. But we don't." (Tucholsky)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Single Sign On provided by vBSSO