Skip to content

Commit

Permalink
* More attempts to fix infantry formations AI
Browse files Browse the repository at this point in the history
  • Loading branch information
khamukkamu committed Mar 16, 2018
1 parent 6e0c534 commit 56bc412
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion ModuleSystem/module_mission_templates_TLD.py
Expand Up @@ -819,7 +819,7 @@
(store_random_in_range, "$formai_rand2", 800, 1501), # JL positive only close range randomness
(store_random_in_range, "$formai_rand1", 0, 501), #JL close hold position to archers for cavalry
(store_random_in_range, "$formai_rand3", AI_charge_distance, 3001), # JL main charge distance randomness
(store_random_in_range, "$formai_rand4", AI_Self_Defence_Distance, 3001), #JL alternative charge range randomness
(store_random_in_range, "$formai_rand4", AI_Self_Defence_Distance, 2201), #JL alternative charge range randomness
(store_random_in_range, "$formai_rand5", -1000, 0), #JL retreat range randomness
(store_random_in_range, "$formai_rand6", 4000, 5001), #JL grand charge distance and firing distance range randomness
(store_random_in_range, "$formai_rand7", 55, 66), #JL random decision comparative number (that partly decides when AI strives to execute a grand charge). A value of 30 = Patrol Mode. A value of 35 = enemy has >40% archers/others
Expand Down
10 changes: 5 additions & 5 deletions ModuleSystem/module_scripts_form.py
Expand Up @@ -489,7 +489,7 @@

(try_begin), ## JL RULES OF DISENGAGEMENT: to Remove AI Infantry Charge Mode when infantry is not in melee any more
(eq, ":num_enemies_supporting_melee", 0), #infantry is currently not in melee
(gt, ":enemy_from_infantry", 2000), #JL Kham - and nearest enemy is further away than 20m
(gt, ":enemy_from_infantry", 1500), #JL Kham - and nearest enemy is further away than 20m - Changed to 15m
(eq, "$inf_charge_ongoing", 1), # flag to see if we have a regular charge ongoing
(assign, "$inf_charge_activated", 0), #then deactivate inf charge mode
(assign, "$inf_charge_ongoing", 0), #and reset switch to open up for future charge orders
Expand Down Expand Up @@ -650,7 +650,7 @@
#(display_message, "@Infantry decides to advance"), #############
(try_begin),
(eq, ":num_enemies_in_melee", 0), #not engaged?
(gt, ":enemy_from_archers", "$formai_rand4"), #changed AI_charge_distance to rand4 (10-30m) JL
(gt, ":enemy_from_archers", "$formai_rand4"), #changed AI_charge_distance to rand4 (10-22m) JL
(lt, ":percent_enemy_cavalry", 100),
(assign, ":distance_to_enemy_troop", ":enemy_nearest_non_cav_troop_distance"),
(copy_position, pos60, Nearest_Non_Cav_Enemy_Troop_Pos),
Expand Down Expand Up @@ -678,7 +678,7 @@
(try_end),

(try_begin), #attack troop if its unit is far off
(gt, ":distance_to_enemy_group", AI_charge_distance),
(gt, ":distance_to_enemy_group", "$formai_rand4"),
(this_or_next|neq, ":enemy_nearest_agent", ":enemy_leader"), #added by JL to ignore leader
(neq,"$cur_casualties","$prev_casualties"), # added by JL to have the AI not ignore the leader (5 secs) if there have been any recent losses
(copy_position, pos0, pos60),
Expand Down Expand Up @@ -758,11 +758,11 @@
#If Infantry is Holding and Nearest Enemy is within Self Defence range, enemy is not leader or troops have fallen then Charge (charge infantry and cavalry).
(try_begin),
(eq, ":infantry_order", mordr_hold), #if Orders are Hold
(le, ":enemy_nearest_troop_distance", AI_charge_distance), #and any enemy is within self defence distance
(le, ":enemy_nearest_troop_distance", "$formai_rand4"), #and any enemy is within self defence distance
(this_or_next|neq, ":enemy_nearest_agent", ":enemy_leader"), #nearest target is not the player
(neq, "$cur_casualties","$prev_casualties2"), #troops have fallen during last second
(assign, "$inf_charge_activated", 1), #then Charge Infantry
(assign, "$charge_activated", 1), #and Charge Cavalry
#(assign, "$charge_activated", 1), #and Charge Cavalry
#(display_message,"@Infantry ordered general charge because enemy is too near and casualties inflicted."), ##############
(try_end),

Expand Down

0 comments on commit 56bc412

Please sign in to comment.