[Native 1.174] Very easy request. How to force enemy AI to always charge immediately?

Users who are viewing this thread

In Native, there are 3 AI tactics, chosen at random:

1) Charge at you the moment the battle starts.
2) Form a line and slowly advance, allowing the player to park his/her forces in the corner of the map, ride up behind the passive enemy army and shoot all their elite units in the back, managing to kill 40-50 before they finally engage. Then retreat with 0 losses and do it again.
3) Simply stand still forever.

In my experience, 2) is the tactic the AI most often uses, and even when it doesn't, you can just restart the battle until it does. This makes the game incredibly boring as the aforementioned trick is the most viable thing to do every time. So the question is: how do I force the AI to always charge immediately in every battle? Any useful information helps, like where to start looking in the module system.
 
Last edited:
Okay, I've looked through the scripts and pretty sure I've found the one responsible. I have only tested this briefly, but it seems to work perfectly. Replace the battle_tactic_apply_aux piece of code with this:

("battle_tactic_apply_aux",
[
(store_script_param, ":team_no", 1),
(store_script_param, ":battle_tactic", 2),
(assign, ":battle_tactic", 0),
(team_give_order, ":team_no", grc_everyone, mordr_charge),
(assign, reg0, ":battle_tactic"),
]),
 
I think your code will apply to any team, not just enemy team (is that what you wanted?)
To make it apply only to enemy team you gotta check which team is it:
Python:
(try_begin),
    (get_player_agent_no,":player"),
    (agent_get_team,":player_team"),
    (teams_are_enemies,":player_team",":team_no"),
    #your code
(else_try),
    #code for ally teams and player team
(try_end)
 
Last edited:
Back
Top Bottom