Results 1 to 7 of 7

Thread: How to stop AI armies from lifting scripted sieges?

  1. #1

    Default How to stop AI armies from lifting scripted sieges?

    So, basically I implemented a series of spawned armies that are then instructed to besiege settlements. Most of them work as intended, but in some cases, as soon as they besiege the settlement they immediately lift it and go do something else.

    However I know that some mods are able to force a siege to its conclusion, I recall for example in the Warhammer mod, spawned Beastmen armies would do so.

    I would very much appreciate any help with the codes necessary.

  2. #2

    Default Re: How to stop AI armies from lifting scripted sieges?

    Well, that has been a problem that I faced recently and indeed, the armies besiege the settlement but most often, they leave on the next turn.
    You have two option to solve that. Either add more scripts that force that army (if it is still alive) to besiege again the settlement so that at least it continues to besiege it, or you order the army to attack the settlement, for this part to work, you will have to add the console command that damages the settlement walls so that it creates a breach where the enemy army can enter. If that army has siege machines, it will be even better.

  3. #3

    Default Re: How to stop AI armies from lifting scripted sieges?

    Ok I got it working by forcing the army to keep besieging the settlement.

    But this creates another problem. I had a historic event tied to that army spawning monitor, but as it loops to order the army to keep besieging the city, the historic event fires again as well.

    I tried adding another monitor separately to fire the historic event, but it isnt working.

    Edit: nevermind, got that working too
    Last edited by Sulfurion Blackfyre; November 10, 2019 at 02:40 AM.

  4. #4
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,121
    Blog Entries
    35

    Default Re: How to stop AI armies from lifting scripted sieges?

    Here is a sample:

    Code:
        declare_counter siege_[settlement name]
        monitor_event                                                         ; whatever you decide
    
            spawn_army         ; spawn next to settlement, set direction to face settlement
                faction [faction name]
                character    [character name], general, age 29, x [value], y [value], label [label entry], direction W  
                ; your army details
            sieging
            siege_settlement [label entry], [settlement name], maintain        ; maintains siege
            terminate_monitor
        end_monitor
    
        monitor_event FactionTurnEnd FactionType [faction name]
            and I_CharacterExists [label entry]
            and I_SettlementUnderSiege [settlement name]
    
            if I_CompareCounter siege_[settlement name] < 2                    ; number of turns to keep sieging
                siege_settlement [label entry], [settlement name], maintain
            end_if
            if I_CompareCounter siege_[settlement name] = 2                    ; turn count has been reached
                siege_settlement [label entry], [settlement name], attack    ; final attack
                terminate_monitor
            end_if
    
            inc_counter siege_[settlement name] 1
        end_monitor
    Last edited by Gigantus; November 13, 2019 at 10:59 PM.










  5. #5
    bitterhowl's Avatar Campidoctor
    Join Date
    Feb 2011
    Location
    Russian Feodality
    Posts
    1,695

    Default Re: How to stop AI armies from lifting scripted sieges?

    Sorry for necro and even offtop, but just don't want to multiply 3-post threads.

    Question is - is there a way to force besieged garrison to sally out on last siege turn instead of mutual surrender and capturing settlement by besiegers?

    My sister, do you still recall the blue Hasan and Khalkhin-Gol?
    Russian warship is winning. Proofs needed? Go find yourself!

  6. #6
    z3n's Avatar State of Mind
    took an arrow to the knee

    Join Date
    Aug 2011
    Posts
    4,640

    Default Re: How to stop AI armies from lifting scripted sieges?

    Have you tried the sally ratio in descr_campaign_db?
    The AI Workshop Creator
    Europa Barbaroum II AI/Game Mechanics Developer
    The Northern Crusades Lead Developer
    Classical Age Total War Retired Lead Developer
    Rome: Total Realism Animation Developer
    RTW Workshop Assistance MTW2 AI Tutorial & Assistance
    Broken Crescent Submod (M2TW)/IB VGR Submod (BI)/Animation (RTW/BI/ALX)/TATW PCP Submod (M2TW)/TATW DaC Submod (M2TW)/DeI Submod (TWR2)/SS6.4 Northern European UI Mod (M2TW)

  7. #7
    bitterhowl's Avatar Campidoctor
    Join Date
    Feb 2011
    Location
    Russian Feodality
    Posts
    1,695

    Default Re: How to stop AI armies from lifting scripted sieges?

    No, I didn't. Honestly, it's not my own question. Here are descr_campaigh_db ai section from that mod.

    Code:
    <ai>
          <att_str_modifier float="0.8"/>            <!-- modifies the effective attackers strength when determining the priority of making attack decision (i.e. att_def_strength_ratio = ((att_str*att_str_modifier)/def_str) -->
          <siege_att_str_modifier float="0.30"/>      <!-- modifies the effective sieging attackers strength when determining the priority of making attack decision -->
          <crusade_att_str_modifier float="1.0"/>    <!-- modifies the effective crusading sieging attackers strength when determining the priority of making attack decision -->
          <sally_att_str_modifier float="1.0"/>      <!-- modifies the effective sallying attackers strength when determining the priority of making attack decision -->
          <ambush_att_str_modifier float="1.0"/>     <!-- modifies the effective ambushing attackers strength when determining the priority of making attack decision -->
          <str_limit_weak float="0.5"/>              <!-- min ideal strength ratio modifier for determining when an army is far too weak for an attack ( att_def_strength_ratio < (ideal_str_ratio*str_limit_weak) ) -->
          <str_limit_strong float="99.0"/>            <!-- max ideal strength ratio modifier for determining when an army is far too strong for a fair attack ( att_def_strength_ratio > (ideal_str_ratio*str_limit_strong) ) -->
          <merchant_min_survival_acquire int="75"/>  <!-- the minimum survival chance for a merchant to consider attempting an acquisition -->
       </ai>

    My sister, do you still recall the blue Hasan and Khalkhin-Gol?
    Russian warship is winning. Proofs needed? Go find yourself!

Posting Permissions

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