Page 2 of 2 FirstFirst 12
Results 21 to 25 of 25

Thread: Debts and disbandment of mercenaries

  1. #21

    Default Re: Debts and disbandment of mercenaries

    Quote Originally Posted by Jurand of Cracow View Post
    they're not disbanded by script. Maybe the AI disbands it when it's in debt. But then there's a script helping it while in debt. So all in all - I dont' know why
    I think the Economy script disbands mercenary units also for AI when it goes into debt:

    monitor_event PreFactionTurnStart I_CompareCounter ai_ec_id > 0 and Treasury < -5000


    log --- economy script --- AI treasury less than -5000
    if I_CompareCounter ai_ec_id = 1
    add_money slave 2147483647
    add_money slave 2147483647
    add_money slave -2147483647
    add_money slave -5000
    end_if


    if I_CompareCounter ai_ec_id = 2
    destroy_units venice, mercenary_unit
    wait 0.1
    set_counter freeze_venice 0
    add_money venice 2147483647
    add_money venice 2147483647
    add_money venice -2147483647
    add_money venice -5000
    set_event_counter freeze_recr_pool 1
    end_if
    ai_ec_id = 0 for the human if I am not mistaken.
    Interestingly the same thing happens when AI goes above 100k:

    monitor_event PreFactionTurnStart I_CompareCounter ai_ec_id > 0 and Treasury > 100000


    log --- economy script --- AI treasury above 100000
    if I_CompareCounter ai_ec_id = 2
    destroy_units venice, mercenary_unit
    wait 0.1
    set_counter freeze_venice 0
    add_money venice 2147483647
    add_money venice 2147483647
    add_money venice -2147483647
    add_money venice 100000
    end_if
    (In parenthesis I wonder what would happen if we remove it , that would also allow the wait 0.1 to be removed and speed up turn time maybe, but thats another discussion)
    Last edited by Macaras; September 22, 2023 at 03:48 PM.

  2. #22
    Jurand of Cracow's Avatar History and gameplay!
    Join Date
    Oct 2012
    Location
    Cracovia
    Posts
    8,501

    Default Re: Debts and disbandment of mercenaries

    ah, yeah, you're right. the AI also disbands. I haven't written this script (it was MWY plus somebody, they've spent quite some time on it, it seemed well-though-out) so I've forgotten. Now I recall I wanted to have a look at the script precisely because the disbandment while having a lot of money. to be investigated indeed.

    frankly speaking, I would be in favour deleting this AI disbandment script. It cripples the AI planning - it counts strenghts, sends an army, and then part of it just disappears (the AI doesn't know about the script). So it's better to let it have them - it will stay longer unable to recruit new troops (the script will level up the debt created by the upkeep each turn, until part of the army is gone through battles), but it will prevent cycles in the AI planning (recruit -> send army for an attack -> disband due to the debts -> attack is not possible, so withdraw -> no debt, so recruit -> send ...)

    wait 0.1 - doesn't seem to overload the time much, while it may be important for crashes (some time ago I've discovered that the "fire" script didn't work (and provoked crashes) just because wait was missin).
    Last edited by Jurand of Cracow; September 23, 2023 at 12:18 AM.

  3. #23

    Default Re: Debts and disbandment of mercenaries

    frankly speaking, I would be in favour deleting this AI disbandment script. It cripples the AI planning - it counts strenghts, sends an army, and then part of it just disappears (the AI doesn't know about the script). So it's better to let it have them - it will stay longer unable to recruit new troops (the script will level up the debt created by the upkeep each turn, until part of the army is gone through battles), but it will prevent cycles in the AI planning (recruit -> send army for an attack -> disband due to the debts -> attack is not possible, so withdraw -> no debt, so recruit -> send ...)

    wait 0.1 - doesn't seem to overload the time much, while it may be important for crashes (some time ago I've discovered that the "fire" script didn't work (and provoked crashes) just because wait was missin).
    Exactly, this is what I am thinking as well. We could just delete the lines 'destroy_units mercenary' in the situation of more than 100k. I guess it was written so that AI will not buy out and keep all the available mercenaries, but I actually think its not bad, just more difficult for the player in certain situations. And if we delete 'destory_units' we can also delete 'wait' as it is there to prevent crashes after disbanding units. Wait is ok in a situation of event, like fire or city revolt, but in the part of the code that repeat itself every turn- the less we have it, the faster turn times I think. And I remember that wait is much longer then campaign_wait, and is not really timing precisely. If there is 5-10 rich factions maybe we can have some noticeable turn speed improvement. But I am talking only about the situation 100k above.
    I also checked the SS6.4 and they had a different economy script, which doesn't disband mercs when a lot of money, but does it when in debt. And EBII interestingly have only a little help for the ai if in debt - just leveling it to 0 and then adding 500 gold, like this:

    monitor_event PreFactionTurnStart TrueCondition and Treasury < 0 ; Faction concerned is in debt
    if I_EventCounter faction_turn_f_rome > 0
    and I_IsFactionAIControlled f_rome
    add_money f_rome -2147483647 ; Maximum negative - to clear the current value
    add_money f_rome 2147483647 ; Maximum positive, to return treasury balance to 0
    add_money f_rome 500 ; Something positive, to encourage the AI to move
    end_if
    So it doesn't even freeze the recruitment.

  4. #24
    Jurand of Cracow's Avatar History and gameplay!
    Join Date
    Oct 2012
    Location
    Cracovia
    Posts
    8,501

    Default Re: Debts and disbandment of mercenaries

    Yeah, I trust EBII the most. If you wan to delete those things you've mentioned, go ahead.

  5. #25

    Default Re: Debts and disbandment of mercenaries

    Quote Originally Posted by Jurand of Cracow View Post
    Yeah, I trust EBII the most. If you wan to delete those things you've mentioned, go ahead.
    Ok

Page 2 of 2 FirstFirst 12

Posting Permissions

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