Things we can do about Custom Battle :
- If you are like me that use custom battles as combat training place, or may be you are a modder that use custom battles to test strength balance of your own making troops, you must want an option to restart custom battles, instead of redesign them over and over again.
Here is the code :
Code:( "custom_battle_end",mnf_disable_all_keys, "The battle is over. {s1} Your side killed {reg5} enemies and lost {reg6} troops over the battle. You personally slew {reg7} men in the fighting.", "none", [(music_set_situation, 0), (assign, reg5, "$g_custom_battle_team2_death_count"), (assign, reg6, "$g_custom_battle_team1_death_count"), (get_player_agent_kill_count, ":kill_count"), (get_player_agent_kill_count, ":wound_count", 1), ## Dunde's Restart Custom Battle BEGIN ##(store_add, reg7, ":kill_count", ":wound_count"), # Reseting Player Kill on Report (store_add, reg9, ":kill_count", ":wound_count"), (store_sub, reg7, reg9, reg8), (assign, reg8, reg9), ## Dunde's Restart Custom Battle END (try_begin), (eq, "$g_battle_result", 1), (str_store_string, s1, "str_battle_won"), (else_try), (str_store_string, s1, "str_battle_lost"), (try_end), (try_begin), (ge, "$g_custom_battle_team2_death_count", 100), (unlock_achievement, ACHIEVEMENT_LOOK_AT_THE_BONES), (try_end), ], [ ("continue",[],"Continue.", [(change_screen_quit), ] ), ## Dunde's Restart Custom Battle BEGIN ("restart",[],"Restart.", [ #Restoring Custom Battle Design (assign, "$g_is_quick_battle", 1), (assign, ":cur_scene", "$g_quick_battle_map"), (try_begin), (eq, "$g_quick_battle_game_type", 0), #battle (assign, ":cur_mission_template", "mt_quick_battle_battle"), (modify_visitors_at_site, ":cur_scene"), (call_script, "script_spawn_quick_battle_army", 0, "$g_quick_battle_team_1_faction", "$g_presentation_obj_custom_battle_designer_6_last_value", "$g_presentation_obj_custom_battle_designer_7_last_value", "$g_presentation_obj_custom_battle_designer_8_last_value", 0, 1), (call_script, "script_spawn_quick_battle_army", 16, "$g_quick_battle_team_2_faction", "$g_presentation_obj_custom_battle_designer_9_last_value", "$g_presentation_obj_custom_battle_designer_10_last_value", "$g_presentation_obj_custom_battle_designer_11_last_value", 0, 0), (else_try), (eq, "$g_quick_battle_game_type", 1), #siege offense (assign, ":cur_mission_template", "mt_quick_battle_siege"), (modify_visitors_at_site, ":cur_scene"), (call_script, "script_spawn_quick_battle_army", 16, "$g_quick_battle_team_1_faction", "$g_presentation_obj_custom_battle_designer_6_last_value", "$g_presentation_obj_custom_battle_designer_7_last_value", "$g_presentation_obj_custom_battle_designer_8_last_value", 0, 1), (call_script, "script_spawn_quick_battle_army", 0, "$g_quick_battle_team_2_faction", "$g_presentation_obj_custom_battle_designer_9_last_value", "$g_presentation_obj_custom_battle_designer_10_last_value", "$g_presentation_obj_custom_battle_designer_11_last_value", 1, 0), (else_try), #siege defense (assign, ":cur_mission_template", "mt_quick_battle_siege"), (modify_visitors_at_site, ":cur_scene"), (call_script, "script_spawn_quick_battle_army", 0, "$g_quick_battle_team_1_faction", "$g_presentation_obj_custom_battle_designer_6_last_value", "$g_presentation_obj_custom_battle_designer_7_last_value", "$g_presentation_obj_custom_battle_designer_8_last_value", 1, 1), (call_script, "script_spawn_quick_battle_army", 16, "$g_quick_battle_team_2_faction", "$g_presentation_obj_custom_battle_designer_9_last_value", "$g_presentation_obj_custom_battle_designer_10_last_value", "$g_presentation_obj_custom_battle_designer_11_last_value", 0, 0), (try_end), # Reset Battle Result (assign, "$g_battle_result", 0), (assign, "$g_battle_won", 0), (set_jump_mission,":cur_mission_template"), (jump_to_menu, "mnu_custom_battle_end"), (jump_to_scene, ":cur_scene"), (change_screen_mission), ] ), ## Dunde's Restart Custom Battle END ] ),
Code:(call_script, "script_spawn_quick_battle_army", 16, "$g_quick_battle_team_1_faction", "$g_presentation_obj_custom_battle_designer_6_last_value", "$g_presentation_obj_custom_battle_designer_7_last_value", "$g_presentation_obj_custom_battle_designer_8_last_value", 0, 1), (call_script, "script_spawn_quick_battle_army", 0, "$g_quick_battle_team_2_faction", "$g_presentation_obj_custom_battle_designer_9_last_value", "$g_presentation_obj_custom_battle_designer_10_last_value", "$g_presentation_obj_custom_battle_designer_11_last_value", 1, 0), (else_try), #siege defense (assign, ":cur_mission_template", "mt_quick_battle_siege"), (modify_visitors_at_site, ":cur_scene"), (call_script, "script_spawn_quick_battle_army", 0, "$g_quick_battle_team_1_faction", "$g_presentation_obj_custom_battle_designer_6_last_value", "$g_presentation_obj_custom_battle_designer_7_last_value", "$g_presentation_obj_custom_battle_designer_8_last_value", 1, 1), (call_script, "script_spawn_quick_battle_army", 16, "$g_quick_battle_team_2_faction", "$g_presentation_obj_custom_battle_designer_9_last_value", "$g_presentation_obj_custom_battle_designer_10_last_value", "$g_presentation_obj_custom_battle_designer_11_last_value", 0, 0), (try_end), ## Dunde's Restart Custom Battle BEGIN ## reg8 as Kill Count Accumulator, reg7 as current report (assign, reg8, 0), ## Dunde's Restart Custom Battle END (set_jump_mission,":cur_mission_template"), (jump_to_menu, "mnu_custom_battle_end"), (jump_to_scene, ":cur_scene"), (change_screen_mission), (presentation_set_duration, 0), (else_try), (eq, ":object", "$g_presentation_obj_custom_battle_designer_20"), (presentation_set_duration, 0), (try_end), ]),
- If we set Custom Battle 25 men against 25 mens on the Game Design Presentation, it will be 26 men vs 25 men battle. When the Presentation sets our side size, it does not include main character. We can fix it by replace single line on module_scripts.py like this :
Code:#script_spawn_quick_battle_army # INPUT: arg1 = initial_entry_point, arg2 = faction_no, arg3 = infantry_ratio, arg4 = archers_ratio, arg5 = cavalry_ratio, arg6 = divide_archer_entry_points, arg7 = player_team # OUTPUT: none ("spawn_quick_battle_army", [ (store_script_param, ":cur_entry_point", 1), (store_script_param, ":faction_no", 2), (store_script_param, ":infantry_ratio", 3), (store_script_param, ":archers_ratio", 4), (store_script_param, ":cavalry_ratio", 5), (store_script_param, ":divide_archer_entry_points", 6), (store_script_param, ":player_team", 7), (try_begin), (eq, ":player_team", 1), (call_script, "script_get_army_size_from_slider_value", "$g_quick_battle_army_1_size"), # Dunde's Custom Battle Balancing BEGIN #(assign, ":army_size", reg0), (store_sub, ":army_size", reg0, 1), # Dunde's Custom Battle Balancing END (set_player_troop, "$g_quick_battle_troop"), (set_visitor, ":cur_entry_point", "$g_quick_battle_troop"), (try_begin), (eq, ":cur_entry_point", 0),