Troops AI

Users who are viewing this thread

Has_an

Squire
Where in moudule system i can edit AI of infantry, ranged and cavalry, when they hold position?
I need edit behaviour of infantry.
When is ranged troops hold line they fireing everybody, but in infantry class fireing only anybody.
 
You can "make new AI" in mission templates. To determine that are they holding positon or not, use this.
Code:
(team_get_movement_order, ":infantry_orders", "$defender_team", grc_infantry),
(team_get_movement_order, ":archer_orders", "$defender_team", grc_archers),
(try_begin),
   (eq, ":infantry_orders", mordr_hold),
   DoStuffHere
(try_end),

For a list of subclasses, look into header_mission_templates.py. And to get the defender and attacker team, put this in your mission templates.
Code:
#0 being mtef_team_0 and 1 being mtef_team_1
(0, 0, ti_once, [],
   [(assign, "$defender_team", 0),
    (assign, "$attacker_team, 1)],
),

You can do some pretty cool stuff with this. Untested, but should give the basic idea.
Code:
#CdVader - Move Archers and Infantry from the very start
#of the mission without you giving orders, so archers
#can actually fire without problems.

(team_give_order, "$defender_team", grc_everyone, mordr_hold),
(agent_get_entry_no, ":entry_no", 45), #45 has mtef_archers_first flag.
(agent_get_troop_id, ":troop_id", ":entry_no"),
(try_begin),
   (agent_get_team, ":agent_team", "troop_id"),
   (eq, ":agent_team", "$defender_team"), #Is he on your side or not.
   (team_get_movement_order, ":infantry_order", "$defender_team", grc_infantry),
   (team_get_movement_order, ":archer_order", "$defender_team", grc_archers),
   (agent_get_position, pos1, ":troop_id"),
   (val_sub, pos1, 200), #pos1 = -200.
   (position_set_z, pos2, pos1), #Move pos2 to the value of pos1 by the Z axis.
   (team_give_order, "$defender_team", grc_infantry, mordr_hold),
   (team_give_order_position, "$defender_team", grc_infantry, pos2),
(try_end),

 
Back
Top Bottom