Results 1 to 11 of 11

Thread: How to force AI to deploy stakes

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

    Default How to force AI to deploy stakes

    Seems that .xml can't force AI to deploy stakes. Here is a part of code from G5 system, but it doesn't work by unknown reason.

    Spoiler Alert, click show to read: 
    Code:
    script
    
    declare_show_me
    dismiss_advice
    select_ui_element advisor_portrait_button
    simulate_mouse_click lclick_up
    select_ui_element dismiss_advice_button
    simulate_mouse_click lclick_up
    
    declare_counter player_unit_count
    declare_counter enemy_unit_count
    ;;;Army 1
        set_counter player_unit_count 0
        if I_BattlePlayerArmyNumberOfUnits > 0
        label_unit 0 0 0 a1u1
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 1
        label_unit 0 0 1 a1u2
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 2
        label_unit 0 0 2 a1u3
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 3
        label_unit 0 0 3 a1u4
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 4
        label_unit 0 0 4 a1u5
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 5
        label_unit 0 0 5 a1u6
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 6
        label_unit 0 0 6 a1u7
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 7
        label_unit 0 0 7 a1u8
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 8
        label_unit 0 0 8 a1u9
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 9
        label_unit 0 0 9 a1u10
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 10
        label_unit 0 0 10 a1u11
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 11
        label_unit 0 0 11 a1u12
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 12
        label_unit 0 0 12 a1u13
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 13
        label_unit 0 0 13 a1u14
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 14
        label_unit 0 0 14 a1u15
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 15
        label_unit 0 0 15 a1u16
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 16
        label_unit 0 0 16 a1u17
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 17
        label_unit 0 0 17 a1u18
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 18
        label_unit 0 0 18 a1u19
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits = 20
        label_unit 0 0 19 a1u20
        inc_counter player_unit_count 1
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
    
        ;;;Army 2
        set_counter enemy_unit_count 0
        if I_BattleEnemyArmyNumberOfUnits > 0
        label_unit 1 0 0 a2u1
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 1
        label_unit 1 0 1 a2u2
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 2
        label_unit 1 0 2 a2u3
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 3
        label_unit 1 0 3 a2u4
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 4
        label_unit 1 0 4 a2u5
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 5
        label_unit 1 0 5 a2u6
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 6
        label_unit 1 0 6 a2u7
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 7
        label_unit 1 0 7 a2u8
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 8
        label_unit 1 0 8 a2u9
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 9
        label_unit 1 0 9 a2u10
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 10
        label_unit 1 0 10 a2u11
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 11
        label_unit 1 0 11 a2u12
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 12
        label_unit 1 0 12 a2u13
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 13
        label_unit 1 0 13 a2u14
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 14
        label_unit 1 0 14 a2u15
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 15
        label_unit 1 0 15 a2u16
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 16
        label_unit 1 0 16 a2u17
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 17
        label_unit 1 0 17 a2u18
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 18
        label_unit 1 0 18 a2u19
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits = 20
        label_unit 1 0 19 a2u20
        inc_counter enemy_unit_count 1
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
    
    
    
    monitor_event BattleConflictPhaseCommenced FactionIsLocal
        and I_BattlePlayerArmyIsAttacker
        and I_BattlePlayerArmyNumberOfUnitCategory cavalry > 0
        and I_BattleEnemyArmyNumberOfUnitCategory cavalry = 0
        and I_BattleEnemyArmyNumberOfAttribute stakes > 0
        
        if I_CompareCounter enemy_unit_count > 0
        unit_deploy_stakes a2u1
    end_if
        if I_CompareCounter enemy_unit_count > 1
        unit_deploy_stakes a2u2
    end_if
        if I_CompareCounter enemy_unit_count > 2
        unit_deploy_stakes a2u3
    end_if
        if I_CompareCounter enemy_unit_count > 3
        unit_deploy_stakes a2u4
    end_if
        if I_CompareCounter enemy_unit_count > 4
        unit_deploy_stakes a2u5
    end_if
        if I_CompareCounter enemy_unit_count > 5
        unit_deploy_stakes a2u6
    end_if
        if I_CompareCounter enemy_unit_count > 6
        unit_deploy_stakes a2u7
    end_if
        if I_CompareCounter enemy_unit_count > 7
        unit_deploy_stakes a2u8
    end_if
        if I_CompareCounter enemy_unit_count > 8
        unit_deploy_stakes a2u9
    end_if
        if I_CompareCounter enemy_unit_count > 9
        unit_deploy_stakes a2u10
    end_if
        if I_CompareCounter enemy_unit_count > 10
        unit_deploy_stakes a2u11
    end_if
        if I_CompareCounter enemy_unit_count > 11
        unit_deploy_stakes a2u12
    end_if
        if I_CompareCounter enemy_unit_count > 12
        unit_deploy_stakes a2u13
    end_if
        if I_CompareCounter enemy_unit_count > 13
        unit_deploy_stakes a2u14
    end_if
        if I_CompareCounter enemy_unit_count > 14
        unit_deploy_stakes a2u15
    end_if
        if I_CompareCounter enemy_unit_count > 15
        unit_deploy_stakes a2u16
    end_if
        if I_CompareCounter enemy_unit_count > 16
        unit_deploy_stakes a2u17
    end_if
        if I_CompareCounter enemy_unit_count > 17
        unit_deploy_stakes a2u18
    end_if
        if I_CompareCounter enemy_unit_count > 18
        unit_deploy_stakes a2u19
    end_if
        if I_CompareCounter enemy_unit_count = 20
        unit_deploy_stakes a2u20
        end_if
    
        battle_wait 0.1
        ai_active_set on
    end_monitor
    
    end_script
    Where is the mistake here?

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

  2. #2

    Default Re: How to force AI to deploy stakes

    I have been playing Deus Lo Vult with a battle balance submod and the AI always deploys stakes. Maybe you could check what they did there.

  3. #3

    Icon1 Re: How to force AI to deploy stakes

    Misread, delete please :p
    Last edited by Erken; June 17, 2019 at 02:31 AM.

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

    Default Re: How to force AI to deploy stakes

    Thanks a lot for DLV BB mention. Interesting alternative to G5, smaller. But I don't want entire battle script, only initial stakes placement. And I want to exclude monitor_conditions from code.

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

  5. #5

    Default Re: How to force AI to deploy stakes

    this code is used by the teuton mod from russian modder called blade398 guess it is to from deus le vult
    Spoiler Alert, click show to read: 
    ;;;;*************************************************************************************************;;;;Germanicu5 AI Stakes script (with conditions adjusted by Taiji)
    ;;;;*************************************************************************************************


    monitor_event BattleConflictPhaseCommenced FactionIsLocal
    and I_BattlePlayerArmyIsAttacker
    and ! I_ConflictType Siege
    and ! I_ConflictType SuccessfulAmbush
    and I_BattleEnemyArmyNumberOfAttribute stakes > 0
    and I_BattlePlayerArmyNumberOfUnitCategory cavalry > 0
    and I_BattleEnemyArmyNumberOfUnitCategory cavalry < 1

    prepare_for_battle

    ;;;Player general
    label_unit 0 0 0 General1

    ;;;AI general
    label_unit 1 0 0 General2

    label_unit 1 0 1 unit20
    label_unit 1 0 2 unit21
    label_unit 1 0 3 unit22
    label_unit 1 0 4 unit23
    label_unit 1 0 5 unit24
    label_unit 1 0 6 unit25
    label_unit 1 0 7 unit26
    label_unit 1 0 8 unit27
    label_unit 1 0 9 unit28
    label_unit 1 0 10 unit29
    label_unit 1 0 11 unit30
    label_unit 1 0 12 unit31
    label_unit 1 0 13 unit32
    label_unit 1 0 14 unit33
    label_unit 1 0 15 unit34
    label_unit 1 0 16 unit35
    label_unit 1 0 17 unit36
    label_unit 1 0 18 unit37
    label_unit 1 0 19 unit38

    define_unit_group army2 General2 unit20 unit21 unit22 unit23 unit24 unit25 unit26 unit27 unit28 unit29 unit30 unit31 unit32 unit33 unit34 unit35 unit36 unit37 unit38

    ai_active_set off

    unit_group_order_change_group_formation army2 ordered_triple_line_1 run

    battle_wait 50

    unit_group_order_halt army2

    unit_deploy_stakes General2
    unit_deploy_stakes unit20
    unit_deploy_stakes unit21
    unit_deploy_stakes unit22
    unit_deploy_stakes unit23
    unit_deploy_stakes unit24
    unit_deploy_stakes unit25
    unit_deploy_stakes unit26
    unit_deploy_stakes unit27
    unit_deploy_stakes unit28
    unit_deploy_stakes unit29
    unit_deploy_stakes unit30
    unit_deploy_stakes unit31
    unit_deploy_stakes unit32
    unit_deploy_stakes unit33
    unit_deploy_stakes unit34
    unit_deploy_stakes unit35
    unit_deploy_stakes unit36
    unit_deploy_stakes unit37
    unit_deploy_stakes unit38

    unit_group_order_change_group_formation army2 triple_missiles_in_front run

    release_unit General2
    release_unit unit20
    release_unit unit21
    release_unit unit22
    release_unit unit23
    release_unit unit24
    release_unit unit25
    release_unit unit26
    release_unit unit27
    release_unit unit28
    release_unit unit29
    release_unit unit30
    release_unit unit31
    release_unit unit32
    release_unit unit33
    release_unit unit34
    release_unit unit35
    release_unit unit36
    release_unit unit37
    release_unit unit38

    ai_active_set on

    end_monitor

    wait_monitors

    end_script

  6. #6
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

    Default Re: How to force AI to deploy stakes

    Quote Originally Posted by bitterhowl View Post
    Code:
    monitor_event BattleConflictPhaseCommenced FactionIsLocal
        and I_BattlePlayerArmyIsAttacker
        and I_BattlePlayerArmyNumberOfUnitCategory cavalry > 0
        and I_BattleEnemyArmyNumberOfUnitCategory cavalry = 0
        and I_BattleEnemyArmyNumberOfAttribute stakes > 0
    Are all of those things true? Player is attacker, with cavalry, AI is defender with no cavalry and one or more units with "stakes" attribute.

    Any log errors?

    This is an advisor script. Is the script even being triggered? Try writing something to the log after those conditions above and see if it does turn up in there.

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

    Default Re: How to force AI to deploy stakes

    Well, just finished dealing with it. By unknown reason for me the code above (which was taken from advisor G5 script) didn't work in my mod advisor script. Last monitor was ignored by system without any log mention. I replaced monitor_event line and wrote
    if I_InBattle instead and changed all "and" below to "if". And it works now for custom battle but made unspecified error in campaign. I already made working code for campaign, if somebody has interest I'll post it here tomorrow.

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

  8. #8

    Default Re: How to force AI to deploy stakes

    that would be a very interesting script!

    edit:is it possible too make that script work only for the ai and not for the human player?
    Last edited by stevietheconquer; June 19, 2019 at 11:34 AM.

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

    Default Re: How to force AI to deploy stakes

    Here is the part for advisor script in custom battle

    Spoiler Alert, click show to read: 
    Code:
    script
    
    declare_show_me
    dismiss_advice
    select_ui_element advisor_portrait_button
    simulate_mouse_click lclick_up
    select_ui_element dismiss_advice_button
    simulate_mouse_click lclick_up
    
    declare_counter player_unit_count
    declare_counter enemy_unit_count
    declare_counter battle_stakes
    ;;;Army 1
        set_counter player_unit_count 0
        if I_BattlePlayerArmyNumberOfUnits > 0
        label_unit 0 0 0 a1u1
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 1
        label_unit 0 0 1 a1u2
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 2
        label_unit 0 0 2 a1u3
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 3
        label_unit 0 0 3 a1u4
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 4
        label_unit 0 0 4 a1u5
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 5
        label_unit 0 0 5 a1u6
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 6
        label_unit 0 0 6 a1u7
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 7
        label_unit 0 0 7 a1u8
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 8
        label_unit 0 0 8 a1u9
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 9
        label_unit 0 0 9 a1u10
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 10
        label_unit 0 0 10 a1u11
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 11
        label_unit 0 0 11 a1u12
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 12
        label_unit 0 0 12 a1u13
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 13
        label_unit 0 0 13 a1u14
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 14
        label_unit 0 0 14 a1u15
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 15
        label_unit 0 0 15 a1u16
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 16
        label_unit 0 0 16 a1u17
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 17
        label_unit 0 0 17 a1u18
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 18
        label_unit 0 0 18 a1u19
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits = 20
        label_unit 0 0 19 a1u20
        inc_counter player_unit_count 1
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
    
        ;;;Army 2
        set_counter enemy_unit_count 0
        if I_BattleEnemyArmyNumberOfUnits > 0
        label_unit 1 0 0 a2u1
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 1
        label_unit 1 0 1 a2u2
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 2
        label_unit 1 0 2 a2u3
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 3
        label_unit 1 0 3 a2u4
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 4
        label_unit 1 0 4 a2u5
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 5
        label_unit 1 0 5 a2u6
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 6
        label_unit 1 0 6 a2u7
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 7
        label_unit 1 0 7 a2u8
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 8
        label_unit 1 0 8 a2u9
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 9
        label_unit 1 0 9 a2u10
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 10
        label_unit 1 0 10 a2u11
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 11
        label_unit 1 0 11 a2u12
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 12
        label_unit 1 0 12 a2u13
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 13
        label_unit 1 0 13 a2u14
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 14
        label_unit 1 0 14 a2u15
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 15
        label_unit 1 0 15 a2u16
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 16
        label_unit 1 0 16 a2u17
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 17
        label_unit 1 0 17 a2u18
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 18
        label_unit 1 0 18 a2u19
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits = 20
        label_unit 1 0 19 a2u20
        inc_counter enemy_unit_count 1
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
    
    
    if I_InBattle
    if I_BattlePlayerArmyIsAttacker
    if I_BattlePlayerArmyNumberOfUnitCategory cavalry > 0
    if I_BattleEnemyArmyNumberOfUnitCategory cavalry = 0
    if I_BattleEnemyArmyNumberOfAttribute stakes > 0
    set_counter battle_stakes 1
    end_if
    end_if
    end_if
    end_if
    end_if
    
    battle_wait 0.1
    
    if I_CompareCounter battle_stakes = 1
        if I_CompareCounter enemy_unit_count > 0
        unit_deploy_stakes a2u1
    end_if
        if I_CompareCounter enemy_unit_count > 1
        unit_deploy_stakes a2u2
    end_if
        if I_CompareCounter enemy_unit_count > 2
        unit_deploy_stakes a2u3
    end_if
        if I_CompareCounter enemy_unit_count > 3
        unit_deploy_stakes a2u4
    end_if
        if I_CompareCounter enemy_unit_count > 4
        unit_deploy_stakes a2u5
    end_if
        if I_CompareCounter enemy_unit_count > 5
        unit_deploy_stakes a2u6
    end_if
        if I_CompareCounter enemy_unit_count > 6
        unit_deploy_stakes a2u7
    end_if
        if I_CompareCounter enemy_unit_count > 7
        unit_deploy_stakes a2u8
    end_if
        if I_CompareCounter enemy_unit_count > 8
        unit_deploy_stakes a2u9
    end_if
        if I_CompareCounter enemy_unit_count > 9
        unit_deploy_stakes a2u10
    end_if
        if I_CompareCounter enemy_unit_count > 10
        unit_deploy_stakes a2u11
    end_if
        if I_CompareCounter enemy_unit_count > 11
        unit_deploy_stakes a2u12
    end_if
        if I_CompareCounter enemy_unit_count > 12
        unit_deploy_stakes a2u13
    end_if
        if I_CompareCounter enemy_unit_count > 13
        unit_deploy_stakes a2u14
    end_if
        if I_CompareCounter enemy_unit_count > 14
        unit_deploy_stakes a2u15
    end_if
        if I_CompareCounter enemy_unit_count > 15
        unit_deploy_stakes a2u16
    end_if
        if I_CompareCounter enemy_unit_count > 16
        unit_deploy_stakes a2u17
    end_if
        if I_CompareCounter enemy_unit_count > 17
        unit_deploy_stakes a2u18
    end_if
        if I_CompareCounter enemy_unit_count > 18
        unit_deploy_stakes a2u19
    end_if
        if I_CompareCounter enemy_unit_count = 20
        unit_deploy_stakes a2u20
    end_if
    
        battle_wait 0.1
    
    release_unit a2u1
    release_unit a2u2
    release_unit a2u3
    release_unit a2u4
    release_unit a2u5
    release_unit a2u6
    release_unit a2u7
    release_unit a2u8
    release_unit a2u9
    release_unit a2u10
    release_unit a2u11
    release_unit a2u12
    release_unit a2u13
    release_unit a2u14
    release_unit a2u15
    release_unit a2u16
    release_unit a2u17
    release_unit a2u18
    release_unit a2u19
    release_unit a2u20
    end_if
    
    end_script
    By unknown reason upper part about dismissing advisor doesn't work (I copypasted it from G5 as it was made there).

    Here is campaign script part
    Spoiler Alert, click show to read: 

    Code:
    declare_counter player_unit_count
    declare_counter enemy_unit_count
    declare_counter battle_stakes
    
    monitor_event ButtonPressed ButtonPressed prebattle_fight_button
    and I_BattlePlayerArmyIsAttacker
    and I_BattlePlayerArmyNumberOfUnitCategory cavalry > 0
    and I_BattleEnemyArmyNumberOfUnitCategory cavalry = 0
    and I_BattleEnemyArmyNumberOfAttribute stakes > 0
    set_counter battle_stakes 1
    end_monitor
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;battle start;;;;;;;;;;;;;;;;;;;;;
    ;;;Army 1
        set_counter player_unit_count 0
        set_counter enemy_unit_count 0
    monitor_event BattleDeploymentPhaseCommenced I_CompareCounter battle_stakes = 1
        if I_BattlePlayerArmyNumberOfUnits > 0
        label_unit 0 0 0 a1u1
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 1
        label_unit 0 0 1 a1u2
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 2
        label_unit 0 0 2 a1u3
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 3
        label_unit 0 0 3 a1u4
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 4
        label_unit 0 0 4 a1u5
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 5
        label_unit 0 0 5 a1u6
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 6
        label_unit 0 0 6 a1u7
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 7
        label_unit 0 0 7 a1u8
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 8
        label_unit 0 0 8 a1u9
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 9
        label_unit 0 0 9 a1u10
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 10
        label_unit 0 0 10 a1u11
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 11
        label_unit 0 0 11 a1u12
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 12
        label_unit 0 0 12 a1u13
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 13
        label_unit 0 0 13 a1u14
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 14
        label_unit 0 0 14 a1u15
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 15
        label_unit 0 0 15 a1u16
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 16
        label_unit 0 0 16 a1u17
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 17
        label_unit 0 0 17 a1u18
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 18
        label_unit 0 0 18 a1u19
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits = 20
        label_unit 0 0 19 a1u20
        inc_counter player_unit_count 1
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
    
        ;;;Army 2
        
        if I_BattleEnemyArmyNumberOfUnits > 0
        label_unit 1 0 0 a2u1
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 1
        label_unit 1 0 1 a2u2
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 2
        label_unit 1 0 2 a2u3
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 3
        label_unit 1 0 3 a2u4
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 4
        label_unit 1 0 4 a2u5
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 5
        label_unit 1 0 5 a2u6
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 6
        label_unit 1 0 6 a2u7
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 7
        label_unit 1 0 7 a2u8
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 8
        label_unit 1 0 8 a2u9
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 9
        label_unit 1 0 9 a2u10
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 10
        label_unit 1 0 10 a2u11
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 11
        label_unit 1 0 11 a2u12
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 12
        label_unit 1 0 12 a2u13
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 13
        label_unit 1 0 13 a2u14
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 14
        label_unit 1 0 14 a2u15
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 15
        label_unit 1 0 15 a2u16
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 16
        label_unit 1 0 16 a2u17
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 17
        label_unit 1 0 17 a2u18
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 18
        label_unit 1 0 18 a2u19
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits = 20
        label_unit 1 0 19 a2u20
        inc_counter enemy_unit_count 1
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
    end_monitor
    
    monitor_event BattleConflictPhaseCommenced I_CompareCounter battle_stakes = 1
        if I_CompareCounter enemy_unit_count > 0
        unit_deploy_stakes a2u1
    end_if
        if I_CompareCounter enemy_unit_count > 1
        unit_deploy_stakes a2u2
    end_if
        if I_CompareCounter enemy_unit_count > 2
        unit_deploy_stakes a2u3
    end_if
        if I_CompareCounter enemy_unit_count > 3
        unit_deploy_stakes a2u4
    end_if
        if I_CompareCounter enemy_unit_count > 4
        unit_deploy_stakes a2u5
    end_if
        if I_CompareCounter enemy_unit_count > 5
        unit_deploy_stakes a2u6
    end_if
        if I_CompareCounter enemy_unit_count > 6
        unit_deploy_stakes a2u7
    end_if
        if I_CompareCounter enemy_unit_count > 7
        unit_deploy_stakes a2u8
    end_if
        if I_CompareCounter enemy_unit_count > 8
        unit_deploy_stakes a2u9
    end_if
        if I_CompareCounter enemy_unit_count > 9
        unit_deploy_stakes a2u10
    end_if
        if I_CompareCounter enemy_unit_count > 10
        unit_deploy_stakes a2u11
    end_if
        if I_CompareCounter enemy_unit_count > 11
        unit_deploy_stakes a2u12
    end_if
        if I_CompareCounter enemy_unit_count > 12
        unit_deploy_stakes a2u13
    end_if
        if I_CompareCounter enemy_unit_count > 13
        unit_deploy_stakes a2u14
    end_if
        if I_CompareCounter enemy_unit_count > 14
        unit_deploy_stakes a2u15
    end_if
        if I_CompareCounter enemy_unit_count > 15
        unit_deploy_stakes a2u16
    end_if
        if I_CompareCounter enemy_unit_count > 16
        unit_deploy_stakes a2u17
    end_if
        if I_CompareCounter enemy_unit_count > 17
        unit_deploy_stakes a2u18
    end_if
        if I_CompareCounter enemy_unit_count > 18
        unit_deploy_stakes a2u19
    end_if
        if I_CompareCounter enemy_unit_count = 20
        unit_deploy_stakes a2u20
    end_if
    
        battle_wait 0.1
    
    release_unit a2u1
    release_unit a2u2
    release_unit a2u3
    release_unit a2u4
    release_unit a2u5
    release_unit a2u6
    release_unit a2u7
    release_unit a2u8
    release_unit a2u9
    release_unit a2u10
    release_unit a2u11
    release_unit a2u12
    release_unit a2u13
    release_unit a2u14
    release_unit a2u15
    release_unit a2u16
    release_unit a2u17
    release_unit a2u18
    release_unit a2u19
    release_unit a2u20
    end_monitor
    ;;;;;;;;;;;;;;;;;;;;;;battle end;;;;;;;;;;;;;;;;;;
    monitor_event PostBattle I_CompareCounter battle_stakes = 1
    set_counter battle_stakes 0
    set_counter enemy_unit_count 0
    set_counter player_unit_count 0
    end_monitor
    We exclude cases when AI has cavalry units because it not intended to use cavalry right and may damage it with it's own stakes. It's discussable because in some my tests AI successfully avoided my stakes.
    Last edited by bitterhowl; June 19, 2019 at 08:59 PM.

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

  10. #10

    Default Re: How to force AI to deploy stakes

    Quote Originally Posted by bitterhowl View Post
    Here is the part for advisor script in custom battle

    Spoiler Alert, click show to read: 
    Code:
    script
    
    declare_show_me
    dismiss_advice
    select_ui_element advisor_portrait_button
    simulate_mouse_click lclick_up
    select_ui_element dismiss_advice_button
    simulate_mouse_click lclick_up
    
    declare_counter player_unit_count
    declare_counter enemy_unit_count
    declare_counter battle_stakes
    ;;;Army 1
        set_counter player_unit_count 0
        if I_BattlePlayerArmyNumberOfUnits > 0
        label_unit 0 0 0 a1u1
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 1
        label_unit 0 0 1 a1u2
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 2
        label_unit 0 0 2 a1u3
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 3
        label_unit 0 0 3 a1u4
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 4
        label_unit 0 0 4 a1u5
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 5
        label_unit 0 0 5 a1u6
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 6
        label_unit 0 0 6 a1u7
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 7
        label_unit 0 0 7 a1u8
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 8
        label_unit 0 0 8 a1u9
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 9
        label_unit 0 0 9 a1u10
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 10
        label_unit 0 0 10 a1u11
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 11
        label_unit 0 0 11 a1u12
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 12
        label_unit 0 0 12 a1u13
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 13
        label_unit 0 0 13 a1u14
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 14
        label_unit 0 0 14 a1u15
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 15
        label_unit 0 0 15 a1u16
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 16
        label_unit 0 0 16 a1u17
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 17
        label_unit 0 0 17 a1u18
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 18
        label_unit 0 0 18 a1u19
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits = 20
        label_unit 0 0 19 a1u20
        inc_counter player_unit_count 1
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
    
        ;;;Army 2
        set_counter enemy_unit_count 0
        if I_BattleEnemyArmyNumberOfUnits > 0
        label_unit 1 0 0 a2u1
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 1
        label_unit 1 0 1 a2u2
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 2
        label_unit 1 0 2 a2u3
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 3
        label_unit 1 0 3 a2u4
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 4
        label_unit 1 0 4 a2u5
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 5
        label_unit 1 0 5 a2u6
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 6
        label_unit 1 0 6 a2u7
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 7
        label_unit 1 0 7 a2u8
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 8
        label_unit 1 0 8 a2u9
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 9
        label_unit 1 0 9 a2u10
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 10
        label_unit 1 0 10 a2u11
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 11
        label_unit 1 0 11 a2u12
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 12
        label_unit 1 0 12 a2u13
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 13
        label_unit 1 0 13 a2u14
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 14
        label_unit 1 0 14 a2u15
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 15
        label_unit 1 0 15 a2u16
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 16
        label_unit 1 0 16 a2u17
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 17
        label_unit 1 0 17 a2u18
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 18
        label_unit 1 0 18 a2u19
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits = 20
        label_unit 1 0 19 a2u20
        inc_counter enemy_unit_count 1
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
    
    
    if I_InBattle
    if I_BattlePlayerArmyIsAttacker
    if I_BattlePlayerArmyNumberOfUnitCategory cavalry > 0
    if I_BattleEnemyArmyNumberOfUnitCategory cavalry = 0
    if I_BattleEnemyArmyNumberOfAttribute stakes > 0
    set_counter battle_stakes 1
    end_if
    end_if
    end_if
    end_if
    end_if
    
    battle_wait 0.1
    
    if I_CompareCounter battle_stakes = 1
        if I_CompareCounter enemy_unit_count > 0
        unit_deploy_stakes a2u1
    end_if
        if I_CompareCounter enemy_unit_count > 1
        unit_deploy_stakes a2u2
    end_if
        if I_CompareCounter enemy_unit_count > 2
        unit_deploy_stakes a2u3
    end_if
        if I_CompareCounter enemy_unit_count > 3
        unit_deploy_stakes a2u4
    end_if
        if I_CompareCounter enemy_unit_count > 4
        unit_deploy_stakes a2u5
    end_if
        if I_CompareCounter enemy_unit_count > 5
        unit_deploy_stakes a2u6
    end_if
        if I_CompareCounter enemy_unit_count > 6
        unit_deploy_stakes a2u7
    end_if
        if I_CompareCounter enemy_unit_count > 7
        unit_deploy_stakes a2u8
    end_if
        if I_CompareCounter enemy_unit_count > 8
        unit_deploy_stakes a2u9
    end_if
        if I_CompareCounter enemy_unit_count > 9
        unit_deploy_stakes a2u10
    end_if
        if I_CompareCounter enemy_unit_count > 10
        unit_deploy_stakes a2u11
    end_if
        if I_CompareCounter enemy_unit_count > 11
        unit_deploy_stakes a2u12
    end_if
        if I_CompareCounter enemy_unit_count > 12
        unit_deploy_stakes a2u13
    end_if
        if I_CompareCounter enemy_unit_count > 13
        unit_deploy_stakes a2u14
    end_if
        if I_CompareCounter enemy_unit_count > 14
        unit_deploy_stakes a2u15
    end_if
        if I_CompareCounter enemy_unit_count > 15
        unit_deploy_stakes a2u16
    end_if
        if I_CompareCounter enemy_unit_count > 16
        unit_deploy_stakes a2u17
    end_if
        if I_CompareCounter enemy_unit_count > 17
        unit_deploy_stakes a2u18
    end_if
        if I_CompareCounter enemy_unit_count > 18
        unit_deploy_stakes a2u19
    end_if
        if I_CompareCounter enemy_unit_count = 20
        unit_deploy_stakes a2u20
    end_if
    
        battle_wait 0.1
    
    release_unit a2u1
    release_unit a2u2
    release_unit a2u3
    release_unit a2u4
    release_unit a2u5
    release_unit a2u6
    release_unit a2u7
    release_unit a2u8
    release_unit a2u9
    release_unit a2u10
    release_unit a2u11
    release_unit a2u12
    release_unit a2u13
    release_unit a2u14
    release_unit a2u15
    release_unit a2u16
    release_unit a2u17
    release_unit a2u18
    release_unit a2u19
    release_unit a2u20
    end_if
    
    end_script
    By unknown reason upper part about dismissing advisor doesn't work (I copypasted it from G5 as it was made there).

    Here is campaign script part
    Spoiler Alert, click show to read: 

    Code:
    declare_counter player_unit_count
    declare_counter enemy_unit_count
    declare_counter battle_stakes
    
    monitor_event ButtonPressed ButtonPressed prebattle_fight_button
    and I_BattlePlayerArmyIsAttacker
    and I_BattlePlayerArmyNumberOfUnitCategory cavalry > 0
    and I_BattleEnemyArmyNumberOfUnitCategory cavalry = 0
    and I_BattleEnemyArmyNumberOfAttribute stakes > 0
    set_counter battle_stakes 1
    end_monitor
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;battle start;;;;;;;;;;;;;;;;;;;;;
    ;;;Army 1
        set_counter player_unit_count 0
        set_counter enemy_unit_count 0
    monitor_event BattleDeploymentPhaseCommenced I_CompareCounter battle_stakes = 1
        if I_BattlePlayerArmyNumberOfUnits > 0
        label_unit 0 0 0 a1u1
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 1
        label_unit 0 0 1 a1u2
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 2
        label_unit 0 0 2 a1u3
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 3
        label_unit 0 0 3 a1u4
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 4
        label_unit 0 0 4 a1u5
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 5
        label_unit 0 0 5 a1u6
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 6
        label_unit 0 0 6 a1u7
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 7
        label_unit 0 0 7 a1u8
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 8
        label_unit 0 0 8 a1u9
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 9
        label_unit 0 0 9 a1u10
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 10
        label_unit 0 0 10 a1u11
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 11
        label_unit 0 0 11 a1u12
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 12
        label_unit 0 0 12 a1u13
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 13
        label_unit 0 0 13 a1u14
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 14
        label_unit 0 0 14 a1u15
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 15
        label_unit 0 0 15 a1u16
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 16
        label_unit 0 0 16 a1u17
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 17
        label_unit 0 0 17 a1u18
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits > 18
        label_unit 0 0 18 a1u19
        inc_counter player_unit_count 1
        if I_BattlePlayerArmyNumberOfUnits = 20
        label_unit 0 0 19 a1u20
        inc_counter player_unit_count 1
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
    
        ;;;Army 2
        
        if I_BattleEnemyArmyNumberOfUnits > 0
        label_unit 1 0 0 a2u1
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 1
        label_unit 1 0 1 a2u2
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 2
        label_unit 1 0 2 a2u3
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 3
        label_unit 1 0 3 a2u4
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 4
        label_unit 1 0 4 a2u5
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 5
        label_unit 1 0 5 a2u6
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 6
        label_unit 1 0 6 a2u7
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 7
        label_unit 1 0 7 a2u8
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 8
        label_unit 1 0 8 a2u9
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 9
        label_unit 1 0 9 a2u10
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 10
        label_unit 1 0 10 a2u11
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 11
        label_unit 1 0 11 a2u12
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 12
        label_unit 1 0 12 a2u13
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 13
        label_unit 1 0 13 a2u14
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 14
        label_unit 1 0 14 a2u15
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 15
        label_unit 1 0 15 a2u16
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 16
        label_unit 1 0 16 a2u17
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 17
        label_unit 1 0 17 a2u18
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits > 18
        label_unit 1 0 18 a2u19
        inc_counter enemy_unit_count 1
        if I_BattleEnemyArmyNumberOfUnits = 20
        label_unit 1 0 19 a2u20
        inc_counter enemy_unit_count 1
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
        end_if
    end_monitor
    
    monitor_event BattleConflictPhaseCommenced I_CompareCounter battle_stakes = 1
        if I_CompareCounter enemy_unit_count > 0
        unit_deploy_stakes a2u1
    end_if
        if I_CompareCounter enemy_unit_count > 1
        unit_deploy_stakes a2u2
    end_if
        if I_CompareCounter enemy_unit_count > 2
        unit_deploy_stakes a2u3
    end_if
        if I_CompareCounter enemy_unit_count > 3
        unit_deploy_stakes a2u4
    end_if
        if I_CompareCounter enemy_unit_count > 4
        unit_deploy_stakes a2u5
    end_if
        if I_CompareCounter enemy_unit_count > 5
        unit_deploy_stakes a2u6
    end_if
        if I_CompareCounter enemy_unit_count > 6
        unit_deploy_stakes a2u7
    end_if
        if I_CompareCounter enemy_unit_count > 7
        unit_deploy_stakes a2u8
    end_if
        if I_CompareCounter enemy_unit_count > 8
        unit_deploy_stakes a2u9
    end_if
        if I_CompareCounter enemy_unit_count > 9
        unit_deploy_stakes a2u10
    end_if
        if I_CompareCounter enemy_unit_count > 10
        unit_deploy_stakes a2u11
    end_if
        if I_CompareCounter enemy_unit_count > 11
        unit_deploy_stakes a2u12
    end_if
        if I_CompareCounter enemy_unit_count > 12
        unit_deploy_stakes a2u13
    end_if
        if I_CompareCounter enemy_unit_count > 13
        unit_deploy_stakes a2u14
    end_if
        if I_CompareCounter enemy_unit_count > 14
        unit_deploy_stakes a2u15
    end_if
        if I_CompareCounter enemy_unit_count > 15
        unit_deploy_stakes a2u16
    end_if
        if I_CompareCounter enemy_unit_count > 16
        unit_deploy_stakes a2u17
    end_if
        if I_CompareCounter enemy_unit_count > 17
        unit_deploy_stakes a2u18
    end_if
        if I_CompareCounter enemy_unit_count > 18
        unit_deploy_stakes a2u19
    end_if
        if I_CompareCounter enemy_unit_count = 20
        unit_deploy_stakes a2u20
    end_if
    
        battle_wait 0.1
    
    release_unit a2u1
    release_unit a2u2
    release_unit a2u3
    release_unit a2u4
    release_unit a2u5
    release_unit a2u6
    release_unit a2u7
    release_unit a2u8
    release_unit a2u9
    release_unit a2u10
    release_unit a2u11
    release_unit a2u12
    release_unit a2u13
    release_unit a2u14
    release_unit a2u15
    release_unit a2u16
    release_unit a2u17
    release_unit a2u18
    release_unit a2u19
    release_unit a2u20
    end_monitor
    ;;;;;;;;;;;;;;;;;;;;;;battle end;;;;;;;;;;;;;;;;;;
    monitor_event PostBattle I_CompareCounter battle_stakes = 1
    set_counter battle_stakes 0
    set_counter enemy_unit_count 0
    set_counter player_unit_count 0
    end_monitor
    We exclude cases when AI has cavalry units because it not intended to use cavalry right and may damage it with it's own stakes. It's discussable because in some my tests AI successfully avoided my stakes.
    Which file is this in? I want to use it.

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

    Default Re: How to force AI to deploy stakes

    For campaign it's in the campaign_script. For custom battle it's a bit complicated.

    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
  •