Change the number of reinforcement waves.

Users who are viewing this thread

I've searched the forum but could not find anything about this except for TML txt Tweaks.
What I want to do is to change the numbers of reinforcement waves each side gets during a battle.

The same thing as the TML tweaks but I want to know how to do it in the module.
Here is a link to the tweak if anyone is uncertain:


I know that it's in mission templates but I don't really know where.
In the TML tweak I should look for this:
2147483678 2 144115188075856126 (number)
But in the module I have no idea.

This is for the field-battles but I'm not sure what to change.

Code:
"lead_charge",mtf_battle_mode,charge,
    "You lead your men to battle.",
    [
     (1,mtef_defenders|mtef_team_0,0,aif_start_alarmed,12,[]),
     (0,mtef_defenders|mtef_team_0,0,aif_start_alarmed,0,[]),
     (4,mtef_attackers|mtef_team_1,0,aif_start_alarmed,12,[]),
     (4,mtef_attackers|mtef_team_1,0,aif_start_alarmed,0,[]),
     ],
    [
      (ti_on_agent_spawn, 0, 0, [],
       [
         (store_trigger_param_1, ":agent_no"),
         (call_script, "script_agent_reassign_team", ":agent_no"),
         ]),

      common_battle_tab_press,

      (ti_question_answered, 0, 0, [],
       [(store_trigger_param_1,":answer"),
        (eq,":answer",0),
        (assign, "$pin_player_fallen", 0),
        (try_begin),
          (store_mission_timer_a, ":elapsed_time"),
          (gt, ":elapsed_time", 20),
          (str_store_string, s5, "str_retreat"),
          (call_script, "script_simulate_retreat", 10, 20),
        (try_end),
        (call_script, "script_count_mission_casualties_from_agents"),
        (finish_mission,0),]),

      (ti_before_mission_start, 0, 0, [],
       [
         (team_set_relation, 0, 2, 1),
         (team_set_relation, 1, 3, 1),
         (call_script, "script_place_player_banner_near_inventory_bms"),
         ]),

      
      (0, 0, ti_once, [], [(assign,"$battle_won",0),
                           (assign,"$defender_reinforcement_stage",0),
                           (assign,"$attacker_reinforcement_stage",0),
                           (assign,"$g_presentation_battle_active", 0),
                           (call_script, "script_place_player_banner_near_inventory"),
                           (call_script, "script_combat_music_set_situation_with_culture"),
                           ]),

      common_music_situation_update,
      common_battle_check_friendly_kills,

      (1, 0, 5, [(lt,"$defender_reinforcement_stage",2),
                 (store_mission_timer_a,":mission_time"),
                 (ge,":mission_time",10),
                 (store_normalized_team_count,":num_defenders", 0),
                 (lt,":num_defenders",6),
#                 (assign, reg2, ":num_defenders"),
#                 (display_message,"@num_defenders = {reg2}")
                 ],
           [(add_reinforcements_to_entry,0,7),(val_add,"$defender_reinforcement_stage",1)]),
      
      (1, 0, 5, [(lt,"$attacker_reinforcement_stage",2),
                 (store_mission_timer_a,":mission_time"),
                 (ge,":mission_time",10),
                 (store_normalized_team_count,":num_attackers", 1),
                 (lt,":num_attackers",6),
#                 (assign, reg2, ":num_attackers"),
#                 (display_message,"@num_attackers = {reg2}")
                 ],
           [(add_reinforcements_to_entry,3,7),(val_add,"$attacker_reinforcement_stage",1)]),
      
      common_battle_check_victory_condition,
      common_battle_victory_display,

      (1, 4, ti_once, [(main_hero_fallen)],
          [
              (assign, "$pin_player_fallen", 1),
              (str_store_string, s5, "str_retreat"),
              (call_script, "script_simulate_retreat", 10, 20),
              (assign, "$g_battle_result", -1),
              (set_mission_result,-1),
              (call_script, "script_count_mission_casualties_from_agents"),
              (finish_mission,0)]),

      common_battle_inventory,


      #AI Tiggers
      (0, 0, ti_once, [
          (store_mission_timer_a,":mission_time"),(ge,":mission_time",2),
          ],
       [(call_script, "script_select_battle_tactic"),
        (call_script, "script_battle_tactic_init")]),
      
      (5, 0, 0, [
          (store_mission_timer_a,":mission_time"),(ge,":mission_time",3),
          (call_script, "script_battle_tactic_apply"),
          ], []),

      common_battle_order_panel,
      common_battle_order_panel_tick,

    ],
  ),

So if anyone knows what I should change please chare.
 
NaglFaar said:
The magic (if you can call it that), is in the trigger code.  Two of the triggers try to determine if they should send in a new wave of reinforcements, and usually start with stuff like this in the condition block:
  (lt,"$defender_reinforcement_stage",2),

or:
  (lt,"$attacker_reinforcement_stage",2),

The 2 in these cases is the magic number.  You can also mess with other aspects of when it sends in reinforcements and whatnot.
 
"lead_charge",mtf_battle_mode,charge,
    "You lead your men to battle.",
    [
    (1,mtef_defenders|mtef_team_0,0,aif_start_alarmed,12,[]),
    (0,mtef_defenders|mtef_team_0,0,aif_start_alarmed,0,[]),
    (4,mtef_attackers|mtef_team_1,0,aif_start_alarmed,12,[]),
    (4,mtef_attackers|mtef_team_1,0,aif_start_alarmed,0,[]),
    ],
    [
      (ti_on_agent_spawn, 0, 0, [],
      [
        (store_trigger_param_1, ":agent_no"),
        (call_script, "script_agent_reassign_team", ":agent_no"),
        ]),

      common_battle_tab_press,

      (ti_question_answered, 0, 0, [],
      [(store_trigger_param_1,":answer"),
        (eq,":answer",0),
        (assign, "$pin_player_fallen", 0),
        (try_begin),
          (store_mission_timer_a, ":elapsed_time"),
          (gt, ":elapsed_time", 20),
          (str_store_string, s5, "str_retreat"),
          (call_script, "script_simulate_retreat", 10, 20),
        (try_end),
        (call_script, "script_count_mission_casualties_from_agents"),
        (finish_mission,0),]),

      (ti_before_mission_start, 0, 0, [],
      [
        (team_set_relation, 0, 2, 1),
        (team_set_relation, 1, 3, 1),
        (call_script, "script_place_player_banner_near_inventory_bms"),
        ]),

     
      (0, 0, ti_once, [], [(assign,"$battle_won",0),
                          (assign,"$defender_reinforcement_stage",0),
                          (assign,"$attacker_reinforcement_stage",0),
                          (assign,"$g_presentation_battle_active", 0),
                          (call_script, "script_place_player_banner_near_inventory"),
                          (call_script, "script_combat_music_set_situation_with_culture"),
                          ]),

      common_music_situation_update,
      common_battle_check_friendly_kills,

      (1, 0, 5, [(lt,"$defender_reinforcement_stage",2),
                (store_mission_timer_a,":mission_time"),
                (ge,":mission_time",10),
                (store_normalized_team_count,":num_defenders", 0),
                (lt,":num_defenders",6),
#                (assign, reg2, ":num_defenders"),
#                (display_message,"@num_defenders = {reg2}")
                ],
          [(add_reinforcements_to_entry,0,7),(val_add,"$defender_reinforcement_stage",1)]),
     
      (1, 0, 5, [(lt,"$attacker_reinforcement_stage",2),
                (store_mission_timer_a,":mission_time"),
                (ge,":mission_time",10),
                (store_normalized_team_count,":num_attackers", 1),
                (lt,":num_attackers",6),
#                (assign, reg2, ":num_attackers"),
#                (display_message,"@num_attackers = {reg2}")
                ],
          [(add_reinforcements_to_entry,3,7),(val_add,"$attacker_reinforcement_stage",1)]),
     
      common_battle_check_victory_condition,
      common_battle_victory_display,

      (1, 4, ti_once, [(main_hero_fallen)],
          [
              (assign, "$pin_player_fallen", 1),
              (str_store_string, s5, "str_retreat"),
              (call_script, "script_simulate_retreat", 10, 20),
              (assign, "$g_battle_result", -1),
              (set_mission_result,-1),
              (call_script, "script_count_mission_casualties_from_agents"),
              (finish_mission,0)]),

      common_battle_inventory,


      #AI Tiggers
      (0, 0, ti_once, [
          (store_mission_timer_a,":mission_time"),(ge,":mission_time",2),
          ],
      [(call_script, "script_select_battle_tactic"),
        (call_script, "script_battle_tactic_init")]),
     
      (5, 0, 0, [
          (store_mission_timer_a,":mission_time"),(ge,":mission_time",3),
          (call_script, "script_battle_tactic_apply"),
          ], []),

      common_battle_order_panel,
      common_battle_order_panel_tick,

    ],
  ),

So if I change the nubers marked in red I'll finally be able to fight the whole battle without interruption?
Is this "universal"? I mean, does it work for sieges and other stuff too?

I'll try it out.
 
NaglFaar said:
"lead_charge",mtf_battle_mode,charge,
    "You lead your men to battle.",
    [
    (1,mtef_defenders|mtef_team_0,0,aif_start_alarmed,12,[]),
    (0,mtef_defenders|mtef_team_0,0,aif_start_alarmed,0,[]),
    (4,mtef_attackers|mtef_team_1,0,aif_start_alarmed,12,[]),
    (4,mtef_attackers|mtef_team_1,0,aif_start_alarmed,0,[]),
    ],
    [
      (ti_on_agent_spawn, 0, 0, [],
      [
        (store_trigger_param_1, ":agent_no"),
        (call_script, "script_agent_reassign_team", ":agent_no"),
        ]),

      common_battle_tab_press,

      (ti_question_answered, 0, 0, [],
      [(store_trigger_param_1,":answer"),
        (eq,":answer",0),
        (assign, "$pin_player_fallen", 0),
        (try_begin),
          (store_mission_timer_a, ":elapsed_time"),
          (gt, ":elapsed_time", 20),
          (str_store_string, s5, "str_retreat"),
          (call_script, "script_simulate_retreat", 10, 20),
        (try_end),
        (call_script, "script_count_mission_casualties_from_agents"),
        (finish_mission,0),]),

      (ti_before_mission_start, 0, 0, [],
      [
        (team_set_relation, 0, 2, 1),
        (team_set_relation, 1, 3, 1),
        (call_script, "script_place_player_banner_near_inventory_bms"),
        ]),

     
      (0, 0, ti_once, [], [(assign,"$battle_won",0),
                          (assign,"$defender_reinforcement_stage",0),
                          (assign,"$attacker_reinforcement_stage",0),
                          (assign,"$g_presentation_battle_active", 0),
                          (call_script, "script_place_player_banner_near_inventory"),
                          (call_script, "script_combat_music_set_situation_with_culture"),
                          ]),

      common_music_situation_update,
      common_battle_check_friendly_kills,

      (1, 0, 5, [(lt,"$defender_reinforcement_stage",2),
                (store_mission_timer_a,":mission_time"),
                (ge,":mission_time",10),
                (store_normalized_team_count,":num_defenders", 0),
                (lt,":num_defenders",6),
#                (assign, reg2, ":num_defenders"),
#                (display_message,"@num_defenders = {reg2}")
                ],
          [(add_reinforcements_to_entry,0,7),(val_add,"$defender_reinforcement_stage",1)]),
     
      (1, 0, 5, [(lt,"$attacker_reinforcement_stage",2),
                (store_mission_timer_a,":mission_time"),
                (ge,":mission_time",10),
                (store_normalized_team_count,":num_attackers", 1),
                (lt,":num_attackers",6),
#                (assign, reg2, ":num_attackers"),
#                (display_message,"@num_attackers = {reg2}")
                ],
          [(add_reinforcements_to_entry,3,7),(val_add,"$attacker_reinforcement_stage",1)]),
     
      common_battle_check_victory_condition,
      common_battle_victory_display,

      (1, 4, ti_once, [(main_hero_fallen)],
          [
              (assign, "$pin_player_fallen", 1),
              (str_store_string, s5, "str_retreat"),
              (call_script, "script_simulate_retreat", 10, 20),
              (assign, "$g_battle_result", -1),
              (set_mission_result,-1),
              (call_script, "script_count_mission_casualties_from_agents"),
              (finish_mission,0)]),

      common_battle_inventory,


      #AI Tiggers
      (0, 0, ti_once, [
          (store_mission_timer_a,":mission_time"),(ge,":mission_time",2),
          ],
      [(call_script, "script_select_battle_tactic"),
        (call_script, "script_battle_tactic_init")]),
     
      (5, 0, 0, [
          (store_mission_timer_a,":mission_time"),(ge,":mission_time",3),
          (call_script, "script_battle_tactic_apply"),
          ], []),

      common_battle_order_panel,
      common_battle_order_panel_tick,

    ],
  ),

So if I change the nubers marked in red I'll finally be able to fight the whole battle without interruption?
Is this "universal"? I mean, does it work for sieges and other stuff too?

I'll try it out.

IIRC, Sieges have half a dozen reinforcement stages or so... So I think that's coded elsewhere?
 
Yeah, I saw that now.
But anyway. If I did this with the siege I would never get to fight inside the castle or the town, right?
And I want to fight on the streets. I've just increased the numbers of fighters on the streets/ castle to 50.
It would all be undone if there were no more men to fight.
 
I found the numbers for field battles and village raids but couldn't find it for sieges :razz: I reckon I missed something here.
edit: Bleh! Nvm, found it.
 
NaglFaar said:
Yeah, I saw that now.
But anyway. If I did this with the siege I would never get to fight inside the castle or the town, right?
And I want to fight on the streets. I've just increased the numbers of fighters on the streets/ castle to 50.
It would all be undone if there were no more men to fight.
That's more or less correct.  If you want to ensure that there's street fights, you'd have to do something more complicated than just bumping the number of waves.
 
kt0 said:
NaglFaar said:
Yeah, I saw that now.
But anyway. If I did this with the siege I would never get to fight inside the castle or the town, right?
And I want to fight on the streets. I've just increased the numbers of fighters on the streets/ castle to 50.
It would all be undone if there were no more men to fight.
That's more or less correct.  If you want to ensure that there's street fights, you'd have to do something more complicated than just bumping the number of waves.

Shouldn't it be decreasing the number of waves? So that there's still some defenders left to fight after the attack on the walls? I'm looking to see if reinforcement waves can be implemented into street fights as well.
 
Adding reinforcements to the street fights would probably be as simple as adding
(1, 0, 5, [(lt,"$defender_reinforcement_stage",2),
                (store_mission_timer_a,":mission_time"),
                (ge,":mission_time",10),
                (store_normalized_team_count,":num_defenders", 0),
                (lt,":num_defenders",6),
#                (assign, reg2, ":num_defenders"),
#                (display_message,"@num_defenders = {reg2}")
                ],
          [(add_reinforcements_to_entry,0,7),(val_add,"$defender_reinforcement_stage",1)]),
     
      (1, 0, 5, [(lt,"$attacker_reinforcement_stage",2),
                (store_mission_timer_a,":mission_time"),
                (ge,":mission_time",10),
                (store_normalized_team_count,":num_attackers", 1),
                (lt,":num_attackers",6),
#                (assign, reg2, ":num_attackers"),
#                (display_message,"@num_attackers = {reg2}")
                ],
          [(add_reinforcements_to_entry,3,7),(val_add,"$attacker_reinforcement_stage",1)]),
to the fighting in the streets template.  Seems like it should go right before the main_hero_fallen part.  I wonder why they didn't simply define reinforcements as a trigger at the top like most of the other triggers.  More reinforcement waves was one of the things I liked about the 268 AD mod. 
 
Thanks, BP. I'm gonna try that out. My idea is to make the battle at the wall slightly shorter (so that the whole garrison won't be wiped out on the walls alone as they usually do with large battlesizes), then make street fights last a lot longer with skirmishes between small groups that keep pouring in.
 
That sounds awesome.  Your idea kind of reminds me of the end of Troy.  This is a bit off topic but one thing I would love to see is your party being forced to defend the streets if you had to retreat from the walls.  But that is a different idea for a different day.
 
OK cool.  I already changed the number of reinforcements in field battles for my mod.  I might do the same as amade and try to get reinforcements working for the street battle as well.  But amade let me know if the reinforcements in the street battle was as simple as I hoped it was.  The retreating into the town thing will probably take a bit of coding, but I am sure that it is very doable.  I'll look into reverse engineering the mission_template that makes you attack their town's streets.
 
Berserker Pride said:
OK cool.  I already changed the number of reinforcements in field battles for my mod.  I might do the same as amade and try to get reinforcements working for the street battle as well.  But amade let me know if the reinforcements in the street battle was as simple as I hoped it was.  The retreating into the town thing will probably take a bit of coding, but I am sure that it is very doable.  I'll look into reverse engineering the mission_template that makes you attack their town's streets.

Haven't tried it yet, busy modeling/texturing instead :razz:

I think the main problem is that it's rare to lose a siege defense on the walls and still have any troops left to defend the streets. Most players don't put more than 200 or so troops in their town garrison, while any worthwhile siege campaign would involve several lords with 500-1000 men. More likely than not the whole garrison will die on the walls. Of course, if you're going against 10 to 1 odds, you'd only spawn with a handful of soldiers on the walls so after you've lost about 20 men x 5 reinforcements you'd still have some left over in the streets though it'd still be against very heavy odds.

There's some fine balancing that needs to be arrived at, adjusting how much troops the AI will maintain in its garrison and encouraging the player to match those numbers, and taking into account of battlesizes. Then there's the problem of would the AI attack players with large garrisons? Town siege defense are pretty rare as it is.
 
Yea it can be difficult getting the ai to actually attack a town sometimes.  I'm tempted to up the aggressiveness of all parties in my mod.  That way towns and castles will get attacked much more often.  After a while certain garrisons will get weaker.  Native parties seem to like to pick on the weak only; so if I make them more aggressive, they'll attack more than just that one castle with 50 men. 

To make street battles happen I would make it so that even a retreat on your part would lead to a battle in the streets.  This might have its own problems too, but it is an option I'm going to look at.
 
Berserker Pride said:
Yea it can be difficult getting the ai to actually attack a town sometimes.  I'm tempted to up the aggressiveness of all parties in my mod.  That way towns and castles will get attacked much more often.  After a while certain garrisons will get weaker.  Native parties seem to like to pick on the weak only; so if I make them more aggressive, they'll attack more than just that one castle with 50 men. 
I don't think this will do what you want.  You'll need to work through the strategic and siege AI for what you're describing. 
 
if you want to keep the number of men piling in (no stop in the battle still you run or someone wins), I would drop this code and make your own that checks every second or so to see how many many you have left.  If you are below 15, then add 10 more reinforcements.  Or what ever numbers you want to use.  I think the key line is this one I marked in red
      (1, 0, 5, [(lt,"$attacker_reinforcement_stage",2),
                (store_mission_timer_a,":mission_time"),
                (ge,":mission_time",10),
                (store_normalized_team_count,":num_attackers", 1),
                (lt,":num_attackers",6),
#                (assign, reg2, ":num_attackers"),
#                (display_message,"@num_attackers = {reg2}")
                ],
          [(add_reinforcements_to_entry,3,7),(val_add,"$attacker_reinforcement_stage",1)]),

You really only need that line.  You can make it more dynamic by, say, adding 1/10th your remaining troops at a time, or what ever.  I don't know if this will override the tactical bonus stuff though.
 
kt0 said:
Berserker Pride said:
Yea it can be difficult getting the ai to actually attack a town sometimes.  I'm tempted to up the aggressiveness of all parties in my mod.  That way towns and castles will get attacked much more often.  After a while certain garrisons will get weaker.  Native parties seem to like to pick on the weak only; so if I make them more aggressive, they'll attack more than just that one castle with 50 men. 
I don't think this will do what you want.  You'll need to work through the strategic and siege AI for what you're describing. 
I haven't increased aggresiveness yet buy I did increase the average size of a lord party to about 150-175.  Now if the kings gets 5-6 of them together they have a definite chance to sack some towns.  They will probably go for the castles first but thats ok.  There are only so many castles.  It always bugged me in native that the kingdoms couldn't carry on a proper war to save their life.

Kto do you think I should edit the strength needed to siege calculation?  Would that have the right effect?  If I could I'd change their ai entirely so they would attack the closest target not the weakest.  That might take a lot of digging around in the code though.  Decide_faction_ai looks promising.
  I'll post the code I think is responsible for the strength needed to siege.
(try_begin),#Attacking center
        (neq, ":eek:ld_faction_ai_state", sfai_default),
        (gt, ":faction_marshall_party", 0),
        (assign, ":eek:ld_target_attacking_center", -1),
        (try_begin),
          (eq, ":eek:ld_faction_ai_state", sfai_attacking_center),
          (assign, ":eek:ld_target_attacking_center", ":eek:ld_faction_ai_object"),
        (try_end),
        (assign, ":best_besiege_center", -1),
        (assign, ":best_besiege_center_score", 0),
        (try_for_range, ":enemy_walled_center", walled_centers_begin, walled_centers_end),
          (party_get_slot, ":besieger_party", ":enemy_walled_center", slot_center_is_besieged_by),
          (assign, ":besieger_own_faction", 0),
          (try_begin),
            (ge, ":besieger_party", 0),
            (party_is_active, ":besieger_party"),
            (store_faction_of_party, ":besieger_faction", ":besieger_party"),
            (eq, ":besieger_faction", ":faction_no"),
            (assign, ":besieger_own_faction", 1),
          (try_end),
          (this_or_next|eq, ":besieger_party", -1),
          (eq, ":besieger_own_faction", 1),
          (call_script, "script_get_center_faction_relation_including_player", ":enemy_walled_center", ":faction_no"),
          (assign, ":reln", reg0),
          (lt, ":reln", 0),
          (val_mul, ":reln", -1),
          (val_add, ":reln", 50),
          (store_distance_to_party_from_party, ":dist", ":enemy_walled_center", ":faction_marshall_party"),
          (val_add, ":dist", 20),
          (party_get_slot, ":center_str", ":enemy_walled_center", slot_party_cached_strength),
          (party_get_slot, ":center_near_str", ":enemy_walled_center", slot_party_nearby_friend_strength),
          (val_add, ":center_str", ":center_near_str"),
          (val_add, ":center_str", 1),
          (store_mul, ":center_score", 1000, ":faction_marshall_army_strength"),
          (val_div, ":center_score", ":center_str"),
          (gt, ":center_score", 1500),
          (val_min, ":center_score", 20000),#20 times stronger means an easy victory, distance is more important
          (try_begin),
            (party_slot_eq, ":enemy_walled_center", slot_town_lord, "trp_player"),
            (call_script, "script_troop_get_player_relation", ":faction_marshall"),
            (assign, ":player_relation", reg0),
            #(troop_get_slot, ":player_relation", ":faction_marshall", slot_troop_player_relation),
            (lt, ":player_relation", 0),
            (store_sub, ":multiplier", 50, ":player_relation"),
            (val_mul, ":center_score", ":multiplier"),
            (val_div, ":center_score", 50),
          (try_end),
          (try_begin),
            (party_slot_eq, ":enemy_walled_center", slot_center_original_faction, ":faction_no"),
            (val_mul, ":center_score", 2),
          (try_end),
          (try_begin),
            (party_slot_eq, ":enemy_walled_center", slot_center_ex_faction, ":faction_no"),
            (val_mul, ":center_score", 2),
          (try_end),
          (val_mul, ":center_score", ":reln"),
          (val_div, ":center_score", ":dist"),

          (try_begin),
            (eq, ":enemy_walled_center", ":eek:ld_target_attacking_center"),
            (val_mul, ":center_score", 100),
          (try_end),
          (try_begin),
            (gt, ":center_score", ":best_besiege_center_score"),
            (assign, ":best_besiege_center_score", ":center_score"),
            (assign, ":best_besiege_center", ":enemy_walled_center"),
          (try_end),
        (try_end),
     
        (ge, ":best_besiege_center", 0),
        #Center with equal strength at 30 kms away will have a center_score of 1300 (with -40 reln)
        (store_div, ":chance_attacking_center", ":best_besiege_center_score", 15),
        (val_min, ":chance_attacking_center", 1000),
        (assign, ":target_attacking_center", ":best_besiege_center"),
        (try_begin),
          (eq, ":eek:ld_target_attacking_center", ":target_attacking_center"),
          (val_mul, ":chance_attacking_center", 100),
        (try_end),
     
        (val_mul, ":chance_attacking_center", ":eek:ffensive_rating"),
        (val_div, ":chance_attacking_center", 100),
      (try_end),
Ok I put a little glow on the effect of distance on the enemy's choice of target.  I wonder if I would hamstring the ai if I were to multiply :dist by 2 before it divided :center score.
 
Yep, this is what I was getting at.  There are also some simple triggers that manage the sieging process (more below).  It turns out that Native is predisposed to guys standing around for a really long time.  This added with lords' ADD and most sieges never get to actual fights.  The first is easily fixable through timers.

Berserker Pride said:
I haven't increased aggresiveness yet buy I did increase the average size of a lord party to about 150-175.  Now if the kings gets 5-6 of them together they have a definite chance to sack some towns.  They will probably go for the castles first but thats ok.  There are only so many castles.  It always bugged me in native that the kingdoms couldn't carry on a proper war to save their life.

Kto do you thing I should edit the strength needed to siege calculation?  Would that have the right effect?  If I could I'd chance their ai entirely so they would attack the closest target not the weakest.  That might take a lot of digging around in the code though.  Decide_faction_ai looks promising.
  I'll post the code I think is responsible for the strength needed to siege.
(try_begin),#Attacking center
        (neq, ":eek:ld_faction_ai_state", sfai_default),
        (gt, ":faction_marshall_party", 0),
        (assign, ":eek:ld_target_attacking_center", -1),
        (try_begin),
          (eq, ":eek:ld_faction_ai_state", sfai_attacking_center),
          (assign, ":eek:ld_target_attacking_center", ":eek:ld_faction_ai_object"),
        (try_end),
        (assign, ":best_besiege_center", -1),
        (assign, ":best_besiege_center_score", 0),
        (try_for_range, ":enemy_walled_center", walled_centers_begin, walled_centers_end),
          (party_get_slot, ":besieger_party", ":enemy_walled_center", slot_center_is_besieged_by),
          (assign, ":besieger_own_faction", 0),
          (try_begin),
            (ge, ":besieger_party", 0),
            (party_is_active, ":besieger_party"),
            (store_faction_of_party, ":besieger_faction", ":besieger_party"),
            (eq, ":besieger_faction", ":faction_no"),
            (assign, ":besieger_own_faction", 1),
          (try_end),
          (this_or_next|eq, ":besieger_party", -1),
          (eq, ":besieger_own_faction", 1),
          (call_script, "script_get_center_faction_relation_including_player", ":enemy_walled_center", ":faction_no"),
          (assign, ":reln", reg0),
          (lt, ":reln", 0),
          (val_mul, ":reln", -1),
          (val_add, ":reln", 50),
          (store_distance_to_party_from_party, ":dist", ":enemy_walled_center", ":faction_marshall_party"),
          (val_add, ":dist", 20),
          (party_get_slot, ":center_str", ":enemy_walled_center", slot_party_cached_strength),
          (party_get_slot, ":center_near_str", ":enemy_walled_center", slot_party_nearby_friend_strength),
          (val_add, ":center_str", ":center_near_str"),
          (val_add, ":center_str", 1),
          (store_mul, ":center_score", 1000, ":faction_marshall_army_strength"),
          (val_div, ":center_score", ":center_str"),
          (gt, ":center_score", 1500),
          (val_min, ":center_score", 20000),#20 times stronger means an easy victory, distance is more important
          (try_begin),
            (party_slot_eq, ":enemy_walled_center", slot_town_lord, "trp_player"),
            (call_script, "script_troop_get_player_relation", ":faction_marshall"),
            (assign, ":player_relation", reg0),
            #(troop_get_slot, ":player_relation", ":faction_marshall", slot_troop_player_relation),
            (lt, ":player_relation", 0),
            (store_sub, ":multiplier", 50, ":player_relation"),
            (val_mul, ":center_score", ":multiplier"),
            (val_div, ":center_score", 50),
          (try_end),
          (try_begin),
            (party_slot_eq, ":enemy_walled_center", slot_center_original_faction, ":faction_no"),
            (val_mul, ":center_score", 2),
          (try_end),
          (try_begin),
            (party_slot_eq, ":enemy_walled_center", slot_center_ex_faction, ":faction_no"),
            (val_mul, ":center_score", 2),
          (try_end),
          (val_mul, ":center_score", ":reln"),
          (val_div, ":center_score", ":dist"),

          (try_begin),
            (eq, ":enemy_walled_center", ":eek:ld_target_attacking_center"),
            (val_mul, ":center_score", 100),
          (try_end),
          (try_begin),
            (gt, ":center_score", ":best_besiege_center_score"),
            (assign, ":best_besiege_center_score", ":center_score"),
            (assign, ":best_besiege_center", ":enemy_walled_center"),
          (try_end),
        (try_end),
     
        (ge, ":best_besiege_center", 0),
        #Center with equal strength at 30 kms away will have a center_score of 1300 (with -40 reln)
        (store_div, ":chance_attacking_center", ":best_besiege_center_score", 15),
        (val_min, ":chance_attacking_center", 1000),
        (assign, ":target_attacking_center", ":best_besiege_center"),
        (try_begin),
          (eq, ":eek:ld_target_attacking_center", ":target_attacking_center"),
          (val_mul, ":chance_attacking_center", 100),
        (try_end),
     
        (val_mul, ":chance_attacking_center", ":eek:ffensive_rating"),
        (val_div, ":chance_attacking_center", 100),
      (try_end),
Ok I put a little glow on the effect of distance on the enemy's choice of target.  I wonder if I would hamstring the ai if I were to multiply :dist by 2 before it divided :center score.

The fun thing I learned while hacking up the AI for Conquest is that you can change two or three numbers in Native triggers and end up with a lot more centers changing hands.  These are values like "how long do I wait until I can attack a center I'm sieging" and "how often do I update siege parameters" among other things.  I can't be more specific because I don't have the code in front of me, but the biggest bangs are in the triggers handling siege updates. 

You can change the strength needed in the siege calc if you like but you'll have to make a reciprocal change in the simple trigger so they don't get stuck after their "how long do I wait" timer is over (assuming they stay put long enough).  The bad case is if they show up, run down the timer, then get cold feet (i.e., convince themselves that they don't have enough to take the center) at which point they just hang out waiting for...well...nothing because the center hardness doesn't appear to be hooked up.  If all you want is guys to attack centers more often, you can either increase their army sizes or decrease the sizes of center garrisons.  Be forewarned, however, since the other edge of that sword is that the strategic AI is strongly influenced by garrison sizes and troop strengths. 

Doubling the effective distance is problematic because it's not only calculating "which center should I take" but also the probability of taking any castle.  My advice is to pick through the methods at hand and see what numbers are moving through.  From there you can make the appropriate changes.  The game simulation is very interdependent sometimes in very unexpected ways but it sounds like you're on the right track.
 
Ha I just figured out what you meant.  The process_sieges script will reduce the apparent strength(aka ":siege_hardness") every time it is called by the trigger.  So setting that trigger to fire more quickly will mean that troops will attack a castle much more quickly than before.  Or I could make siege hardness reduce by more as well.  I also don't see any negative consequences to making the trigger fire more often.  Well except that food will decrease more quickly as well.  But I can edit the script to account for that.  Thanks for your help Kto I think this was what I was looking for.  EDIT: I'll set the trigger to fire every 8 hours and reduce siege hardness by 50 instead of 20.  That coupled with increased party sizes should make attacks much more frequent.
 
Back
Top Bottom