SCRIPT WARNING: DIVISION BY ZERO

Users who are viewing this thread

Ok. I Was Making my Mod. I Implemented motomataru's Battlefield Tactics Kit Into My Module System And Compiled It

When I Am Into a Battle. It Shows Up a Repeating Error Every 5 Seconds

SCRIPT WARNING : Division by zero; LINE NO 20
At Mission Template mst_lead_charge trigger no: 30 conditions
At Mission Template mst_lead_charge trigger no: 30 conditions
At Mission Template mst_lead_charge trigger no: 30 conditions
SCRIPT WARNING : Division by zero; LINE NO 19
At Mission Template mst_lead_charge trigger no: 28 conditions
At Mission Template mst_lead_charge trigger no: 28 conditions
At Mission Template mst_lead_charge trigger no: 28 conditions

Any Solution to This Problem? I Would be Appreciated. Thanks!
 
Solution
Python:
(try_begin),
       (val_div,":ratio",":cavalry"),
       (try_begin),
         (gt,":ratio",2),
         (lt,":cavalry",10),
         (team_give_order, reg0, grc_everyone, mordr_dismount),
       (else_try),
         (team_give_order, reg0, grc_everyone, mordr_mount),
       (end_try),], []),

Here can be found a missing try_end.
That part is wrong because of the two statements i said above. It isn't missing try_end, it has an excessive try_begin.
(try_begin,),
(neq,":cavalry",0),
(val_div,":ratio",":cavalry"),
(try_end),
(try_begin),
(val_div,":ratio",":cavalry"),

(try_begin),
(gt,":ratio",2),
(lt,":cavalry",10),
(team_give_order, reg0...
Ok. I Was Making my Mod. I Implemented motomataru's Battlefield Tactics Kit Into My Module System And Compiled It

When I Am Into a Battle. It Shows Up a Repeating Error Every 5 Seconds

SCRIPT WARNING : Division by zero; LINE NO 20
At Mission Template mst_lead_charge trigger no: 30 conditions
At Mission Template mst_lead_charge trigger no: 30 conditions
At Mission Template mst_lead_charge trigger no: 30 conditions
SCRIPT WARNING : Division by zero; LINE NO 19
At Mission Template mst_lead_charge trigger no: 28 conditions
At Mission Template mst_lead_charge trigger no: 28 conditions
At Mission Template mst_lead_charge trigger no: 28 conditions

Any Solution to This Problem? I Would be Appreciated. Thanks!
It says trigger no 28 and 30. There are two triggers with a trigger between that may cause this in the source code. Both uses same division.
(assign,":ratio",":infantry"),
(val_div,":ratio",":cavalry"),
(try_begin),
You can place a zero check before these divisions at those two places.
(assign,":ratio",":infantry"),
(try_begin),
(neq,":cavalry",0),
(val_div,":ratio",":cavalry"),

(try_end),
(try_begin),
It should make the errors dissappear but may cause some other unexpected issues :smile:
 
Last edited:
Upvote 0
It says trigger no 28 and 30. There are two triggers with a trigger between that may cause this in the source code. Both uses same division.

You can place a zero check before these divisions at those two places.

It should make the errors dissappear but may cause some other unexpected issues :smile:
Copied the Code But it Gave me an Error While i Compile the Module Using W.R.E.C.K

Possibly its a Tuple Error
 
Upvote 0
Also. I When Compiling. I Received An Error

The following errors were generated during compilation:
try/end operations do not match in mt.lead_charge(#9).repeat_trigger(5.0).condition: 1 try_end(s) missing

Do The Mod Still Run After I Compile It? or Do I Have to Fix It?
 
Upvote 0
Can you post the screenshots of the code? Hard to tell without seeing the whole trigger.
 
Upvote 0
Not screenshots, but the code itself put in the proper format.
Code:
  (
    "lead_charge",mtf_battle_mode|mtf_synch_inventory,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"),

         (assign, ":initial_courage_score", 5000),
                  
         (agent_get_troop_id, ":troop_id", ":agent_no"),
         (store_character_level, ":troop_level", ":troop_id"),
         (val_mul, ":troop_level", 35),
         (val_add, ":initial_courage_score", ":troop_level"), #average : 20 * 35 = 700
        
         (store_random_in_range, ":randomized_addition_courage", 0, 3000), #average : 1500
         (val_add, ":initial_courage_score", ":randomized_addition_courage"),
                  
         (agent_get_party_id, ":agent_party", ":agent_no"),         
         (party_get_morale, ":cur_morale", ":agent_party"),
        
         (store_sub, ":morale_effect_on_courage", ":cur_morale", 70),
         (val_mul, ":morale_effect_on_courage", 30), #this can effect morale with -2100..900
         (val_add, ":initial_courage_score", ":morale_effect_on_courage"),
        
         #average = 5000 + 700 + 1500 = 7200; min : 5700, max : 8700
         #morale effect = min : -2100(party morale is 0), average : 0(party morale is 70), max : 900(party morale is 100)
         #min starting : 3600, max starting  : 9600, average starting : 7200
         (agent_set_slot, ":agent_no", slot_agent_courage_score, ":initial_courage_score"),
         ]),

      common_battle_init_banner,
        
      (ti_on_agent_killed_or_wounded, 0, 0, [],
       [
        (store_trigger_param_1, ":dead_agent_no"),
        (store_trigger_param_2, ":killer_agent_no"),
        (store_trigger_param_3, ":is_wounded"),

        (try_begin),
          (ge, ":dead_agent_no", 0),
          (neg|agent_is_ally, ":dead_agent_no"),
          (agent_is_human, ":dead_agent_no"),
          (agent_get_troop_id, ":dead_agent_troop_id", ":dead_agent_no"),
##          (str_store_troop_name, s6, ":dead_agent_troop_id"),
##          (assign, reg0, ":dead_agent_no"),
##          (assign, reg1, ":killer_agent_no"),
##          (assign, reg2, ":is_wounded"),
##          (agent_get_team, reg3, ":dead_agent_no"),         
          #(display_message, "@{!}dead agent no : {reg0} ; killer agent no : {reg1} ; is_wounded : {reg2} ; dead agent team : {reg3} ; {s6} is added"),
          (party_add_members, "p_total_enemy_casualties", ":dead_agent_troop_id", 1), #addition_to_p_total_enemy_casualties
          (eq, ":is_wounded", 1),
          (party_wound_members, "p_total_enemy_casualties", ":dead_agent_troop_id", 1),
        (try_end),

        (call_script, "script_apply_death_effect_on_courage_scores", ":dead_agent_no", ":killer_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, 1),
        (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"),

         (party_clear, "p_routed_enemies"),

         (assign, "$g_latest_order_1", 1),
         (assign, "$g_latest_order_2", 1),
         (assign, "$g_latest_order_3", 1),
         (assign, "$g_latest_order_4", 1),
         ]),

      
      (0, 0, ti_once, [], [(assign,"$g_battle_won",0),
                           (assign,"$defender_reinforcement_stage",0),
                           (assign,"$attacker_reinforcement_stage",0),
                           (call_script, "script_place_player_banner_near_inventory"),
                           (call_script, "script_combat_music_set_situation_with_culture"),
                           (assign, "$g_defender_reinforcement_limit", 2),
                           ##diplomacy begin
                           (assign, "$g_dplmc_cam_activated", 0),
                           (assign, "$g_dplmc_charge_when_dead", 0),
                           ##diplomacy end
                           ]),

      common_music_situation_update,
      common_battle_check_friendly_kills,

      (1, 0, 5, [
                              
      #new (25.11.09) starts (sdsd = TODO : make a similar code to also helping ally encounters)
      #count all total (not dead) enemy soldiers (in battle area + not currently placed in battle area)
      (call_script, "script_party_count_members_with_full_health", "p_collective_enemy"),
      (assign, ":total_enemy_soldiers", reg0),
      
      #decrease number of agents already in battle area to find all number of reinforcement enemies
      (assign, ":enemy_soldiers_in_battle_area", 0),
      (try_for_agents,":cur_agent"),
        (agent_is_human, ":cur_agent"),
        (agent_get_party_id, ":agent_party", ":cur_agent"),
        (try_begin),
          (neq, ":agent_party", "p_main_party"),
          (neg|agent_is_ally, ":cur_agent"),
          (val_add, ":enemy_soldiers_in_battle_area", 1),
        (try_end),
      (try_end),
      (store_sub, ":total_enemy_reinforcements", ":total_enemy_soldiers", ":enemy_soldiers_in_battle_area"),

      (try_begin),
        (lt, ":total_enemy_reinforcements", 15),
        (ge, "$defender_reinforcement_stage", 2),
        (eq, "$defender_reinforcement_limit_increased", 0),
        (val_add, "$g_defender_reinforcement_limit", 1),                   
        (assign, "$defender_reinforcement_limit_increased", 1),
      (try_end),   
      #new (25.11.09) ends
      
      
      
      
      
      
      (lt,"$defender_reinforcement_stage","$g_defender_reinforcement_limit"),
                 (store_mission_timer_a,":mission_time"),
                 (ge,":mission_time",10),
                 (store_normalized_team_count,":num_defenders", 0),
                 (lt,":num_defenders",6)],
           [(add_reinforcements_to_entry,0,7),(assign, "$defender_reinforcement_limit_increased", 0),(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)],
           [(add_reinforcements_to_entry,3,7),(val_add,"$attacker_reinforcement_stage",1)]),

      common_battle_check_victory_condition,
      common_battle_victory_display,

      (1, 4,
      ##diplomacy begin
      0,
      ##diplomacy end
      [(main_hero_fallen)],
          [
              ##diplomacy begin
              (try_begin),
                (eq, "$g_dplmc_battle_continuation", 0),
                (assign, ":num_allies", 0),
                (try_for_agents, ":agent"),
                 (agent_is_ally, ":agent"),
                 (agent_is_alive, ":agent"),
                 (val_add, ":num_allies", 1),
                (try_end),
                (gt, ":num_allies", 0),
                (try_begin),
                  (eq, "$g_dplmc_cam_activated", 0),
                  #(store_mission_timer_a, "$g_dplmc_main_hero_fallen_seconds"),
                  (assign, "$g_dplmc_cam_activated", 1),
                  (display_message, "@You have been knocked out by the enemy. Watch your men continue the fight without you or press Tab to retreat."),
                  (display_message, "@To watch the fight you can use 'w, a, s, d, numpad_+/numpad_-' to move and 'numpad_1,2,3,4,6,8' to rotate the cam."),
                (try_end),
              (else_try),
              ##diplomacy end
              (assign, "$pin_player_fallen", 1),
              (str_store_string, s5, "str_retreat"),
              (call_script, "script_simulate_retreat", 10, 20, 1),
              (assign, "$g_battle_result", -1),
              (set_mission_result,-1),
              (call_script, "script_count_mission_casualties_from_agents"),
              (finish_mission,0),
              ##diplomacy begin
              (try_end),
              ##diplomacy end
            ]),

      common_battle_inventory,


      #AI Triggers
      (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"),
        #(call_script, "script_battle_calculate_initial_powers"), #deciding run away method changed and that line is erased
        ]),
      
      (3, 0, 0, [
          (call_script, "script_apply_effect_of_other_people_on_courage_scores"),
              ], []), #calculating and applying effect of people on others courage scores

      (3, 0, 0, [
          (try_for_agents, ":agent_no"),
            (agent_is_human, ":agent_no"),
            (agent_is_alive, ":agent_no"),         
            (store_mission_timer_a,":mission_time"),
            (ge,":mission_time",3),         
            (call_script, "script_decide_run_away_or_not", ":agent_no", ":mission_time"),
          (try_end),         
              ], []), #controlling courage score and if needed deciding to run away for each agent

      (5, 0, 0, [
          (store_mission_timer_a,":mission_time"),

          (ge,":mission_time",3),
          
          (call_script, "script_battle_tactic_apply"),
          ], []), #applying battle tactic

########Tactical triggers below##########

(ti_before_mission_start, 0, 0, [],
   [(assign,"$rout",0),
    (assign,"$airout",0),
    (assign,"$formation",0),
    (assign,"$infantryformationtype",0),
    (assign,"$archerformationtype",0),
    (assign,"$cavalryformationtype",0),]),


     (0, 0, 0,
      [(key_clicked, key_2),       
       (assign,"$formation",grc_infantry),
        ], []),
     (0, 0, 0,
      [(key_clicked, key_3),       
       (assign,"$formation",grc_archers),
        ], []),
     (0, 0, 0,
      [(key_clicked, key_4),       
       (assign,"$formation",grc_cavalry),
        ], []),


     (0, 0, 0,
      [(key_clicked, key_j),       
       (get_player_agent_no,":player"),
       (agent_get_team  ,reg0, ":player"),
       (assign,reg1,"$formation"),
       (call_script,"script_cf_formation"),
       (try_begin),
          (eq,"$formation",grc_infantry),
          (assign,"$infantryformationtype",1),
       (else_try),
          (eq,"$formation",grc_archers),
          (assign,"$archerformationtype",1),
       (else_try),
          (eq,"$formation",grc_cavalry),
          (assign,"$cavalryformationtype",1),
       (end_try),
       (display_message,"@Forming_ranks."),
        ], []),

     (0, 0, 0,
      [(key_clicked, key_p),       
       (get_player_agent_no,":player"),
       (agent_get_team  ,reg0, ":player"),
       (assign,reg1,"$formation"),
       (call_script,"script_cf_formation_stagger"),
       (call_script,"script_cf_formation"),
       (try_begin),
          (eq,"$formation",grc_infantry),
          (assign,"$infantryformationtype",3),
       (else_try),
          (eq,"$formation",grc_archers),
          (assign,"$archerformationtype",3),
       (else_try),
          (eq,"$formation",grc_cavalry),
          (assign,"$cavalryformationtype",3),
       (end_try),
       (display_message,"@Forming_a_line."),
        ], []),

     (0, 0, 0,
      [(key_clicked, key_k),       
       (get_player_agent_no,":player"),
       (agent_get_team  ,reg0, ":player"),
       (assign,reg1,"$formation"),
       (call_script,"script_cf_formation_wedge"),
       (call_script,"script_cf_formation"),
       (try_begin),
          (eq,"$formation",grc_infantry),
          (assign,"$infantryformationtype",2),
       (else_try),
          (eq,"$formation",grc_archers),
          (assign,"$archerformationtype",2),
       (else_try),
          (eq,"$formation",grc_cavalry),
          (assign,"$cavalryformationtype",2),
       (end_try),
       (display_message,"@Forming_a_wedge."),
        ], []),

     (0, 0, 0,
      [(key_clicked, key_u),       
       (get_player_agent_no,":player"),
       (agent_get_team  ,reg0, ":player"),
       (assign,reg1,"$formation"),
       (call_script,"script_formation_end"),
       (call_script,"script_cf_formation"),
       (try_begin),
          (eq,"$formation",grc_infantry),
          (assign,"$infantryformationtype",0),
       (else_try),
          (eq,"$formation",grc_archers),
          (assign,"$archerformationtype",0),
       (else_try),
          (eq,"$formation",grc_cavalry),
          (assign,"$cavalryformationtype",0),
       (end_try),
       (display_message,"@Formation_disassembled."),
        ], []),

     (5.0, 0, 0,
      [(try_for_agents,":agent"),
         (agent_is_human,":agent"),
         (neg|agent_is_ally,":agent"),
         (assign,":enemy",":agent"),
       (end_try),
       (gt,":enemy",-1),
       (eq,"$airout",0),
       (agent_get_team  ,reg0, ":enemy"),
       (assign,reg1,grc_cavalry),
       (call_script,"script_formation_end"),
       (assign,reg1,grc_infantry),
       (call_script,"script_formation_end"),
       (assign,reg1,grc_archers),
       (call_script,"script_formation_end"),], []),

     (5.0, 0, 0,
      [(assign,":enemy",-1),
       (assign,":infantry",0),
       (assign,":cavalry",0),
       (try_for_agents,":agent"),
         (agent_is_human,":agent"),
         (agent_is_alive,":agent"),
         (neg|agent_is_ally,":agent"),
         (assign,":enemy",":agent"),
         (agent_get_class ,":class", ":agent"),
         (try_begin),
            (eq,":class",grc_cavalry),
            (val_add,":cavalry",1),
         (else_try),
            (val_add,":infantry",1),
         (end_try),
       (end_try),
       (gt,":enemy",-1),
       (agent_get_team  ,reg0, ":enemy"),
       (assign,":ratio",":infantry"),
        (try_begin,),
        (neq,":cavalry",0),
        (val_div,":ratio",":cavalry"),
        (try_end),
       (try_begin),
       (val_div,":ratio",":cavalry"),
       (try_begin),
         (gt,":ratio",2),
         (lt,":cavalry",10),
         (team_give_order, reg0, grc_everyone, mordr_dismount),
       (else_try),
         (team_give_order, reg0, grc_everyone, mordr_mount),
       (end_try),], []),


     (5.0, 0, 0,
      [(eq,"$rout",0),
       (get_player_agent_no,":player"),
       (agent_get_team  ,reg0, ":player"),
       (val_add,reg0,2),
       (assign,reg1,grc_cavalry),
       (call_script,"script_formation_end"),
       (assign,reg1,grc_infantry),
       (call_script,"script_formation_end"),
       (assign,reg1,grc_archers),
       (call_script,"script_formation_end"),], []),

     (5.0, 0, 0,
      [(neq, "$battle_won", 1),
       (assign,":infantry",0),
       (assign,":cavalry",0),
       (get_player_agent_no,":player"),
       (agent_get_team  ,reg0, ":player"),
       (val_add,reg0,2),
       (try_for_agents,":agent"),
         (agent_is_human,":agent"),
         (agent_is_alive,":agent"),
         (agent_get_team  ,":team", ":agent"),
         (eq,":team",reg0),
         (agent_get_class ,":class", ":agent"),
         (try_begin),
            (eq,":class",grc_cavalry),
            (val_add,":cavalry",1),
         (else_try),
            (val_add,":infantry",1),
         (end_try),
       (end_try),
       (assign,":ratio",":infantry"),
       (try_begin),
        (neq,":cavalry",0),
       (val_div,":ratio",":cavalry",),
       (try_end),
       (try_begin),
         (gt,":ratio",2),
         (lt,":cavalry",10),
         (team_give_order, reg0, grc_everyone, mordr_dismount),
       (else_try),
         (team_give_order, reg0, grc_everyone, mordr_mount),
       (end_try),], []),

     (0.2, 0, 0,
      [(eq,"$rout",0),
       (get_player_agent_no,":player"),
       (agent_get_team  ,reg0, ":player"),
       (assign,reg1,grc_infantry),
       (try_begin),
          (eq,"$infantryformationtype",1),
          (call_script,"script_cf_formation"),
       (else_try),
          (eq,"$infantryformationtype",2),
          (call_script,"script_cf_formation_wedge"),
       (else_try),
          (eq,"$infantryformationtype",3),
          (call_script,"script_cf_formation_stagger"),
       (else_try),
          (call_script,"script_formation_end"),
       (end_try),], []),

     (0.2, 0, 0,
      [(eq,"$rout",0),
       (get_player_agent_no,":player"),
       (agent_get_team  ,reg0, ":player"),
       (assign,reg1,grc_archers),
       (try_begin),
          (eq,"$archerformationtype",1),
          (call_script,"script_cf_formation"),
       (else_try),
          (eq,"$archerformationtype",2),
          (call_script,"script_cf_formation_wedge"),
       (else_try),
          (eq,"$archerformationtype",3),
          (call_script,"script_cf_formation_stagger"),
       (else_try),
          (call_script,"script_formation_end"),
       (end_try),], []),

     (0.2, 0, 0,
      [(eq,"$rout",0),
       (get_player_agent_no,":player"),
       (agent_get_team  ,reg0, ":player"),
       (assign,reg1,grc_cavalry),
       (try_begin),
          (eq,"$cavalryformationtype",1),
          (call_script,"script_cf_formation"),
       (else_try),
          (eq,"$cavalryformationtype",2),
          (call_script,"script_cf_formation_wedge"),
       (else_try),
          (eq,"$cavalryformationtype",3),
          (call_script,"script_cf_formation_stagger"),
       (else_try),
          (call_script,"script_formation_end"),
       (end_try),], []),

     (0.2, 0, 0,
      [(eq,"$airout",0),
       (try_for_agents,":agent"),
         (agent_is_human,":agent"),
         (neg|agent_is_ally,":agent"),
         (assign,":enemy",":agent"),
       (end_try),
       (gt,":enemy",-1),
       (agent_get_team  ,reg0, ":enemy"),
       (store_normalized_team_count,":num", reg0), 
       (gt,":num",5),
       (assign,reg1,grc_infantry),
       (call_script,"script_cf_formation"),
        ], []),

     (0.2, 0, 0,
      [(eq,"$airout",0),
       (try_for_agents,":agent"),
         (agent_is_human,":agent"),
         (neg|agent_is_ally,":agent"),
         (assign,":enemy",":agent"),
       (end_try),
       (gt,":enemy",-1),
       (agent_get_team  ,reg0, ":enemy"),
       (store_normalized_team_count,":num", reg0), 
       (gt,":num",5),
       (assign,reg1,grc_archers),
       (call_script,"script_cf_formation_stagger"),
        ], []),

     (0.2, 0, 0,
      [(eq,"$airout",0),
       (try_for_agents,":agent"),
         (agent_is_human,":agent"),
         (neg|agent_is_ally,":agent"),
         (assign,":enemy",":agent"),
       (end_try),
       (gt,":enemy",-1),
       (agent_get_team  ,reg0, ":enemy"),
       (store_normalized_team_count,":num", reg0), 
       (gt,":num",5),
       (assign,reg1,grc_cavalry),
       (call_script,"script_cf_formation_wedge"),
        ], []),

     (0.2, 0, 0,
      [(eq,"$rout",0),
       (neq, "$battle_won", 1),
       (eq,"$rout",0),
       (get_player_agent_no,":player"),
       (agent_get_team  ,reg0, ":player"),
       (val_add,reg0,2),
       (store_normalized_team_count,":num", reg0), 
       (gt,":num",5),
       (assign,reg1,grc_infantry),
       (call_script,"script_cf_formation"),
        ], []),

     (0.2, 0, 0,
      [(eq,"$rout",0),
       (neq, "$battle_won", 1),
       (eq,"$rout",0),
       (get_player_agent_no,":player"),
       (agent_get_team  ,reg0, ":player"),
       (val_add,reg0,2),
       (store_normalized_team_count,":num", reg0), 
       (gt,":num",5),
       (assign,reg1,grc_archers),
       (call_script,"script_cf_formation_stagger"),
        ], []),

     (0.2, 0, 0,
      [(eq,"$rout",0),
       (neq, "$battle_won", 1),
       (eq,"$rout",0),
       (get_player_agent_no,":player"),
       (agent_get_team  ,reg0, ":player"),
       (val_add,reg0,2),
       (store_normalized_team_count,":num", reg0), 
       (gt,":num",5),
       (assign,reg1,grc_cavalry),
       (call_script,"script_cf_formation_wedge"),
        ], []),




     (1, 0, ti_once, [], [
        (get_player_agent_kill_count,"$base_kills",0),
        (assign,"$new_kills_a",0),
        (assign,"$new_kills",0),
         ]),

     (3, 0, 3, [], [
        (get_player_agent_kill_count,":more_kills",0),
        (val_sub,":more_kills","$base_kills"),
        (try_begin),
            (gt,":more_kills","$new_kills_a"),
            (assign,"$new_kills_a",":more_kills"),
            (assign,"$new_kills",":more_kills"),
            (val_div,"$new_kills",2),
            (assign,reg1,":more_kills"),
            (display_message,"@You have killed {reg1} enemies in this battle!",0x6495ed),         
            (display_message,"@Your bravery inspires your troops!",0x6495ed),
        (try_end),
         ]),


        
     (0, 0, 2, [(key_clicked, key_t)], [
(call_script, "script_coherence"),   
(call_script, "script_healthbars"),       
         ]),

     (0, 0, ti_once, [(key_clicked, key_y)], [
#(play_sound,"snd_battle_cry_n"),
(display_message,"@You rally your men!",0x7ccd7c),
(call_script, "script_battle_cry"),
(call_script, "script_hero_exp_penalty"),       
         ]),
     (10, 0, 20, [ ], [
(call_script, "script_rally"),       
         ]),
     (0, 10, 100, [(key_clicked, key_v),(display_message,"@You call for reinforcements!",0x6495ed) ], [
(display_message,"@Reinforcements arrive!",0x6495ed),
(add_reinforcements_to_entry,0,7),
(add_reinforcements_to_entry,3,7),
(call_script, "script_hero_exp_penalty"),       
         ]),     

      

(1, 0, ti_once, [ ], [
(call_script, "script_coherence"),   
         ]),                       


      
(15, 0, 10, [ ], [
(call_script, "script_coherence"),   
(call_script, "script_morale_check"),   
         ]),
(5, 0, 3, [ ], [
(call_script, "script_coherence"),   
(call_script, "script_rout_check"),       
         ]),



##########Tactical triggers above#########

      common_battle_order_panel,
      common_battle_order_panel_tick,
      

    ]
    ##diplomacy begin
    + dplmc_battle_mode_triggers,
    ##diplomacy end
  ),

This is the Entire Lead_Charge Code. Taken from module_mission_templates.py
 
Upvote 0
Code:
(try_begin,),
        (neq,":cavalry",0),
        (val_div,":ratio",":cavalry"),
        (try_end),
       (try_begin),
       (val_div,":ratio",":cavalry"),
this part seems to be the issue. last two statements are excessive.
 
Upvote 0
Python:
(try_begin),
       (val_div,":ratio",":cavalry"),
       (try_begin),
         (gt,":ratio",2),
         (lt,":cavalry",10),
         (team_give_order, reg0, grc_everyone, mordr_dismount),
       (else_try),
         (team_give_order, reg0, grc_everyone, mordr_mount),
       (end_try),], []),

Here can be found a missing try_end.
 
Upvote 0
Python:
(try_begin),
       (val_div,":ratio",":cavalry"),
       (try_begin),
         (gt,":ratio",2),
         (lt,":cavalry",10),
         (team_give_order, reg0, grc_everyone, mordr_dismount),
       (else_try),
         (team_give_order, reg0, grc_everyone, mordr_mount),
       (end_try),], []),

Here can be found a missing try_end.
That part is wrong because of the two statements i said above. It isn't missing try_end, it has an excessive try_begin.
(try_begin,),
(neq,":cavalry",0),
(val_div,":ratio",":cavalry"),
(try_end),
(try_begin),
(val_div,":ratio",":cavalry"),

(try_begin),
(gt,":ratio",2),
(lt,":cavalry",10),
(team_give_order, reg0, grc_everyone, mordr_dismount),
(else_try),
(team_give_order, reg0, grc_everyone, mordr_mount),
(end_try),], []),
 
Upvote 1
Solution
Yes, I know. Having looked at it once again, I see that one thing is completely redundant (in this case, the operation being a conditional block opening). It was flagged by the compiler's logic as a missing try_end, but the answer was somewhere else.
 
Upvote 0
Back
Top Bottom