(
"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
(call_script, "script_init_death_cam"),
# (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),
(call_script, "script_cf_dplmc_battle_continuation"),
(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
common_battle_order_panel,
common_battle_order_panel_tick,
( 0, 2, ti_once, [],
[
(get_player_agent_no, ":player_agent"),
(agent_get_team, ":agent_team", ":player_agent"),
(team_give_order, ":agent_team", grc_everyone, mordr_hold), ])
]
##diplomacy begin
+ dplmc_battle_mode_triggers + dplmc_horse_cull, #SB : horse cull
##diplomacy end
# (ti_on_agent_spawn, 0, 0,
# [
# (ge, "$g_ally_party", 0), # if player has joined already started battle
# (eq, "$attacker_reinforcement_stage", 0), # and there hasn't been any reinforcements yet
# (eq, "$defender_reinforcement_stage", 0),
# ],
# [
# (store_trigger_param_1, ":agent"),
# (assign, ":agent_to_move", -1),
# (try_begin),
# (agent_is_human, ":agent"),
# (agent_get_party_id, ":a_party", ":agent"),
# (neq, ":a_party", "p_main_party"),
# (assign, ":agent_to_move", ":agent"),
# (else_try),
# (neg|agent_is_human, ":agent"),
# (agent_get_rider, ":rider", ":agent"),
# (agent_get_party_id, ":r_party", ":rider"),
# (neq, ":r_party", "p_main_party"),
# (assign, ":agent_to_move", ":agent"),
# (try_end),
# (neq, ":agent_to_move", -1),
# (get_scene_boundaries, pos10, pos11),
# (set_fixed_point_multiplier, 100),
# (position_get_x, "$g_scene_max_x", pos11),
# (position_get_y, "$g_scene_max_y", pos11),
# (val_add, "$g_scene_max_x", 2400), # 2400 has been subtracted automatically because of barriers from outer terrain
# (val_add, "$g_scene_max_y", 2400),
# (store_div, ":pos_x", "$g_scene_max_x", 2),
# (store_div, ":pos_y", "$g_scene_max_x", 2),
# (init_position, pos22), # map center
# (store_random_in_range, ":x_shift", -1000, 1000),
# (store_random_in_range, ":y_shift", -1000, 1000),
# (val_add, ":pos_x", ":x_shift"),
# (val_add, ":pos_y", ":y_shift"),
# (position_set_x, pos22, ":pos_x"),
# (position_set_y, pos22, ":pos_y"),
# (agent_set_position, ":agent_to_move", pos22),
# ]),
),