4-5r tris per icon is ok. WFaS uses 4-5k tris icons almost for all icons.
# script_get_item_price
# This script will return the price of an item in reg0
# INPUT: <arg1> = item_type_id, <arg2> = item_modifier_id
# OUTPUT: reg0 = nominal item price (price modifiers are ignored)
("get_item_price",
[
(store_script_param_1, ":item_id"),
(store_script_param_2, ":item_modifier"),
(troop_clear_inventory, "trp_temp_troop"),
(troop_set_auto_equip, "trp_temp_troop", 0),
(troop_add_item, "trp_temp_troop", ":item_id", ":item_modifier"),
(troop_remove_items, "trp_temp_troop", ":item_id", 1),
]
),
common_battle_order_panel = (0, 0, 0, [],
[(neg|main_hero_fallen),
(try_begin),
(key_clicked, key_left_alt),
(try_begin),
(eq, "$active_panel", 0),
(assign, "$active_panel", 1),
(else_try),
(assign, "$active_panel", 0),
(try_end),
(try_end),
(game_key_clicked, gk_view_orders),
(try_begin),
(eq, "$battle_panel", 0),
(assign, "$battle_panel", 1),
(try_begin),
(eq, "$active_panel", 0),
(start_presentation, "prsnt_battle_ex"),
(else_try),
(start_presentation, "prsnt_battle"),
(try_end),
(else_try),
(assign, "$battle_panel", 0),
(try_end), ])
common_battle_order_panel_tick = (0.1, 0, 0, [],
[(this_or_next|is_presentation_active, "prsnt_battle"),
(is_presentation_active, "prsnt_battle_ex"),
(eq, "$battle_panel", 1),
(call_script, "script_update_order_panel_checked_classes"),
(get_player_agent_no, ":player_agent"),
(agent_get_team, ":player_team", ":player_agent"),
(call_script, "script_update_order_panel", ":player_team"),
(call_script, "script_update_order_panel_statistics_and_map"), ])
(ti_on_presentation_run,
[(store_trigger_param_1, ":cur_time"),
(try_begin),
(main_hero_fallen),
(try_for_agents, ":cur_agent"),
(agent_set_slot, ":cur_agent", slot_agent_map_overlay_id, 0),
(try_end),
(assign, "$battle_panel", 0), # DUNDE
(presentation_set_duration, 0),
(try_end),
(try_begin),
(gt, ":cur_time", 200),
(try_begin),
(this_or_next| eq, "$battle_panel", 0), (eq, "$active_panel", 0),
(try_for_agents, ":cur_agent"),
(agent_set_slot, ":cur_agent", slot_agent_map_overlay_id, 0),
(try_end),
(presentation_set_duration, 0),
(eq, "$battle_panel", 1),
(start_presentation, "prsnt_battle_ex"),
(try_end),
(try_end),
("battle_ex", prsntf_read_only|prsntf_manual_end_only,0,[
(ti_on_presentation_load,
[(set_fixed_point_multiplier, 1000),
(assign, "$g_formation_group0_selected", 0),
(assign, "$g_formation_group1_selected", 0),
(assign, "$g_formation_group2_selected", 0),
(assign, "$g_formation_group3_selected", 0),
(assign, "$g_formation_group4_selected", 0),
(assign, "$g_formation_group5_selected", 0),
(assign, "$g_formation_group6_selected", 0),
(assign, "$g_formation_group7_selected", 0),
(assign, "$g_formation_group8_selected", 0),
(assign, "$g_presentation_obj_battle_but0", -1),
(assign, "$g_presentation_obj_battle_but1", -1),
(assign, "$g_presentation_obj_battle_but2", -1),
(assign, "$g_presentation_obj_battle_but3", -1),
(assign, "$g_presentation_obj_battle_but4", -1),
(assign, "$g_presentation_obj_battle_but5", -1),
(assign, "$g_presentation_obj_battle_but6", -1),
(assign, "$g_presentation_obj_battle_but7", -1),
(assign, "$g_presentation_obj_battle_but8", -1),
(str_clear, s7),
(try_for_agents, ":agent_no"),
(agent_set_slot, ":agent_no", slot_agent_map_overlay_id, 0),
(try_end),
(get_player_agent_no, ":player_agent"),
(agent_get_troop_id, ":player_troop_id", ":player_agent"),
(position_set_y, pos1, 700),
(create_text_overlay, reg1, "@Action", tf_center_justify|tf_single_line|tf_with_outline),
(overlay_set_color, reg1, 0xFFAAAAAA),
(position_set_x, pos1, 270),
(overlay_set_position, reg1, pos1),
(create_text_overlay, reg1, "@Mount", tf_center_justify|tf_single_line|tf_with_outline),
(overlay_set_color, reg1, 0xFFAAAAAA),
(position_set_x, pos1, 410),
(overlay_set_position, reg1, pos1),
(create_text_overlay, reg1, "@Attack Type", tf_center_justify|tf_single_line|tf_with_outline),
(overlay_set_color, reg1, 0xFFAAAAAA),
(position_set_x, pos1, 550),
(overlay_set_position, reg1, pos1),
(assign, "$group0_has_troops", 0),
(assign, "$group1_has_troops", 0),
(assign, "$group2_has_troops", 0),
(assign, "$group3_has_troops", 0),
(assign, "$group4_has_troops", 0),
(assign, "$group5_has_troops", 0),
(assign, "$group6_has_troops", 0),
(assign, "$group7_has_troops", 0),
(assign, "$group8_has_troops", 0),
(party_get_num_companion_stacks, ":num_stacks", "p_main_party"),
(assign, "$num_classes", 0),
(try_for_range, ":troop_iterator", 0, ":num_stacks"),
(party_stack_get_troop_id, ":cur_troop_id", "p_main_party", ":troop_iterator"),
(troop_get_class, ":troop_class", ":cur_troop_id"),
(neq, ":player_troop_id", ":cur_troop_id"),
(try_begin),
(eq, ":troop_class", 0),
(try_begin),
(neq, "$group0_has_troops", 1),
(val_add, "$num_classes", 1),
(try_end),
(assign, "$group0_has_troops", 1),
(else_try),
(eq, ":troop_class", 1),
(try_begin),
(neq, "$group1_has_troops", 1),
(val_add, "$num_classes", 1),
(try_end),
(assign, "$group1_has_troops", 1),
(else_try),
(eq, ":troop_class", 2),
(try_begin),
(neq, "$group2_has_troops", 1),
(val_add, "$num_classes", 1),
(try_end),
(assign, "$group2_has_troops", 1),
(else_try),
(eq, ":troop_class", 3),
(try_begin),
(neq, "$group3_has_troops", 1),
(val_add, "$num_classes", 1),
(try_end),
(assign, "$group3_has_troops", 1),
(else_try),
(eq, ":troop_class", 4),
(try_begin),
(neq, "$group4_has_troops", 1),
(val_add, "$num_classes", 1),
(try_end),
(assign, "$group4_has_troops", 1),
(else_try),
(eq, ":troop_class", 5),
(try_begin),
(neq, "$group5_has_troops", 1),
(val_add, "$num_classes", 1),
(try_end),
(assign, "$group5_has_troops", 1),
(else_try),
(eq, ":troop_class", 6),
(try_begin),
(neq, "$group6_has_troops", 1),
(val_add, "$num_classes", 1),
(try_end),
(assign, "$group6_has_troops", 1),
(else_try),
(eq, ":troop_class", 7),
(try_begin),
(neq, "$group7_has_troops", 1),
(val_add, "$num_classes", 1),
(try_end),
(assign, "$group7_has_troops", 1),
(else_try),
(eq, ":troop_class", 8),
(try_begin),
(neq, "$group8_has_troops", 1),
(val_add, "$num_classes", 1),
(try_end),
(assign, "$group8_has_troops", 1),
(try_end),
(try_end),
(assign, ":stat_position_x", 0),
(assign, ":stat_position_y", 653),
(assign, ":stat_position_check_x", 20),
(assign, ":stat_position_check_y", 662),
(assign, ":stat_position_name_x", 50),
(assign, ":stat_position_name_y", 660),
(try_begin),
(eq, "$group0_has_troops", 1),
(create_image_button_overlay, "$g_presentation_obj_battle_but0", "mesh_white_plane", "mesh_white_plane"),
(position_set_x, pos1, ":stat_position_x"),
(position_set_y, pos1, ":stat_position_y"),
(overlay_set_position, "$g_presentation_obj_battle_but0", pos1),
(val_add, ":stat_position_y", -40),
(position_set_x, pos1, 32500),
(position_set_y, pos1, 2000),
(overlay_set_size, "$g_presentation_obj_battle_but0", pos1),
(overlay_set_alpha, "$g_presentation_obj_battle_but0", 0),
(overlay_set_color, "$g_presentation_obj_battle_but0", 0xFFFF00),
(create_check_box_overlay, "$g_presentation_obj_battle_check0", "mesh_checkbox_off", "mesh_checkbox_on"),
(position_set_x, pos2, ":stat_position_check_x"),
(position_set_y, pos2, ":stat_position_check_y"),
(overlay_set_position, "$g_presentation_obj_battle_check0", pos2),
(val_add, ":stat_position_check_y", -40),
(create_text_overlay, "$g_presentation_obj_battle_name0", s7, 0),
(position_set_x, pos3, ":stat_position_name_x"),
(position_set_y, pos3, ":stat_position_name_y"),
(overlay_set_position, "$g_presentation_obj_battle_name0", pos3),
(val_add, ":stat_position_name_y", -40),
(create_text_overlay, "$g_presentation_but0_movement", s7, tf_center_justify),
(create_text_overlay, "$g_presentation_but0_riding", s7, tf_center_justify),
(create_text_overlay, "$g_presentation_but0_weapon_usage", s7, tf_center_justify),
(try_end),
(try_begin),
(eq, "$group1_has_troops", 1),
(create_image_button_overlay, "$g_presentation_obj_battle_but1", "mesh_white_plane", "mesh_white_plane"),
(position_set_x, pos1, ":stat_position_x"),
(position_set_y, pos1, ":stat_position_y"),
(overlay_set_position, "$g_presentation_obj_battle_but1", pos1),
(val_add, ":stat_position_y", -40),
(position_set_x, pos1, 32500),
(position_set_y, pos1, 2000),
(overlay_set_size, "$g_presentation_obj_battle_but1", pos1),
(overlay_set_alpha, "$g_presentation_obj_battle_but1", 0),
(overlay_set_color, "$g_presentation_obj_battle_but1", 0xFFFF00),
(create_check_box_overlay, "$g_presentation_obj_battle_check1", "mesh_checkbox_off", "mesh_checkbox_on"),
(position_set_x, pos2, ":stat_position_check_x"),
(position_set_y, pos2, ":stat_position_check_y"),
(overlay_set_position, "$g_presentation_obj_battle_check1", pos2),
(val_add, ":stat_position_check_y", -40),
(create_text_overlay, "$g_presentation_obj_battle_name1", s7, 0),
(position_set_x, pos3, ":stat_position_name_x"),
(position_set_y, pos3, ":stat_position_name_y"),
(overlay_set_position, "$g_presentation_obj_battle_name1", pos3),
(val_add, ":stat_position_name_y", -40),
(create_text_overlay, "$g_presentation_but1_movement", s7, tf_center_justify),
(create_text_overlay, "$g_presentation_but1_riding", s7, tf_center_justify),
(create_text_overlay, "$g_presentation_but1_weapon_usage", s7, tf_center_justify),
(try_end),
(try_begin),
(eq, "$group2_has_troops", 1),
(create_image_button_overlay, "$g_presentation_obj_battle_but2", "mesh_white_plane", "mesh_white_plane"),
(position_set_x, pos1, ":stat_position_x"),
(position_set_y, pos1, ":stat_position_y"),
(overlay_set_position, "$g_presentation_obj_battle_but2", pos1),
(val_add, ":stat_position_y", -40),
(position_set_x, pos1, 32500),
(position_set_y, pos1, 2000),
(overlay_set_size, "$g_presentation_obj_battle_but2", pos1),
(overlay_set_alpha, "$g_presentation_obj_battle_but2", 0),
(overlay_set_color, "$g_presentation_obj_battle_but2", 0xFFFF00),
(create_check_box_overlay, "$g_presentation_obj_battle_check2", "mesh_checkbox_off", "mesh_checkbox_on"),
(position_set_x, pos2, ":stat_position_check_x"),
(position_set_y, pos2, ":stat_position_check_y"),
(overlay_set_position, "$g_presentation_obj_battle_check2", pos2),
(val_add, ":stat_position_check_y", -40),
(create_text_overlay, "$g_presentation_obj_battle_name2", s7, 0),
(position_set_x, pos3, ":stat_position_name_x"),
(position_set_y, pos3, ":stat_position_name_y"),
(overlay_set_position, "$g_presentation_obj_battle_name2", pos3),
(val_add, ":stat_position_name_y", -40),
(create_text_overlay, "$g_presentation_but2_movement", s7, tf_center_justify),
(create_text_overlay, "$g_presentation_but2_riding", s7, tf_center_justify),
(create_text_overlay, "$g_presentation_but2_weapon_usage", s7, tf_center_justify),
(try_end),
(try_begin),
(eq, "$group3_has_troops", 1),
(create_image_button_overlay, "$g_presentation_obj_battle_but3", "mesh_white_plane", "mesh_white_plane"),
(position_set_x, pos1, ":stat_position_x"),
(position_set_y, pos1, ":stat_position_y"),
(overlay_set_position, "$g_presentation_obj_battle_but3", pos1),
(val_add, ":stat_position_y", -40),
(position_set_x, pos1, 32500),
(position_set_y, pos1, 2000),
(overlay_set_size, "$g_presentation_obj_battle_but3", pos1),
(overlay_set_alpha, "$g_presentation_obj_battle_but3", 0),
(overlay_set_color, "$g_presentation_obj_battle_but3", 0xFFFF00),
(create_check_box_overlay, "$g_presentation_obj_battle_check3", "mesh_checkbox_off", "mesh_checkbox_on"),
(position_set_x, pos2, ":stat_position_check_x"),
(position_set_y, pos2, ":stat_position_check_y"),
(overlay_set_position, "$g_presentation_obj_battle_check3", pos2),
(val_add, ":stat_position_check_y", -40),
(create_text_overlay, "$g_presentation_obj_battle_name3", s7, 0),
(position_set_x, pos3, ":stat_position_name_x"),
(position_set_y, pos3, ":stat_position_name_y"),
(overlay_set_position, "$g_presentation_obj_battle_name3", pos3),
(val_add, ":stat_position_name_y", -40),
(create_text_overlay, "$g_presentation_but3_movement", s7, tf_center_justify),
(create_text_overlay, "$g_presentation_but3_riding", s7, tf_center_justify),
(create_text_overlay, "$g_presentation_but3_weapon_usage", s7, tf_center_justify),
(try_end),
(try_begin),
(eq, "$group4_has_troops", 1),
(create_image_button_overlay, "$g_presentation_obj_battle_but4", "mesh_white_plane", "mesh_white_plane"),
(position_set_x, pos1, ":stat_position_x"),
(position_set_y, pos1, ":stat_position_y"),
(overlay_set_position, "$g_presentation_obj_battle_but4", pos1),
(val_add, ":stat_position_y", -40),
(position_set_x, pos1, 32500),
(position_set_y, pos1, 2000),
(overlay_set_size, "$g_presentation_obj_battle_but4", pos1),
(overlay_set_alpha, "$g_presentation_obj_battle_but4", 0),
(overlay_set_color, "$g_presentation_obj_battle_but4", 0xFFFF00),
(create_check_box_overlay, "$g_presentation_obj_battle_check4", "mesh_checkbox_off", "mesh_checkbox_on"),
(position_set_x, pos2, ":stat_position_check_x"),
(position_set_y, pos2, ":stat_position_check_y"),
(overlay_set_position, "$g_presentation_obj_battle_check4", pos2),
(val_add, ":stat_position_check_y", -40),
(create_text_overlay, "$g_presentation_obj_battle_name4", s7, 0),
(position_set_x, pos3, ":stat_position_name_x"),
(position_set_y, pos3, ":stat_position_name_y"),
(overlay_set_position, "$g_presentation_obj_battle_name4", pos3),
(val_add, ":stat_position_name_y", -40),
(create_text_overlay, "$g_presentation_but4_movement", s7, tf_center_justify),
(create_text_overlay, "$g_presentation_but4_riding", s7, tf_center_justify),
(create_text_overlay, "$g_presentation_but4_weapon_usage", s7, tf_center_justify),
(try_end),
(try_begin),
(eq, "$group5_has_troops", 1),
(create_image_button_overlay, "$g_presentation_obj_battle_but5", "mesh_white_plane", "mesh_white_plane"),
(position_set_x, pos1, ":stat_position_x"),
(position_set_y, pos1, ":stat_position_y"),
(overlay_set_position, "$g_presentation_obj_battle_but5", pos1),
(val_add, ":stat_position_y", -40),
(position_set_x, pos1, 32500),
(position_set_y, pos1, 2000),
(overlay_set_size, "$g_presentation_obj_battle_but5", pos1),
(overlay_set_alpha, "$g_presentation_obj_battle_but5", 0),
(overlay_set_color, "$g_presentation_obj_battle_but5", 0xFFFF00),
(create_check_box_overlay, "$g_presentation_obj_battle_check5", "mesh_checkbox_off", "mesh_checkbox_on"),
(position_set_x, pos2, ":stat_position_check_x"),
(position_set_y, pos2, ":stat_position_check_y"),
(overlay_set_position, "$g_presentation_obj_battle_check5", pos2),
(val_add, ":stat_position_check_y", -40),
(create_text_overlay, "$g_presentation_obj_battle_name5", s7, 0),
(position_set_x, pos3, ":stat_position_name_x"),
(position_set_y, pos3, ":stat_position_name_y"),
(overlay_set_position, "$g_presentation_obj_battle_name5", pos3),
(val_add, ":stat_position_name_y", -40),
(create_text_overlay, "$g_presentation_but5_movement", s7, tf_center_justify),
(create_text_overlay, "$g_presentation_but5_riding", s7, tf_center_justify),
(create_text_overlay, "$g_presentation_but5_weapon_usage", s7, tf_center_justify),
(try_end),
(try_begin),
(eq, "$group6_has_troops", 1),
(create_image_button_overlay, "$g_presentation_obj_battle_but6", "mesh_white_plane", "mesh_white_plane"),
(position_set_x, pos1, ":stat_position_x"),
(position_set_y, pos1, ":stat_position_y"),
(overlay_set_position, "$g_presentation_obj_battle_but6", pos1),
(val_add, ":stat_position_y", -40),
(position_set_x, pos1, 32500),
(position_set_y, pos1, 2000),
(overlay_set_size, "$g_presentation_obj_battle_but6", pos1),
(overlay_set_alpha, "$g_presentation_obj_battle_but6", 0),
(overlay_set_color, "$g_presentation_obj_battle_but6", 0xFFFF00),
(create_check_box_overlay, "$g_presentation_obj_battle_check6", "mesh_checkbox_off", "mesh_checkbox_on"),
(position_set_x, pos2, ":stat_position_check_x"),
(position_set_y, pos2, ":stat_position_check_y"),
(overlay_set_position, "$g_presentation_obj_battle_check6", pos2),
(val_add, ":stat_position_check_y", -40),
(create_text_overlay, "$g_presentation_obj_battle_name6", s7, 0),
(position_set_x, pos3, ":stat_position_name_x"),
(position_set_y, pos3, ":stat_position_name_y"),
(overlay_set_position, "$g_presentation_obj_battle_name6", pos3),
(val_add, ":stat_position_name_y", -40),
(create_text_overlay, "$g_presentation_but6_movement", s7, tf_center_justify),
(create_text_overlay, "$g_presentation_but6_riding", s7, tf_center_justify),
(create_text_overlay, "$g_presentation_but6_weapon_usage", s7, tf_center_justify),
(try_end),
(try_begin),
(eq, "$group7_has_troops", 1),
(create_image_button_overlay, "$g_presentation_obj_battle_but7", "mesh_white_plane", "mesh_white_plane"),
(position_set_x, pos1, ":stat_position_x"),
(position_set_y, pos1, ":stat_position_y"),
(overlay_set_position, "$g_presentation_obj_battle_but7", pos1),
(val_add, ":stat_position_y", -40),
(position_set_x, pos1, 32500),
(position_set_y, pos1, 2000),
(overlay_set_size, "$g_presentation_obj_battle_but7", pos1),
(overlay_set_alpha, "$g_presentation_obj_battle_but7", 0),
(overlay_set_color, "$g_presentation_obj_battle_but7", 0xFFFF00),
(create_check_box_overlay, "$g_presentation_obj_battle_check7", "mesh_checkbox_off", "mesh_checkbox_on"),
(position_set_x, pos2, ":stat_position_check_x"),
(position_set_y, pos2, ":stat_position_check_y"),
(overlay_set_position, "$g_presentation_obj_battle_check7", pos2),
(val_add, ":stat_position_check_y", -40),
(create_text_overlay, "$g_presentation_obj_battle_name7", s7, 0),
(position_set_x, pos3, ":stat_position_name_x"),
(position_set_y, pos3, ":stat_position_name_y"),
(overlay_set_position, "$g_presentation_obj_battle_name7", pos3),
(val_add, ":stat_position_name_y", -40),
(create_text_overlay, "$g_presentation_but7_movement", s7, tf_center_justify),
(create_text_overlay, "$g_presentation_but7_riding", s7, tf_center_justify),
(create_text_overlay, "$g_presentation_but7_weapon_usage", s7, tf_center_justify),
(try_end),
(try_begin),
(eq, "$group8_has_troops", 1),
(create_image_button_overlay, "$g_presentation_obj_battle_but8", "mesh_white_plane", "mesh_white_plane"),
(position_set_x, pos1, ":stat_position_x"),
(position_set_y, pos1, ":stat_position_y"),
(overlay_set_position, "$g_presentation_obj_battle_but8", pos1),
(val_add, ":stat_position_y", -40),
(position_set_x, pos1, 32500),
(position_set_y, pos1, 2000),
(overlay_set_size, "$g_presentation_obj_battle_but8", pos1),
(overlay_set_alpha, "$g_presentation_obj_battle_but8", 0),
(overlay_set_color, "$g_presentation_obj_battle_but8", 0xFFFF00),
(create_check_box_overlay, "$g_presentation_obj_battle_check8", "mesh_checkbox_off", "mesh_checkbox_on"),
(position_set_x, pos2, ":stat_position_check_x"),
(position_set_y, pos2, ":stat_position_check_y"),
(overlay_set_position, "$g_presentation_obj_battle_check8", pos2),
(val_add, ":stat_position_check_y", -40),
(create_text_overlay, "$g_presentation_obj_battle_name8", s7, 0),
(position_set_x, pos3, ":stat_position_name_x"),
(position_set_y, pos3, ":stat_position_name_y"),
(overlay_set_position, "$g_presentation_obj_battle_name8", pos3),
(val_add, ":stat_position_name_y", -40),
(create_text_overlay, "$g_presentation_but8_movement", s7, tf_center_justify),
(create_text_overlay, "$g_presentation_but8_riding", s7, tf_center_justify),
(create_text_overlay, "$g_presentation_but8_weapon_usage", s7, tf_center_justify),
(try_end),
(get_player_agent_no, ":player_agent"),
(agent_get_team, ":player_team", ":player_agent"),
(call_script, "script_update_order_panel", ":player_team"),
#(create_button_overlay, "$g_presentation_obj_battle_10", "@Hold This Position", tf_center_justify),
#(create_button_overlay, "$g_presentation_obj_battle_11", "@Follow Me", tf_center_justify),
#(create_button_overlay, "$g_presentation_obj_battle_12", "@Charge", tf_center_justify),
#(create_button_overlay, "$g_presentation_obj_battle_13", "@Advance", tf_center_justify),
#(create_button_overlay, "$g_presentation_obj_battle_14", "@Fall Back", tf_center_justify),
#(create_button_overlay, "$g_presentation_obj_battle_15", "@Stand Closer", tf_center_justify),
#(create_button_overlay, "$g_presentation_obj_battle_16", "@Spread Out", tf_center_justify),
#(create_button_overlay, "$g_presentation_obj_battle_17", "@Stand Ground", tf_center_justify),
#(create_button_overlay, "$g_presentation_obj_battle_18", "@Mount", tf_center_justify),
#(create_button_overlay, "$g_presentation_obj_battle_19", "@Dismount", tf_center_justify),
#(create_button_overlay, "$g_presentation_obj_battle_20", "@Use Any Weapon", tf_center_justify),
#(create_button_overlay, "$g_presentation_obj_battle_21", "@Use Blunt Weapons", tf_center_justify),
#(create_button_overlay, "$g_presentation_obj_battle_28", "@Hold Your Fire", tf_center_justify),
#(create_button_overlay, "$g_presentation_obj_battle_29", "@Fire At Will", tf_center_justify),
(create_text_overlay, "$g_presentation_obj_battle_22", "str_us_", 0),
(create_text_overlay, "$g_presentation_obj_battle_23", "str_allies_", 0),
(create_text_overlay, "$g_presentation_obj_battle_24", "str_enemies_", 0),
(create_text_overlay, "$g_presentation_obj_battle_25", "@Ready", tf_center_justify),
(create_text_overlay, "$g_presentation_obj_battle_26", "@Wounded", tf_center_justify),
(create_text_overlay, "$g_presentation_obj_battle_28", "str_routed", tf_center_justify),
(create_text_overlay, "$g_presentation_obj_battle_27", "@Dead", tf_center_justify),
(create_text_overlay, "$g_battle_us_ready", s7, tf_center_justify),
(create_text_overlay, "$g_battle_us_wounded", s7, tf_center_justify),
(create_text_overlay, "$g_battle_us_routed", s7, tf_center_justify),
(create_text_overlay, "$g_battle_us_dead", s7, tf_center_justify),
(create_text_overlay, "$g_battle_enemies_ready", s7, tf_center_justify),
(create_text_overlay, "$g_battle_enemies_wounded", s7, tf_center_justify),
(create_text_overlay, "$g_battle_enemies_routed", s7, tf_center_justify),
(create_text_overlay, "$g_battle_enemies_dead", s7, tf_center_justify),
(create_text_overlay, "$g_battle_allies_ready", s7, tf_center_justify),
(create_text_overlay, "$g_battle_allies_wounded", s7, tf_center_justify),
(create_text_overlay, "$g_battle_allies_routed", s7, tf_center_justify),
(create_text_overlay, "$g_battle_allies_dead", s7, tf_center_justify),
# (create_image_button_overlay, "$g_battle_report_plane", "mesh_white_plane", "mesh_white_plane"),
# (overlay_set_color, "$g_battle_report_plane", 0),
# (position_set_x, pos1, 15500),
# (position_set_y, pos1, 6000),
# (overlay_set_size, "$g_battle_report_plane", pos1),
# (position_set_x, pos1, 672),
# (position_set_y, pos1, 275),
# (overlay_set_position, "$g_battle_report_plane", pos1),
# (overlay_set_alpha, "$g_battle_report_plane", 0x44),
# (overlay_set_color, "$g_battle_report_plane", 0x1166BB),
(position_set_x, pos1, 750),
(position_set_y, pos1, 750),
(overlay_set_size, "$g_presentation_obj_battle_22", pos1),
(overlay_set_size, "$g_presentation_obj_battle_23", pos1),
(overlay_set_size, "$g_presentation_obj_battle_24", pos1),
(overlay_set_size, "$g_presentation_obj_battle_25", pos1),
(overlay_set_size, "$g_presentation_obj_battle_26", pos1),
(overlay_set_size, "$g_presentation_obj_battle_27", pos1),
(overlay_set_size, "$g_presentation_obj_battle_28", pos1),
(overlay_set_size, "$g_battle_us_ready", pos1),
(overlay_set_size, "$g_battle_us_wounded", pos1),
(overlay_set_size, "$g_battle_us_routed", pos1),
(overlay_set_size, "$g_battle_us_dead", pos1),
(overlay_set_size, "$g_battle_enemies_ready", pos1),
(overlay_set_size, "$g_battle_enemies_wounded", pos1),
(overlay_set_size, "$g_battle_enemies_routed", pos1),
(overlay_set_size, "$g_battle_enemies_dead", pos1),
(overlay_set_size, "$g_battle_allies_ready", pos1),
(overlay_set_size, "$g_battle_allies_wounded", pos1),
(overlay_set_size, "$g_battle_allies_routed", pos1),
(overlay_set_size, "$g_battle_allies_dead", pos1),
(assign, ":stat_position_x", 675),
(assign, ":stat_position_y", 280),
(val_add, ":stat_position_x", 70),
(val_add, ":stat_position_y", 90),
(position_set_x, pos1, ":stat_position_x"),
(position_set_y, pos1, ":stat_position_y"),
(overlay_set_position, "$g_presentation_obj_battle_25", pos1),
(val_add, ":stat_position_x", 70),
(position_set_x, pos1, ":stat_position_x"),
(overlay_set_position, "$g_presentation_obj_battle_26", pos1),
(val_add, ":stat_position_x", 70),
(position_set_x, pos1, ":stat_position_x"),
(overlay_set_position, "$g_presentation_obj_battle_28", pos1),
(val_add, ":stat_position_x", 70),
(position_set_x, pos1, ":stat_position_x"),
(overlay_set_position, "$g_presentation_obj_battle_27", pos1),
(val_add, ":stat_position_x", -280),
(val_add, ":stat_position_y", -30),
(position_set_x, pos1, ":stat_position_x"),
(position_set_y, pos1, ":stat_position_y"),
(overlay_set_position, "$g_presentation_obj_battle_22", pos1),
(val_add, ":stat_position_y", -30),
(position_set_y, pos1, ":stat_position_y"),
(overlay_set_position, "$g_presentation_obj_battle_23", pos1),
(val_add, ":stat_position_y", -30),
(position_set_y, pos1, ":stat_position_y"),
(overlay_set_position, "$g_presentation_obj_battle_24", pos1),
(get_scene_boundaries, pos2, pos3),
(position_transform_position_to_local, pos4, pos2, pos3),
(set_fixed_point_multiplier, 1000),
(position_get_x, ":map_width", pos4),
(position_get_y, ":map_height", pos4),
(set_fixed_point_multiplier, 1000),
(store_div, ":map_ratio", ":map_height", 100),
(store_div, ":map_ratio", ":map_width", ":map_ratio"),
(try_begin),
(gt, ":map_ratio", 100),
(assign, "$g_battle_map_width", 300),
(store_div, "$g_battle_map_scale", ":map_width", "$g_battle_map_width"),
(store_div, "$g_battle_map_height", ":map_height", "$g_battle_map_scale"),
(else_try),
(assign, "$g_battle_map_height", 300),
(store_div, "$g_battle_map_scale", ":map_height", "$g_battle_map_height"),
(store_div, "$g_battle_map_width", ":map_width", "$g_battle_map_scale"),
(try_end),
(create_image_button_overlay, "$g_battle_map_plane", "mesh_white_plane", "mesh_white_plane"),
(overlay_set_color, "$g_battle_map_plane", 0),
(store_add, ":map_bordered_width", "$g_battle_map_width", 20),
(store_add, ":map_bordered_height", "$g_battle_map_height", 20),
(store_mul, ":map_scale_x", ":map_bordered_width", 50),
(store_mul, ":map_scale_y", ":map_bordered_height", 50),
(position_set_x, pos1, ":map_scale_x"),
(position_set_y, pos1, ":map_scale_y"),
(overlay_set_size, "$g_battle_map_plane", pos1),
(store_sub, ":map_pos_x", 990, ":map_bordered_width"),
(store_sub, ":map_pos_y", 740, ":map_bordered_height"),
(position_set_x, pos1, ":map_pos_x"),
(position_set_y, pos1, ":map_pos_y"),
(overlay_set_position, "$g_battle_map_plane", pos1),
(overlay_set_alpha, "$g_battle_map_plane", 0x44),
(create_mesh_overlay, "$g_battle_map_infantry_order_flag", "mesh_flag_infantry"),
(create_mesh_overlay, "$g_battle_map_archers_order_flag", "mesh_flag_archers"),
(create_mesh_overlay, "$g_battle_map_cavalry_order_flag", "mesh_flag_cavalry"),
(overlay_set_alpha, "$g_battle_map_infantry_order_flag", 0),
(overlay_set_alpha, "$g_battle_map_archers_order_flag", 0),
(overlay_set_alpha, "$g_battle_map_cavalry_order_flag", 0),
(call_script, "script_update_order_panel_checked_classes"),
(call_script, "script_update_order_panel_statistics_and_map"),
(presentation_set_duration, 999999),
]),
(ti_on_presentation_run,
[(store_trigger_param_1, ":cur_time"),
(try_begin),
(main_hero_fallen),
(try_for_agents, ":cur_agent"),
(agent_set_slot, ":cur_agent", slot_agent_map_overlay_id, 0),
(try_end),
(assign, "$battle_panel", 0),
(presentation_set_duration, 0),
(try_end),
(try_begin),
(gt, ":cur_time", 200),
(try_begin),
(this_or_next| eq, "$battle_panel", 0), (eq, "$active_panel", 1),
(try_for_agents, ":cur_agent"),
(agent_set_slot, ":cur_agent", slot_agent_map_overlay_id, 0),
(try_end),
(presentation_set_duration, 0),
(eq, "$battle_panel", 1),
(start_presentation, "prsnt_battle"),
(try_end),
(try_end),
]),
]),
common_battle_order_panel = (0, 0, 0, [],
[(neg|main_hero_fallen),
(try_begin),
(key_is_down, key_left_shift),
(assign, "$active_panel", 1),
(else_try),
(assign, "$active_panel", 0),
(try_end),
(game_key_clicked, gk_view_orders),
(try_begin),
(eq, "$battle_panel", 0),
(assign, "$battle_panel", 1),
(try_begin),
(eq, "$active_panel", 0),
(start_presentation, "prsnt_battle_ex"),
(else_try),
(start_presentation, "prsnt_battle"),
(try_end),
(else_try),
(assign, "$battle_panel", 0),
(try_end), ])
Beaver said:Yes, not all too complicated as a whole. The basic thing you'd need to do is to disable the item select presentation and then write a script that randomises what equipment a troop gets from what they have in their inventory. Then of course you need to make troops and all that, but those are the basics.
I suppose this isn't really the place to discuss how to do it though, that would belong in the Forge or perhaps the Pioneers Guild. This is, after all, the subforum for a Napoleonic mod
dunde said:Using Battle Panel effectively is the key to winning a battle, but when the battle panel's opened, we can't attack anymore.
This is an alternative battle panel, pasive but displaying useful informations about the battle. Tab key to activate battle panel, and ALT to toggle the panel control.
Code:common_battle_order_panel = (0, 0, 0, [], [(neg|main_hero_fallen), (try_begin), (key_clicked, key_left_alt), (try_begin), (eq, "$active_panel", 0), (assign, "$active_panel", 1), (else_try), (assign, "$active_panel", 0), (try_end), (try_end), (game_key_clicked, gk_view_orders), (try_begin), (eq, "$battle_panel", 0), (assign, "$battle_panel", 1), (try_begin), (eq, "$active_panel", 0), (start_presentation, "prsnt_battle_ex"), (else_try), (start_presentation, "prsnt_battle"), (try_end), (else_try), (assign, "$battle_panel", 0), (try_end), ]) common_battle_order_panel_tick = (0.1, 0, 0, [], [(this_or_next|is_presentation_active, "prsnt_battle"), (is_presentation_active, "prsnt_battle_ex"), (eq, "$battle_panel", 1), (call_script, "script_update_order_panel_checked_classes"), (get_player_agent_no, ":player_agent"), (agent_get_team, ":player_team", ":player_agent"), (call_script, "script_update_order_panel", ":player_team"), (call_script, "script_update_order_panel_statistics_and_map"), ])
Go to module_presentations.py
First, change the ti_on_presentations_run trigger part of "battle" presentation :
Code:(ti_on_presentation_run, [(store_trigger_param_1, ":cur_time"), (try_begin), (main_hero_fallen), (try_for_agents, ":cur_agent"), (agent_set_slot, ":cur_agent", slot_agent_map_overlay_id, 0), (try_end), (assign, "$battle_panel", 0), # DUNDE (presentation_set_duration, 0), (try_end), (try_begin), (gt, ":cur_time", 200), (try_begin), (this_or_next| eq, "$battle_panel", 0), (eq, "$active_panel", 0), (try_for_agents, ":cur_agent"), (agent_set_slot, ":cur_agent", slot_agent_map_overlay_id, 0), (try_end), (presentation_set_duration, 0), (eq, "$battle_panel", 1), (start_presentation, "prsnt_battle_ex"), (try_end), (try_end),
And this is our new presentation, cut from "battle" presentation :
Code:("battle_ex", prsntf_read_only|prsntf_manual_end_only,0,[ (ti_on_presentation_load, [(set_fixed_point_multiplier, 1000), (assign, "$g_formation_group0_selected", 0), (assign, "$g_formation_group1_selected", 0), (assign, "$g_formation_group2_selected", 0), (assign, "$g_formation_group3_selected", 0), (assign, "$g_formation_group4_selected", 0), (assign, "$g_formation_group5_selected", 0), (assign, "$g_formation_group6_selected", 0), (assign, "$g_formation_group7_selected", 0), (assign, "$g_formation_group8_selected", 0), (assign, "$g_presentation_obj_battle_but0", -1), (assign, "$g_presentation_obj_battle_but1", -1), (assign, "$g_presentation_obj_battle_but2", -1), (assign, "$g_presentation_obj_battle_but3", -1), (assign, "$g_presentation_obj_battle_but4", -1), (assign, "$g_presentation_obj_battle_but5", -1), (assign, "$g_presentation_obj_battle_but6", -1), (assign, "$g_presentation_obj_battle_but7", -1), (assign, "$g_presentation_obj_battle_but8", -1), (str_clear, s7), (try_for_agents, ":agent_no"), (agent_set_slot, ":agent_no", slot_agent_map_overlay_id, 0), (try_end), (get_player_agent_no, ":player_agent"), (agent_get_troop_id, ":player_troop_id", ":player_agent"), (position_set_y, pos1, 700), (create_text_overlay, reg1, "@Action", tf_center_justify|tf_single_line|tf_with_outline), (overlay_set_color, reg1, 0xFFAAAAAA), (position_set_x, pos1, 270), (overlay_set_position, reg1, pos1), (create_text_overlay, reg1, "@Mount", tf_center_justify|tf_single_line|tf_with_outline), (overlay_set_color, reg1, 0xFFAAAAAA), (position_set_x, pos1, 410), (overlay_set_position, reg1, pos1), (create_text_overlay, reg1, "@Attack Type", tf_center_justify|tf_single_line|tf_with_outline), (overlay_set_color, reg1, 0xFFAAAAAA), (position_set_x, pos1, 550), (overlay_set_position, reg1, pos1), (assign, "$group0_has_troops", 0), (assign, "$group1_has_troops", 0), (assign, "$group2_has_troops", 0), (assign, "$group3_has_troops", 0), (assign, "$group4_has_troops", 0), (assign, "$group5_has_troops", 0), (assign, "$group6_has_troops", 0), (assign, "$group7_has_troops", 0), (assign, "$group8_has_troops", 0), (party_get_num_companion_stacks, ":num_stacks", "p_main_party"), (assign, "$num_classes", 0), (try_for_range, ":troop_iterator", 0, ":num_stacks"), (party_stack_get_troop_id, ":cur_troop_id", "p_main_party", ":troop_iterator"), (troop_get_class, ":troop_class", ":cur_troop_id"), (neq, ":player_troop_id", ":cur_troop_id"), (try_begin), (eq, ":troop_class", 0), (try_begin), (neq, "$group0_has_troops", 1), (val_add, "$num_classes", 1), (try_end), (assign, "$group0_has_troops", 1), (else_try), (eq, ":troop_class", 1), (try_begin), (neq, "$group1_has_troops", 1), (val_add, "$num_classes", 1), (try_end), (assign, "$group1_has_troops", 1), (else_try), (eq, ":troop_class", 2), (try_begin), (neq, "$group2_has_troops", 1), (val_add, "$num_classes", 1), (try_end), (assign, "$group2_has_troops", 1), (else_try), (eq, ":troop_class", 3), (try_begin), (neq, "$group3_has_troops", 1), (val_add, "$num_classes", 1), (try_end), (assign, "$group3_has_troops", 1), (else_try), (eq, ":troop_class", 4), (try_begin), (neq, "$group4_has_troops", 1), (val_add, "$num_classes", 1), (try_end), (assign, "$group4_has_troops", 1), (else_try), (eq, ":troop_class", 5), (try_begin), (neq, "$group5_has_troops", 1), (val_add, "$num_classes", 1), (try_end), (assign, "$group5_has_troops", 1), (else_try), (eq, ":troop_class", 6), (try_begin), (neq, "$group6_has_troops", 1), (val_add, "$num_classes", 1), (try_end), (assign, "$group6_has_troops", 1), (else_try), (eq, ":troop_class", 7), (try_begin), (neq, "$group7_has_troops", 1), (val_add, "$num_classes", 1), (try_end), (assign, "$group7_has_troops", 1), (else_try), (eq, ":troop_class", 8), (try_begin), (neq, "$group8_has_troops", 1), (val_add, "$num_classes", 1), (try_end), (assign, "$group8_has_troops", 1), (try_end), (try_end), (assign, ":stat_position_x", 0), (assign, ":stat_position_y", 653), (assign, ":stat_position_check_x", 20), (assign, ":stat_position_check_y", 662), (assign, ":stat_position_name_x", 50), (assign, ":stat_position_name_y", 660), (try_begin), (eq, "$group0_has_troops", 1), (create_image_button_overlay, "$g_presentation_obj_battle_but0", "mesh_white_plane", "mesh_white_plane"), (position_set_x, pos1, ":stat_position_x"), (position_set_y, pos1, ":stat_position_y"), (overlay_set_position, "$g_presentation_obj_battle_but0", pos1), (val_add, ":stat_position_y", -40), (position_set_x, pos1, 32500), (position_set_y, pos1, 2000), (overlay_set_size, "$g_presentation_obj_battle_but0", pos1), (overlay_set_alpha, "$g_presentation_obj_battle_but0", 0), (overlay_set_color, "$g_presentation_obj_battle_but0", 0xFFFF00), (create_check_box_overlay, "$g_presentation_obj_battle_check0", "mesh_checkbox_off", "mesh_checkbox_on"), (position_set_x, pos2, ":stat_position_check_x"), (position_set_y, pos2, ":stat_position_check_y"), (overlay_set_position, "$g_presentation_obj_battle_check0", pos2), (val_add, ":stat_position_check_y", -40), (create_text_overlay, "$g_presentation_obj_battle_name0", s7, 0), (position_set_x, pos3, ":stat_position_name_x"), (position_set_y, pos3, ":stat_position_name_y"), (overlay_set_position, "$g_presentation_obj_battle_name0", pos3), (val_add, ":stat_position_name_y", -40), (create_text_overlay, "$g_presentation_but0_movement", s7, tf_center_justify), (create_text_overlay, "$g_presentation_but0_riding", s7, tf_center_justify), (create_text_overlay, "$g_presentation_but0_weapon_usage", s7, tf_center_justify), (try_end), (try_begin), (eq, "$group1_has_troops", 1), (create_image_button_overlay, "$g_presentation_obj_battle_but1", "mesh_white_plane", "mesh_white_plane"), (position_set_x, pos1, ":stat_position_x"), (position_set_y, pos1, ":stat_position_y"), (overlay_set_position, "$g_presentation_obj_battle_but1", pos1), (val_add, ":stat_position_y", -40), (position_set_x, pos1, 32500), (position_set_y, pos1, 2000), (overlay_set_size, "$g_presentation_obj_battle_but1", pos1), (overlay_set_alpha, "$g_presentation_obj_battle_but1", 0), (overlay_set_color, "$g_presentation_obj_battle_but1", 0xFFFF00), (create_check_box_overlay, "$g_presentation_obj_battle_check1", "mesh_checkbox_off", "mesh_checkbox_on"), (position_set_x, pos2, ":stat_position_check_x"), (position_set_y, pos2, ":stat_position_check_y"), (overlay_set_position, "$g_presentation_obj_battle_check1", pos2), (val_add, ":stat_position_check_y", -40), (create_text_overlay, "$g_presentation_obj_battle_name1", s7, 0), (position_set_x, pos3, ":stat_position_name_x"), (position_set_y, pos3, ":stat_position_name_y"), (overlay_set_position, "$g_presentation_obj_battle_name1", pos3), (val_add, ":stat_position_name_y", -40), (create_text_overlay, "$g_presentation_but1_movement", s7, tf_center_justify), (create_text_overlay, "$g_presentation_but1_riding", s7, tf_center_justify), (create_text_overlay, "$g_presentation_but1_weapon_usage", s7, tf_center_justify), (try_end), (try_begin), (eq, "$group2_has_troops", 1), (create_image_button_overlay, "$g_presentation_obj_battle_but2", "mesh_white_plane", "mesh_white_plane"), (position_set_x, pos1, ":stat_position_x"), (position_set_y, pos1, ":stat_position_y"), (overlay_set_position, "$g_presentation_obj_battle_but2", pos1), (val_add, ":stat_position_y", -40), (position_set_x, pos1, 32500), (position_set_y, pos1, 2000), (overlay_set_size, "$g_presentation_obj_battle_but2", pos1), (overlay_set_alpha, "$g_presentation_obj_battle_but2", 0), (overlay_set_color, "$g_presentation_obj_battle_but2", 0xFFFF00), (create_check_box_overlay, "$g_presentation_obj_battle_check2", "mesh_checkbox_off", "mesh_checkbox_on"), (position_set_x, pos2, ":stat_position_check_x"), (position_set_y, pos2, ":stat_position_check_y"), (overlay_set_position, "$g_presentation_obj_battle_check2", pos2), (val_add, ":stat_position_check_y", -40), (create_text_overlay, "$g_presentation_obj_battle_name2", s7, 0), (position_set_x, pos3, ":stat_position_name_x"), (position_set_y, pos3, ":stat_position_name_y"), (overlay_set_position, "$g_presentation_obj_battle_name2", pos3), (val_add, ":stat_position_name_y", -40), (create_text_overlay, "$g_presentation_but2_movement", s7, tf_center_justify), (create_text_overlay, "$g_presentation_but2_riding", s7, tf_center_justify), (create_text_overlay, "$g_presentation_but2_weapon_usage", s7, tf_center_justify), (try_end), (try_begin), (eq, "$group3_has_troops", 1), (create_image_button_overlay, "$g_presentation_obj_battle_but3", "mesh_white_plane", "mesh_white_plane"), (position_set_x, pos1, ":stat_position_x"), (position_set_y, pos1, ":stat_position_y"), (overlay_set_position, "$g_presentation_obj_battle_but3", pos1), (val_add, ":stat_position_y", -40), (position_set_x, pos1, 32500), (position_set_y, pos1, 2000), (overlay_set_size, "$g_presentation_obj_battle_but3", pos1), (overlay_set_alpha, "$g_presentation_obj_battle_but3", 0), (overlay_set_color, "$g_presentation_obj_battle_but3", 0xFFFF00), (create_check_box_overlay, "$g_presentation_obj_battle_check3", "mesh_checkbox_off", "mesh_checkbox_on"), (position_set_x, pos2, ":stat_position_check_x"), (position_set_y, pos2, ":stat_position_check_y"), (overlay_set_position, "$g_presentation_obj_battle_check3", pos2), (val_add, ":stat_position_check_y", -40), (create_text_overlay, "$g_presentation_obj_battle_name3", s7, 0), (position_set_x, pos3, ":stat_position_name_x"), (position_set_y, pos3, ":stat_position_name_y"), (overlay_set_position, "$g_presentation_obj_battle_name3", pos3), (val_add, ":stat_position_name_y", -40), (create_text_overlay, "$g_presentation_but3_movement", s7, tf_center_justify), (create_text_overlay, "$g_presentation_but3_riding", s7, tf_center_justify), (create_text_overlay, "$g_presentation_but3_weapon_usage", s7, tf_center_justify), (try_end), (try_begin), (eq, "$group4_has_troops", 1), (create_image_button_overlay, "$g_presentation_obj_battle_but4", "mesh_white_plane", "mesh_white_plane"), (position_set_x, pos1, ":stat_position_x"), (position_set_y, pos1, ":stat_position_y"), (overlay_set_position, "$g_presentation_obj_battle_but4", pos1), (val_add, ":stat_position_y", -40), (position_set_x, pos1, 32500), (position_set_y, pos1, 2000), (overlay_set_size, "$g_presentation_obj_battle_but4", pos1), (overlay_set_alpha, "$g_presentation_obj_battle_but4", 0), (overlay_set_color, "$g_presentation_obj_battle_but4", 0xFFFF00), (create_check_box_overlay, "$g_presentation_obj_battle_check4", "mesh_checkbox_off", "mesh_checkbox_on"), (position_set_x, pos2, ":stat_position_check_x"), (position_set_y, pos2, ":stat_position_check_y"), (overlay_set_position, "$g_presentation_obj_battle_check4", pos2), (val_add, ":stat_position_check_y", -40), (create_text_overlay, "$g_presentation_obj_battle_name4", s7, 0), (position_set_x, pos3, ":stat_position_name_x"), (position_set_y, pos3, ":stat_position_name_y"), (overlay_set_position, "$g_presentation_obj_battle_name4", pos3), (val_add, ":stat_position_name_y", -40), (create_text_overlay, "$g_presentation_but4_movement", s7, tf_center_justify), (create_text_overlay, "$g_presentation_but4_riding", s7, tf_center_justify), (create_text_overlay, "$g_presentation_but4_weapon_usage", s7, tf_center_justify), (try_end), (try_begin), (eq, "$group5_has_troops", 1), (create_image_button_overlay, "$g_presentation_obj_battle_but5", "mesh_white_plane", "mesh_white_plane"), (position_set_x, pos1, ":stat_position_x"), (position_set_y, pos1, ":stat_position_y"), (overlay_set_position, "$g_presentation_obj_battle_but5", pos1), (val_add, ":stat_position_y", -40), (position_set_x, pos1, 32500), (position_set_y, pos1, 2000), (overlay_set_size, "$g_presentation_obj_battle_but5", pos1), (overlay_set_alpha, "$g_presentation_obj_battle_but5", 0), (overlay_set_color, "$g_presentation_obj_battle_but5", 0xFFFF00), (create_check_box_overlay, "$g_presentation_obj_battle_check5", "mesh_checkbox_off", "mesh_checkbox_on"), (position_set_x, pos2, ":stat_position_check_x"), (position_set_y, pos2, ":stat_position_check_y"), (overlay_set_position, "$g_presentation_obj_battle_check5", pos2), (val_add, ":stat_position_check_y", -40), (create_text_overlay, "$g_presentation_obj_battle_name5", s7, 0), (position_set_x, pos3, ":stat_position_name_x"), (position_set_y, pos3, ":stat_position_name_y"), (overlay_set_position, "$g_presentation_obj_battle_name5", pos3), (val_add, ":stat_position_name_y", -40), (create_text_overlay, "$g_presentation_but5_movement", s7, tf_center_justify), (create_text_overlay, "$g_presentation_but5_riding", s7, tf_center_justify), (create_text_overlay, "$g_presentation_but5_weapon_usage", s7, tf_center_justify), (try_end), (try_begin), (eq, "$group6_has_troops", 1), (create_image_button_overlay, "$g_presentation_obj_battle_but6", "mesh_white_plane", "mesh_white_plane"), (position_set_x, pos1, ":stat_position_x"), (position_set_y, pos1, ":stat_position_y"), (overlay_set_position, "$g_presentation_obj_battle_but6", pos1), (val_add, ":stat_position_y", -40), (position_set_x, pos1, 32500), (position_set_y, pos1, 2000), (overlay_set_size, "$g_presentation_obj_battle_but6", pos1), (overlay_set_alpha, "$g_presentation_obj_battle_but6", 0), (overlay_set_color, "$g_presentation_obj_battle_but6", 0xFFFF00), (create_check_box_overlay, "$g_presentation_obj_battle_check6", "mesh_checkbox_off", "mesh_checkbox_on"), (position_set_x, pos2, ":stat_position_check_x"), (position_set_y, pos2, ":stat_position_check_y"), (overlay_set_position, "$g_presentation_obj_battle_check6", pos2), (val_add, ":stat_position_check_y", -40), (create_text_overlay, "$g_presentation_obj_battle_name6", s7, 0), (position_set_x, pos3, ":stat_position_name_x"), (position_set_y, pos3, ":stat_position_name_y"), (overlay_set_position, "$g_presentation_obj_battle_name6", pos3), (val_add, ":stat_position_name_y", -40), (create_text_overlay, "$g_presentation_but6_movement", s7, tf_center_justify), (create_text_overlay, "$g_presentation_but6_riding", s7, tf_center_justify), (create_text_overlay, "$g_presentation_but6_weapon_usage", s7, tf_center_justify), (try_end), (try_begin), (eq, "$group7_has_troops", 1), (create_image_button_overlay, "$g_presentation_obj_battle_but7", "mesh_white_plane", "mesh_white_plane"), (position_set_x, pos1, ":stat_position_x"), (position_set_y, pos1, ":stat_position_y"), (overlay_set_position, "$g_presentation_obj_battle_but7", pos1), (val_add, ":stat_position_y", -40), (position_set_x, pos1, 32500), (position_set_y, pos1, 2000), (overlay_set_size, "$g_presentation_obj_battle_but7", pos1), (overlay_set_alpha, "$g_presentation_obj_battle_but7", 0), (overlay_set_color, "$g_presentation_obj_battle_but7", 0xFFFF00), (create_check_box_overlay, "$g_presentation_obj_battle_check7", "mesh_checkbox_off", "mesh_checkbox_on"), (position_set_x, pos2, ":stat_position_check_x"), (position_set_y, pos2, ":stat_position_check_y"), (overlay_set_position, "$g_presentation_obj_battle_check7", pos2), (val_add, ":stat_position_check_y", -40), (create_text_overlay, "$g_presentation_obj_battle_name7", s7, 0), (position_set_x, pos3, ":stat_position_name_x"), (position_set_y, pos3, ":stat_position_name_y"), (overlay_set_position, "$g_presentation_obj_battle_name7", pos3), (val_add, ":stat_position_name_y", -40), (create_text_overlay, "$g_presentation_but7_movement", s7, tf_center_justify), (create_text_overlay, "$g_presentation_but7_riding", s7, tf_center_justify), (create_text_overlay, "$g_presentation_but7_weapon_usage", s7, tf_center_justify), (try_end), (try_begin), (eq, "$group8_has_troops", 1), (create_image_button_overlay, "$g_presentation_obj_battle_but8", "mesh_white_plane", "mesh_white_plane"), (position_set_x, pos1, ":stat_position_x"), (position_set_y, pos1, ":stat_position_y"), (overlay_set_position, "$g_presentation_obj_battle_but8", pos1), (val_add, ":stat_position_y", -40), (position_set_x, pos1, 32500), (position_set_y, pos1, 2000), (overlay_set_size, "$g_presentation_obj_battle_but8", pos1), (overlay_set_alpha, "$g_presentation_obj_battle_but8", 0), (overlay_set_color, "$g_presentation_obj_battle_but8", 0xFFFF00), (create_check_box_overlay, "$g_presentation_obj_battle_check8", "mesh_checkbox_off", "mesh_checkbox_on"), (position_set_x, pos2, ":stat_position_check_x"), (position_set_y, pos2, ":stat_position_check_y"), (overlay_set_position, "$g_presentation_obj_battle_check8", pos2), (val_add, ":stat_position_check_y", -40), (create_text_overlay, "$g_presentation_obj_battle_name8", s7, 0), (position_set_x, pos3, ":stat_position_name_x"), (position_set_y, pos3, ":stat_position_name_y"), (overlay_set_position, "$g_presentation_obj_battle_name8", pos3), (val_add, ":stat_position_name_y", -40), (create_text_overlay, "$g_presentation_but8_movement", s7, tf_center_justify), (create_text_overlay, "$g_presentation_but8_riding", s7, tf_center_justify), (create_text_overlay, "$g_presentation_but8_weapon_usage", s7, tf_center_justify), (try_end), (get_player_agent_no, ":player_agent"), (agent_get_team, ":player_team", ":player_agent"), (call_script, "script_update_order_panel", ":player_team"), #(create_button_overlay, "$g_presentation_obj_battle_10", "@Hold This Position", tf_center_justify), #(create_button_overlay, "$g_presentation_obj_battle_11", "@Follow Me", tf_center_justify), #(create_button_overlay, "$g_presentation_obj_battle_12", "@Charge", tf_center_justify), #(create_button_overlay, "$g_presentation_obj_battle_13", "@Advance", tf_center_justify), #(create_button_overlay, "$g_presentation_obj_battle_14", "@Fall Back", tf_center_justify), #(create_button_overlay, "$g_presentation_obj_battle_15", "@Stand Closer", tf_center_justify), #(create_button_overlay, "$g_presentation_obj_battle_16", "@Spread Out", tf_center_justify), #(create_button_overlay, "$g_presentation_obj_battle_17", "@Stand Ground", tf_center_justify), #(create_button_overlay, "$g_presentation_obj_battle_18", "@Mount", tf_center_justify), #(create_button_overlay, "$g_presentation_obj_battle_19", "@Dismount", tf_center_justify), #(create_button_overlay, "$g_presentation_obj_battle_20", "@Use Any Weapon", tf_center_justify), #(create_button_overlay, "$g_presentation_obj_battle_21", "@Use Blunt Weapons", tf_center_justify), #(create_button_overlay, "$g_presentation_obj_battle_28", "@Hold Your Fire", tf_center_justify), #(create_button_overlay, "$g_presentation_obj_battle_29", "@Fire At Will", tf_center_justify), (create_text_overlay, "$g_presentation_obj_battle_22", "str_us_", 0), (create_text_overlay, "$g_presentation_obj_battle_23", "str_allies_", 0), (create_text_overlay, "$g_presentation_obj_battle_24", "str_enemies_", 0), (create_text_overlay, "$g_presentation_obj_battle_25", "@Ready", tf_center_justify), (create_text_overlay, "$g_presentation_obj_battle_26", "@Wounded", tf_center_justify), (create_text_overlay, "$g_presentation_obj_battle_28", "str_routed", tf_center_justify), (create_text_overlay, "$g_presentation_obj_battle_27", "@Dead", tf_center_justify), (create_text_overlay, "$g_battle_us_ready", s7, tf_center_justify), (create_text_overlay, "$g_battle_us_wounded", s7, tf_center_justify), (create_text_overlay, "$g_battle_us_routed", s7, tf_center_justify), (create_text_overlay, "$g_battle_us_dead", s7, tf_center_justify), (create_text_overlay, "$g_battle_enemies_ready", s7, tf_center_justify), (create_text_overlay, "$g_battle_enemies_wounded", s7, tf_center_justify), (create_text_overlay, "$g_battle_enemies_routed", s7, tf_center_justify), (create_text_overlay, "$g_battle_enemies_dead", s7, tf_center_justify), (create_text_overlay, "$g_battle_allies_ready", s7, tf_center_justify), (create_text_overlay, "$g_battle_allies_wounded", s7, tf_center_justify), (create_text_overlay, "$g_battle_allies_routed", s7, tf_center_justify), (create_text_overlay, "$g_battle_allies_dead", s7, tf_center_justify), # (create_image_button_overlay, "$g_battle_report_plane", "mesh_white_plane", "mesh_white_plane"), # (overlay_set_color, "$g_battle_report_plane", 0), # (position_set_x, pos1, 15500), # (position_set_y, pos1, 6000), # (overlay_set_size, "$g_battle_report_plane", pos1), # (position_set_x, pos1, 672), # (position_set_y, pos1, 275), # (overlay_set_position, "$g_battle_report_plane", pos1), # (overlay_set_alpha, "$g_battle_report_plane", 0x44), # (overlay_set_color, "$g_battle_report_plane", 0x1166BB), (position_set_x, pos1, 750), (position_set_y, pos1, 750), (overlay_set_size, "$g_presentation_obj_battle_22", pos1), (overlay_set_size, "$g_presentation_obj_battle_23", pos1), (overlay_set_size, "$g_presentation_obj_battle_24", pos1), (overlay_set_size, "$g_presentation_obj_battle_25", pos1), (overlay_set_size, "$g_presentation_obj_battle_26", pos1), (overlay_set_size, "$g_presentation_obj_battle_27", pos1), (overlay_set_size, "$g_presentation_obj_battle_28", pos1), (overlay_set_size, "$g_battle_us_ready", pos1), (overlay_set_size, "$g_battle_us_wounded", pos1), (overlay_set_size, "$g_battle_us_routed", pos1), (overlay_set_size, "$g_battle_us_dead", pos1), (overlay_set_size, "$g_battle_enemies_ready", pos1), (overlay_set_size, "$g_battle_enemies_wounded", pos1), (overlay_set_size, "$g_battle_enemies_routed", pos1), (overlay_set_size, "$g_battle_enemies_dead", pos1), (overlay_set_size, "$g_battle_allies_ready", pos1), (overlay_set_size, "$g_battle_allies_wounded", pos1), (overlay_set_size, "$g_battle_allies_routed", pos1), (overlay_set_size, "$g_battle_allies_dead", pos1), (assign, ":stat_position_x", 675), (assign, ":stat_position_y", 280), (val_add, ":stat_position_x", 70), (val_add, ":stat_position_y", 90), (position_set_x, pos1, ":stat_position_x"), (position_set_y, pos1, ":stat_position_y"), (overlay_set_position, "$g_presentation_obj_battle_25", pos1), (val_add, ":stat_position_x", 70), (position_set_x, pos1, ":stat_position_x"), (overlay_set_position, "$g_presentation_obj_battle_26", pos1), (val_add, ":stat_position_x", 70), (position_set_x, pos1, ":stat_position_x"), (overlay_set_position, "$g_presentation_obj_battle_28", pos1), (val_add, ":stat_position_x", 70), (position_set_x, pos1, ":stat_position_x"), (overlay_set_position, "$g_presentation_obj_battle_27", pos1), (val_add, ":stat_position_x", -280), (val_add, ":stat_position_y", -30), (position_set_x, pos1, ":stat_position_x"), (position_set_y, pos1, ":stat_position_y"), (overlay_set_position, "$g_presentation_obj_battle_22", pos1), (val_add, ":stat_position_y", -30), (position_set_y, pos1, ":stat_position_y"), (overlay_set_position, "$g_presentation_obj_battle_23", pos1), (val_add, ":stat_position_y", -30), (position_set_y, pos1, ":stat_position_y"), (overlay_set_position, "$g_presentation_obj_battle_24", pos1), (get_scene_boundaries, pos2, pos3), (position_transform_position_to_local, pos4, pos2, pos3), (set_fixed_point_multiplier, 1000), (position_get_x, ":map_width", pos4), (position_get_y, ":map_height", pos4), (set_fixed_point_multiplier, 1000), (store_div, ":map_ratio", ":map_height", 100), (store_div, ":map_ratio", ":map_width", ":map_ratio"), (try_begin), (gt, ":map_ratio", 100), (assign, "$g_battle_map_width", 300), (store_div, "$g_battle_map_scale", ":map_width", "$g_battle_map_width"), (store_div, "$g_battle_map_height", ":map_height", "$g_battle_map_scale"), (else_try), (assign, "$g_battle_map_height", 300), (store_div, "$g_battle_map_scale", ":map_height", "$g_battle_map_height"), (store_div, "$g_battle_map_width", ":map_width", "$g_battle_map_scale"), (try_end), (create_image_button_overlay, "$g_battle_map_plane", "mesh_white_plane", "mesh_white_plane"), (overlay_set_color, "$g_battle_map_plane", 0), (store_add, ":map_bordered_width", "$g_battle_map_width", 20), (store_add, ":map_bordered_height", "$g_battle_map_height", 20), (store_mul, ":map_scale_x", ":map_bordered_width", 50), (store_mul, ":map_scale_y", ":map_bordered_height", 50), (position_set_x, pos1, ":map_scale_x"), (position_set_y, pos1, ":map_scale_y"), (overlay_set_size, "$g_battle_map_plane", pos1), (store_sub, ":map_pos_x", 990, ":map_bordered_width"), (store_sub, ":map_pos_y", 740, ":map_bordered_height"), (position_set_x, pos1, ":map_pos_x"), (position_set_y, pos1, ":map_pos_y"), (overlay_set_position, "$g_battle_map_plane", pos1), (overlay_set_alpha, "$g_battle_map_plane", 0x44), (create_mesh_overlay, "$g_battle_map_infantry_order_flag", "mesh_flag_infantry"), (create_mesh_overlay, "$g_battle_map_archers_order_flag", "mesh_flag_archers"), (create_mesh_overlay, "$g_battle_map_cavalry_order_flag", "mesh_flag_cavalry"), (overlay_set_alpha, "$g_battle_map_infantry_order_flag", 0), (overlay_set_alpha, "$g_battle_map_archers_order_flag", 0), (overlay_set_alpha, "$g_battle_map_cavalry_order_flag", 0), (call_script, "script_update_order_panel_checked_classes"), (call_script, "script_update_order_panel_statistics_and_map"), (presentation_set_duration, 999999), ]), (ti_on_presentation_run, [(store_trigger_param_1, ":cur_time"), (try_begin), (main_hero_fallen), (try_for_agents, ":cur_agent"), (agent_set_slot, ":cur_agent", slot_agent_map_overlay_id, 0), (try_end), (assign, "$battle_panel", 0), (presentation_set_duration, 0), (try_end), (try_begin), (gt, ":cur_time", 200), (try_begin), (this_or_next| eq, "$battle_panel", 0), (eq, "$active_panel", 1), (try_for_agents, ":cur_agent"), (agent_set_slot, ":cur_agent", slot_agent_map_overlay_id, 0), (try_end), (presentation_set_duration, 0), (eq, "$battle_panel", 1), (start_presentation, "prsnt_battle"), (try_end), (try_end), ]), ]),
Alternative control :
Holding Shift to make the control of battle panel active. (I did use ALT but it's risky for one of battle command button is F4).
Code:common_battle_order_panel = (0, 0, 0, [], [(neg|main_hero_fallen), (try_begin), (key_is_down, key_left_shift), (assign, "$active_panel", 1), (else_try), (assign, "$active_panel", 0), (try_end), (game_key_clicked, gk_view_orders), (try_begin), (eq, "$battle_panel", 0), (assign, "$battle_panel", 1), (try_begin), (eq, "$active_panel", 0), (start_presentation, "prsnt_battle_ex"), (else_try), (start_presentation, "prsnt_battle"), (try_end), (else_try), (assign, "$battle_panel", 0), (try_end), ])
("initialize_aristocracy",
[
#LORD OCCUPATIONS, BLOOD RELATIONSHIPS, RENOWN AND REPUTATIONS
#King ages
(try_for_range, ":cur_troop", kings_begin, kings_end),
(troop_set_slot, ":cur_troop", slot_troop_occupation, slto_kingdom_hero),
(store_random_in_range, ":age", 50, 60),
(try_begin),
(eq, ":cur_troop", "trp_kingdom_5_lord"),
(assign, ":age", 47),
(try_end),
(call_script, "script_init_troop_age", ":cur_troop", ":age"),
(try_end),
#The first thing - family structure
#lords 1 to 8 are patriarchs with one live-at-home son and one daughter. They come from one of six possible ancestors, thus making it likely that there will be two sets of siblings
#lords 9 to 12 are unmarried landowners with sisters
#lords 13 to 20 are sons who still live in their fathers' houses
#For the sake of simplicity, we can assume that all male aristocrats in prior generations either married commoners or procured their brides from the Old Country, thus discounting intermarriage
(try_for_range, ":cur_troop", kingdom_ladies_begin, kingdom_ladies_end),
(troop_set_slot, ":cur_troop", slot_troop_occupation, slto_kingdom_lady),
(try_end),
(assign, ":cur_lady", "trp_kingdom_1_lady_1"),
(try_for_range, ":cur_troop", lords_begin, lords_end),
(troop_set_slot, ":cur_troop", slot_troop_occupation, slto_kingdom_hero),
(store_random_in_range, ":father_age_at_birth", 23, 26),
# (store_random_in_range, ":mother_age_at_birth", 19, 22),
(try_begin),
(is_between, ":cur_troop", "trp_knight_1_1", "trp_knight_2_1"),
(store_sub, ":npc_seed", ":cur_troop", "trp_knight_1_1"),
(assign, ":ancestor_seed", 1),
(assign, ":king", "trp_kingdom_1_lord"),
(else_try),
(is_between, ":cur_troop", "trp_knight_2_1", "trp_knight_3_1"),
(store_sub, ":npc_seed", ":cur_troop", "trp_knight_2_1"),
(assign, ":ancestor_seed", 7),
(assign, ":king", "trp_kingdom_2_lord"),
(else_try),
(is_between, ":cur_troop", "trp_knight_3_1", "trp_knight_4_1"),
(store_sub, ":npc_seed", ":cur_troop", "trp_knight_3_1"),
(assign, ":ancestor_seed", 13),
(assign, ":king", "trp_kingdom_3_lord"),
(else_try),
(is_between, ":cur_troop", "trp_knight_4_1", "trp_knight_5_1"),
(store_sub, ":npc_seed", ":cur_troop", "trp_knight_4_1"),
(assign, ":ancestor_seed", 19),
(assign, ":king", "trp_kingdom_4_lord"),
(else_try),
(is_between, ":cur_troop", "trp_knight_5_1", "trp_knight_6_1"),
(store_sub, ":npc_seed", ":cur_troop", "trp_knight_5_1"),
(assign, ":ancestor_seed", 25),
(assign, ":king", "trp_kingdom_5_lord"),
(else_try),
(is_between, ":cur_troop", "trp_knight_6_1", "trp_kingdom_1_pretender"),
(store_sub, ":npc_seed", ":cur_troop", "trp_knight_6_1"),
(assign, ":ancestor_seed", 31),
(assign, ":king", "trp_kingdom_6_lord"),
(try_end),
(try_begin), #NPC seed is the order in the faction
(lt, ":npc_seed", 8), #Senior lords
(assign, ":reputation", ":npc_seed"),
(store_random_in_range, ":age", 45, 64),
(store_random_in_range, ":father", 0, 6), #six possible fathers
(val_add, ":father", ":ancestor_seed"),
(troop_set_slot, ":cur_troop", slot_troop_father, ":father"), # Father is not active npc
#wife
(troop_set_slot, ":cur_troop", slot_troop_spouse, ":cur_lady"),
(troop_set_slot, ":cur_lady", slot_troop_spouse, ":cur_troop"),
(store_random_in_range, ":wife_reputation", 20, 26),
(try_begin),
(eq, ":wife_reputation", 20),
(assign, ":wife_reputation", lrep_conventional),
(try_end),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, ":wife_reputation"),
(store_random_in_range, ":lady_age", 40, ":age"),
(call_script, "script_init_troop_age", ":cur_lady", ":lady_age"),
(call_script, "script_add_lady_items", ":cur_lady"),
(val_add, ":cur_lady", 1),
#daughter
(troop_set_slot, ":cur_lady", slot_troop_father, ":cur_troop"),
(store_sub, ":mother", ":cur_lady", 1),
(store_random_in_range, ":lady_age", 17, 25),
(val_max, ":lady_age", 19),
(call_script, "script_init_troop_age", ":cur_lady", ":lady_age"),
(troop_set_slot, ":cur_lady", slot_troop_mother, ":cur_lady"),
(store_random_in_range, ":lady_reputation", lrep_conventional, 34), #33% chance of father-derived
(try_begin),
(le, ":lady_reputation", 25),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, ":lady_reputation"),
(else_try),
(eq, ":lady_reputation", 26),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_conventional),
(else_try),
(eq, ":lady_reputation", 27),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_moralist),
(else_try),
(assign, ":guardian_reputation", ":reputation"),
(try_begin),
(this_or_next|eq, ":guardian_reputation", lrep_martial),
(eq, ":guardian_reputation", 0),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_conventional),
(else_try),
(eq, ":guardian_reputation", lrep_quarrelsome),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_otherworldly),
(else_try),
(eq, ":guardian_reputation", lrep_selfrighteous),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_ambitious),
(else_try),
(eq, ":guardian_reputation", lrep_cunning),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_adventurous),
(else_try),
(eq, ":guardian_reputation", lrep_goodnatured),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_adventurous),
(else_try),
(eq, ":guardian_reputation", lrep_debauched),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_ambitious),
(else_try),
(eq, ":guardian_reputation", lrep_upstanding),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_moralist),
(try_end),
(try_end),
(call_script, "script_add_lady_items", ":cur_lady"),
(val_add, ":cur_lady", 1),
#high renown
(else_try), #Older unmarried lords
(is_between, ":npc_seed", 8, 12), # Dunde gives sons to the kings
(store_random_in_range, ":age", 25, 36),
(store_random_in_range, ":reputation", 0, 8),
(try_begin),
(is_between, ":npc_seed", 8, 10),
(this_or_next|eq, ":npc_seed", 8), (ge, ":reputation", 6),
(troop_set_slot, ":cur_troop", slot_troop_father, ":king"),
(val_min, ":age", 28), # we want young princes
(try_end),
(try_begin),
# No Father
(troop_slot_lt, ":cur_troop", slot_troop_father, 0),
(store_random_in_range, ":sister_reputation", 20, 26),
(try_begin),
(eq, ":sister_reputation", 20),
(assign, ":sister_reputation", lrep_conventional),
(try_end),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, ":sister_reputation"),
(troop_set_slot, ":cur_lady", slot_troop_guardian, ":cur_troop"),
(else_try),
# King's son
(try_begin), #50% chance of having father's rep
(store_random_in_range, ":reputation", 0, 16),
(gt, ":reputation", 7),
(troop_get_slot, ":reputation", ":king", slot_lord_reputation_type),
(try_end),
(troop_set_slot, ":cur_lady", slot_troop_father, ":king"),
(store_random_in_range, ":lady_reputation", lrep_conventional, 34), #33% chance of father-derived
(try_begin),
(le, ":lady_reputation", 25),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, ":lady_reputation"),
(else_try),
(eq, ":lady_reputation", 26),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_conventional),
(else_try),
(eq, ":lady_reputation", 27),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_moralist),
(else_try),
(assign, ":guardian_reputation", ":reputation"),
(try_begin),
(this_or_next|eq, ":guardian_reputation", lrep_martial),
(eq, ":guardian_reputation", 0),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_conventional),
(else_try),
(eq, ":guardian_reputation", lrep_quarrelsome),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_otherworldly),
(else_try),
(eq, ":guardian_reputation", lrep_selfrighteous),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_ambitious),
(else_try),
(eq, ":guardian_reputation", lrep_cunning),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_adventurous),
(else_try),
(eq, ":guardian_reputation", lrep_goodnatured),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_adventurous),
(else_try),
(eq, ":guardian_reputation", lrep_debauched),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_ambitious),
(else_try),
(eq, ":guardian_reputation", lrep_upstanding),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_moralist),
(try_end),
(try_end),
(try_end),
(store_random_in_range, ":lady_age", 15, 28),
(val_max, ":lady_age", 21),
(call_script, "script_init_troop_age", ":cur_lady", ":lady_age"),
(call_script, "script_add_lady_items", ":cur_lady"),
(val_add, ":cur_lady", 1),
(else_try), #Younger unmarried lords
#age is father's minus 20 to 25
(store_sub, ":father", ":cur_troop", 12),
(troop_set_slot, ":cur_troop", slot_troop_father, ":father"),
(troop_get_slot, ":mother", ":father", slot_troop_spouse),
(troop_set_slot, ":cur_troop", slot_troop_mother, ":mother"),
(troop_get_slot, ":father_age", ":father", slot_troop_age),
(store_sub, ":age", ":father_age", ":father_age_at_birth"),
(try_begin), #50% chance of having father's rep
(store_random_in_range, ":reputation", 0, 16),
(gt, ":reputation", 7),
(troop_get_slot, ":reputation", ":father", slot_lord_reputation_type),
(try_end),
(try_end),
(try_begin),
(eq, ":reputation", 0),
(assign, ":reputation", 1),
(try_end),
(troop_set_slot, ":cur_troop", slot_lord_reputation_type, ":reputation"),
(call_script, "script_init_troop_age", ":cur_troop", ":age"),
(try_end),
(try_begin),
(eq, "$cheat_mode", 1),
(assign, reg3, "$cheat_mode"),
(display_message, "@{!}DEBUG -- Assigned lord reputation and relations"),
# (display_message, "str_assigned_lord_reputation_and_relations_cheat_mode_reg3"), #This string can be removed
(try_end),
(try_for_range, ":cur_troop", pretenders_begin, pretenders_end),
(troop_set_slot, ":cur_troop", slot_troop_occupation, slto_inactive_pretender),
(store_random_in_range, ":age", 25, 30),
#(troop_set_slot, ":cur_troop", slot_troop_age, ":age"),
(try_begin),
(eq, ":cur_troop", "trp_kingdom_5_pretender"),
(assign, ":age", 45),
(try_end),
(call_script, "script_init_troop_age", ":cur_troop", ":age"),
(try_end),
]),
def save_scripts(variable_list,variable_uses,scripts,tag_uses,quick_strings):
file = open(export_dir + "scripts.txt","w")
file.write("scriptsfile version 1\n")
file.write("%d\n"%len(scripts))
temp_list = []
list_type = type(temp_list)
for i_script in xrange(len(scripts)):
func = scripts[i_script]
# Dunde 's protection ##########################################
script_name = convert_to_identifier(func[0])
if (not((script_name.startswith("game_")) or (script_name.startswith("multiplayer_")))):
script_name = "dunde"
for i_script in xrange(len(scripts)):
func = scripts[i_script]
if (type(func[1]) == list_type):
#file.write("%s -1\n"%(convert_to_identifier(func[0])))
file.write("%s -1\n"%script_name)
save_statement_block(file,convert_to_identifier(func[0]), 0,func[1], variable_list,variable_uses,tag_uses,quick_strings)
else:
#file.write("%s %f\n"%(convert_to_identifier(func[0]), func[1]))
file.write("%s %f\n"%(script_name, func[1]))
###############################################################
save_statement_block(file,convert_to_identifier(func[0]), 0,func[2], variable_list,variable_uses,tag_uses,quick_strings)
file.write("\n")
file.close()
from header_common import *
from module_info import *
from module_postfx import *
# Dunde's Protection
from module_info import *
import os
def write_python_header(postfx_params_list):
file = open("./ID_postfx_params.py","w")
for i_postfx_param in xrange(len(postfx_params_list)):
file.write("pfx_%s = %d\n"%(postfx_params_list[i_postfx_param][0],i_postfx_param))
file.write("\n\n")
file.close()
def write_postfx_params(postfx_params_list):
ofile = open(export_dir + "postfx.txt","w")
ofile.write("postfx_paramsfile version 1\n")
ofile.write("%d\n"%len(postfx_params_list))
for postfx_param in postfx_params_list:
ofile.write("pfx_%s %d %d"%(postfx_param[0], postfx_param[1],postfx_param[2]))
params_list1 = postfx_param[3]
params_list2 = postfx_param[4]
params_list3 = postfx_param[5]
ofile.write(" %f %f %f %f"%(params_list1[0], params_list1[1], params_list1[2], params_list1[3]))
ofile.write(" %f %f %f %f"%(params_list2[0], params_list2[1], params_list2[2], params_list2[3]))
ofile.write(" %f %f %f %f\n"%(params_list3[0], params_list3[1], params_list3[2], params_list3[3]))
ofile.close()
print "Exporting postfx_params..."
write_postfx_params(postfx_params)
write_python_header(postfx_params)
# Dunde's Protection
print "Deleting variables.txt..."
try:
os.remove(export_dir + 'variables.txt')
except:
print "variables.txt 's not found..."
print "Deleting variable_uses.txt..."
try:
os.remove(export_dir + 'variable_uses.txt')
except:
print "variable_uses.txt 's not found..."
dunde said:enhanced script_initialize_aristocracy of WB 1.143 Native :
- Kings have 1 or 2 sons and daughters.
- Adjust Kings' and lord's Face code according to their age.
- Giving variety of lady's age. (They 're no longer always be 19, 21, or 49 years old anymore)
Code:("initialize_aristocracy", [ #LORD OCCUPATIONS, BLOOD RELATIONSHIPS, RENOWN AND REPUTATIONS #King ages (try_for_range, ":cur_troop", kings_begin, kings_end), (troop_set_slot, ":cur_troop", slot_troop_occupation, slto_kingdom_hero), (store_random_in_range, ":age", 50, 60), (try_begin), (eq, ":cur_troop", "trp_kingdom_5_lord"), (assign, ":age", 47), (try_end), (call_script, "script_init_troop_age", ":cur_troop", ":age"), (try_end), #The first thing - family structure #lords 1 to 8 are patriarchs with one live-at-home son and one daughter. They come from one of six possible ancestors, thus making it likely that there will be two sets of siblings #lords 9 to 12 are unmarried landowners with sisters #lords 13 to 20 are sons who still live in their fathers' houses #For the sake of simplicity, we can assume that all male aristocrats in prior generations either married commoners or procured their brides from the Old Country, thus discounting intermarriage (try_for_range, ":cur_troop", kingdom_ladies_begin, kingdom_ladies_end), (troop_set_slot, ":cur_troop", slot_troop_occupation, slto_kingdom_lady), (try_end), (assign, ":cur_lady", "trp_kingdom_1_lady_1"), (try_for_range, ":cur_troop", lords_begin, lords_end), (troop_set_slot, ":cur_troop", slot_troop_occupation, slto_kingdom_hero), (store_random_in_range, ":father_age_at_birth", 23, 26), # (store_random_in_range, ":mother_age_at_birth", 19, 22), (try_begin), (is_between, ":cur_troop", "trp_knight_1_1", "trp_knight_2_1"), (store_sub, ":npc_seed", ":cur_troop", "trp_knight_1_1"), (assign, ":ancestor_seed", 1), (assign, ":king", "trp_kingdom_1_lord"), (else_try), (is_between, ":cur_troop", "trp_knight_2_1", "trp_knight_3_1"), (store_sub, ":npc_seed", ":cur_troop", "trp_knight_2_1"), (assign, ":ancestor_seed", 7), (assign, ":king", "trp_kingdom_2_lord"), (else_try), (is_between, ":cur_troop", "trp_knight_3_1", "trp_knight_4_1"), (store_sub, ":npc_seed", ":cur_troop", "trp_knight_3_1"), (assign, ":ancestor_seed", 13), (assign, ":king", "trp_kingdom_3_lord"), (else_try), (is_between, ":cur_troop", "trp_knight_4_1", "trp_knight_5_1"), (store_sub, ":npc_seed", ":cur_troop", "trp_knight_4_1"), (assign, ":ancestor_seed", 19), (assign, ":king", "trp_kingdom_4_lord"), (else_try), (is_between, ":cur_troop", "trp_knight_5_1", "trp_knight_6_1"), (store_sub, ":npc_seed", ":cur_troop", "trp_knight_5_1"), (assign, ":ancestor_seed", 25), (assign, ":king", "trp_kingdom_5_lord"), (else_try), (is_between, ":cur_troop", "trp_knight_6_1", "trp_kingdom_1_pretender"), (store_sub, ":npc_seed", ":cur_troop", "trp_knight_6_1"), (assign, ":ancestor_seed", 31), (assign, ":king", "trp_kingdom_6_lord"), (try_end), (try_begin), #NPC seed is the order in the faction (lt, ":npc_seed", 8), #Senior lords (assign, ":reputation", ":npc_seed"), (store_random_in_range, ":age", 45, 64), (store_random_in_range, ":father", 0, 6), #six possible fathers (val_add, ":father", ":ancestor_seed"), (troop_set_slot, ":cur_troop", slot_troop_father, ":father"), # Father is not active npc #wife (troop_set_slot, ":cur_troop", slot_troop_spouse, ":cur_lady"), (troop_set_slot, ":cur_lady", slot_troop_spouse, ":cur_troop"), (store_random_in_range, ":wife_reputation", 20, 26), (try_begin), (eq, ":wife_reputation", 20), (assign, ":wife_reputation", lrep_conventional), (try_end), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, ":wife_reputation"), (store_random_in_range, ":lady_age", 40, ":age"), (call_script, "script_init_troop_age", ":cur_lady", ":lady_age"), (call_script, "script_add_lady_items", ":cur_lady"), (val_add, ":cur_lady", 1), #daughter (troop_set_slot, ":cur_lady", slot_troop_father, ":cur_troop"), (store_sub, ":mother", ":cur_lady", 1), (store_random_in_range, ":lady_age", 17, 25), (val_max, ":lady_age", 19), (call_script, "script_init_troop_age", ":cur_lady", ":lady_age"), (troop_set_slot, ":cur_lady", slot_troop_mother, ":cur_lady"), (store_random_in_range, ":lady_reputation", lrep_conventional, 34), #33% chance of father-derived (try_begin), (le, ":lady_reputation", 25), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, ":lady_reputation"), (else_try), (eq, ":lady_reputation", 26), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_conventional), (else_try), (eq, ":lady_reputation", 27), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_moralist), (else_try), (assign, ":guardian_reputation", ":reputation"), (try_begin), (this_or_next|eq, ":guardian_reputation", lrep_martial), (eq, ":guardian_reputation", 0), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_conventional), (else_try), (eq, ":guardian_reputation", lrep_quarrelsome), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_otherworldly), (else_try), (eq, ":guardian_reputation", lrep_selfrighteous), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_ambitious), (else_try), (eq, ":guardian_reputation", lrep_cunning), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_adventurous), (else_try), (eq, ":guardian_reputation", lrep_goodnatured), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_adventurous), (else_try), (eq, ":guardian_reputation", lrep_debauched), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_ambitious), (else_try), (eq, ":guardian_reputation", lrep_upstanding), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_moralist), (try_end), (try_end), (call_script, "script_add_lady_items", ":cur_lady"), (val_add, ":cur_lady", 1), #high renown (else_try), #Older unmarried lords (is_between, ":npc_seed", 8, 12), # Dunde gives sons to the kings (store_random_in_range, ":age", 25, 36), (store_random_in_range, ":reputation", 0, 8), (try_begin), (is_between, ":npc_seed", 8, 10), (this_or_next|eq, ":npc_seed", 8), (ge, ":reputation", 6), (troop_set_slot, ":cur_troop", slot_troop_father, ":king"), (val_min, ":age", 28), # we want young princes (try_end), (try_begin), # No Father (troop_slot_lt, ":cur_troop", slot_troop_father, 0), (store_random_in_range, ":sister_reputation", 20, 26), (try_begin), (eq, ":sister_reputation", 20), (assign, ":sister_reputation", lrep_conventional), (try_end), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, ":sister_reputation"), (troop_set_slot, ":cur_lady", slot_troop_guardian, ":cur_troop"), (else_try), # King's son (try_begin), #50% chance of having father's rep (store_random_in_range, ":reputation", 0, 16), (gt, ":reputation", 7), (troop_get_slot, ":reputation", ":king", slot_lord_reputation_type), (try_end), (troop_set_slot, ":cur_lady", slot_troop_father, ":king"), (store_random_in_range, ":lady_reputation", lrep_conventional, 34), #33% chance of father-derived (try_begin), (le, ":lady_reputation", 25), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, ":lady_reputation"), (else_try), (eq, ":lady_reputation", 26), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_conventional), (else_try), (eq, ":lady_reputation", 27), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_moralist), (else_try), (assign, ":guardian_reputation", ":reputation"), (try_begin), (this_or_next|eq, ":guardian_reputation", lrep_martial), (eq, ":guardian_reputation", 0), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_conventional), (else_try), (eq, ":guardian_reputation", lrep_quarrelsome), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_otherworldly), (else_try), (eq, ":guardian_reputation", lrep_selfrighteous), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_ambitious), (else_try), (eq, ":guardian_reputation", lrep_cunning), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_adventurous), (else_try), (eq, ":guardian_reputation", lrep_goodnatured), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_adventurous), (else_try), (eq, ":guardian_reputation", lrep_debauched), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_ambitious), (else_try), (eq, ":guardian_reputation", lrep_upstanding), (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_moralist), (try_end), (try_end), (try_end), (store_random_in_range, ":lady_age", 15, 28), (val_max, ":lady_age", 21), (call_script, "script_init_troop_age", ":cur_lady", ":lady_age"), (call_script, "script_add_lady_items", ":cur_lady"), (val_add, ":cur_lady", 1), (else_try), #Younger unmarried lords #age is father's minus 20 to 25 (store_sub, ":father", ":cur_troop", 12), (troop_set_slot, ":cur_troop", slot_troop_father, ":father"), (troop_get_slot, ":mother", ":father", slot_troop_spouse), (troop_set_slot, ":cur_troop", slot_troop_mother, ":mother"), (troop_get_slot, ":father_age", ":father", slot_troop_age), (store_sub, ":age", ":father_age", ":father_age_at_birth"), (try_begin), #50% chance of having father's rep (store_random_in_range, ":reputation", 0, 16), (gt, ":reputation", 7), (troop_get_slot, ":reputation", ":father", slot_lord_reputation_type), (try_end), (try_end), (try_begin), (eq, ":reputation", 0), (assign, ":reputation", 1), (try_end), (troop_set_slot, ":cur_troop", slot_lord_reputation_type, ":reputation"), (call_script, "script_init_troop_age", ":cur_troop", ":age"), (try_end), (try_begin), (eq, "$cheat_mode", 1), (assign, reg3, "$cheat_mode"), (display_message, "@{!}DEBUG -- Assigned lord reputation and relations"), # (display_message, "str_assigned_lord_reputation_and_relations_cheat_mode_reg3"), #This string can be removed (try_end), (try_for_range, ":cur_troop", pretenders_begin, pretenders_end), (troop_set_slot, ":cur_troop", slot_troop_occupation, slto_inactive_pretender), (store_random_in_range, ":age", 25, 30), #(troop_set_slot, ":cur_troop", slot_troop_age, ":age"), (try_begin), (eq, ":cur_troop", "trp_kingdom_5_pretender"), (assign, ":age", 45), (try_end), (call_script, "script_init_troop_age", ":cur_troop", ":age"), (try_end), ]),
from module_skills import skills
def get_skill_strings():
skill_strings = []
for i_skill in xrange(len(skills)):
skill_strings.append(("skl_"+skills[i_skill][0], skills[i_skill][1]))
return skill_strings[:]
strings = [
.............
] + get_skill_strings()
(store_add, ":str_pointer", ":skill", "str_skl_trade"),
(str_store_string, s1, ":str_pointer"),
This is a code submission only thread. Please put your questions in the Forge.ThaneWulfgharn said:Can someone help me with to script smth like when the player or a NPC Lord has itm_ballista in his inventory spr_ballista spawns in the starting position of his army and a troop(enemy or allied army) or the player(when the player is commander of his side's host) command the army.
Read the Module System Documentation. You need to run the build_module compiler to turn it to .txt files. And use the main The Forge board, specifically the stickied Q&A thread, for questions...as the post immediately above your own states.NewBie-BR said:I really don't understand, after i edit file .py in Module System Folder, what will i do next to make it work in my mod?
Yes. I did that. But when i click it said that "impossible find C:/M&B WB/Modules/Mymod/Module_system 1.143/*.pycCaba`drin said:Read the Module System Documentation. You need to run the build_module compiler to turn it to .txt files. And use the main The Forge board, specifically the stickied Q&A thread, for questions...as the post immediately above your own states.NewBie-BR said:I really don't understand, after i edit file .py in Module System Folder, what will i do next to make it work in my mod?
use the main The Forge board, specifically the stickied Q&A thread, for questions...as the post immediately above your own states.
# Some scene prop that you will use as teleporter - this one doesn't actually exist so replace with yours!
("weird_postament", spr_use_time(1), "weird_postament_mesh", "bo_weird_postament", [
(ti_on_scene_prop_start_use, [
(store_trigger_param_1, ":agent_id"),
(store_trigger_param_2, ":prop_instance_id"),
(call_script, "script_activate_teleporter", ":agent_id", ":prop_instance_id"),
]),
]),
# script_activate_teleporter:
# This script is called when a teleporter object is activated on the scene.
# It will use teleporter's first variation-no to determine what entry point to teleport agent to.
# INPUT: arg1 = agent_id, arg2 = prop_instance_id
# OUTPUT: none
("activate_teleporter", [
(store_script_param_1, ":agent_id"),
(store_script_param_2, ":prop_instance_id"),
(prop_instance_get_variation_id, ":variation_id", ":prop_instance_id"),
(try_begin),
(gt, ":variation_id", 0), # Value 0 means deactivated teleporter
(lt, ":variation_id", 64), # Any reasonable upper limit
(entry_point_get_position, pos60, ":variation_id"),
(agent_set_position, ":agent_id", pos60),
# FOR EXTRA BELLS AND WHISTLES:
# 1. SPECIAL EFFECTS CAN BE ADDED AT THE POINTS OF DEPARTURE AND ARRIVAL
# 2. TELEPORTER MAY BE TEMPORARILY DEACTIVATED AFTER USAGE
(try_end),
]),
###################################################################################################
# Prisoner Talk - Originally written by Leprechaun, majorly overhauled & extended by Mordachai
###################################################################################################
# this is a dummy dialog - it sets up the globals we need
[anyone|plyr, "prisoner_chat", [
(store_conversation_troop,"$g_talk_troop"),
(store_troop_faction,"$g_talk_troop_faction","$g_talk_troop"),
(store_relation, "$g_talk_troop_faction_relation", "$g_talk_troop_faction", "fac_player_faction"),
(call_script, "script_troop_get_player_relation", "$g_talk_troop"),
(assign, "$g_talk_troop_relation", reg0),
(eq, 1, 0)
], "", "close_window", []],
# the following is intended to catch when you free up space for a prisoner that already agreed to join you
[anyone|plyr, "prisoner_chat", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 1),(troops_can_join, 1)], "All right, I have made room for you.", "prisoner_chat_accept_confirm", []],
[anyone, "prisoner_chat_accept_confirm", [], "I am at your command, my {lord/lady}.", "prisoner_chat_accept3", []],
# and we catch the case where you still don't have any room for a pending conscripted prisoner
[anyone|plyr, "prisoner_chat", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 1),(neg|troops_can_join, 1)], "I am sorry, I still have no room for you. You'll have to wait a while longer.", "close_window",[]],
# default entry (no prior join agreement, or they've previously refused)
[anyone|plyr, "prisoner_chat", [(neg|troop_slot_eq, "$g_talk_troop", slot_troop_occupation, slto_kingdom_hero)], "You there!", "prisoner_chat_commoner", []],
[anyone|plyr, "prisoner_chat", [(troop_slot_eq, "$g_talk_troop", slot_troop_occupation, slto_kingdom_hero),(str_store_troop_name, s1, "$g_talk_troop")], "{s1}", "prisoner_chat_lord", []],
# reaction to you based on noble or low-birth
[anyone, "prisoner_chat_commoner", [], "Me?! (Gulp!)", "prisoner_chat_menu",[]],
[anyone, "prisoner_chat_lord", [(str_store_troop_name, s1, "trp_player")], "Yes, {Lord/Lady} {s1}?", "prisoner_chat_noble",[]],
# nobles chat begin
[anyone|plyr,"prisoner_chat_noble", [], "You are free to go.", "prisoner_chat_noble_prerelease",[]],
[anyone|plyr,"prisoner_chat_noble", [], "You will remain my prisoner.", "prisoner_chat_noble_prekeep",[]],
[anyone|plyr,"prisoner_chat_noble", [(gt, "$players_kingdom", 0)], "You have committed high treason!", "prisoner_chat_treason",[]],
[anyone|plyr,"prisoner_chat_noble_prerelease", [], "Despite what you may have heard, I am a {man/woman} of honor. You are free to go.", "prisoner_chat_noble_release", []],
[anyone, "prisoner_chat_noble_release", [], "I will not forget this act of Chivalry!", "close_window",
[
# remove the troop from prison
(call_script, "script_remove_troop_from_prison", "$g_talk_troop"),
(party_remove_prisoners, "p_main_party", "$g_talk_troop", 1),
# determine how much honor and faction relation change this prisoner is worth
(try_begin),
# king
(faction_slot_eq, "$g_talk_troop_faction", slot_faction_leader, "$g_talk_troop"),
(assign, ":honor", 5),
(assign, ":fac_reln", 15),
(else_try),
# other lord
(assign, ":honor", 2),
(assign, ":fac_reln", 5),
(try_end),
# give the player their honor, faction relation, and lord relation change
(call_script, "script_change_player_relation_with_troop", "$g_talk_troop", 10),
(call_script, "script_change_player_honor", ":honor"),
(call_script, "script_change_player_relation_with_faction", "$g_talk_troop_faction", ":fac_reln" ),
]],
[anyone|plyr,"prisoner_chat_noble_prekeep", [], "You will understand if I keep you hostage until your family can afford to... compensate me for certain expenses and hardships I have endured to keep you fed and ...safe... these past weeks.", "prisoner_chat_noble_keep",[]],
[anyone, "prisoner_chat_noble_keep", [(ge, "$player_honor", 10),(ge, "$g_talk_troop_relation", 0)], "Truly, this is beneath you.", "close_window",[]],
[anyone, "prisoner_chat_noble_keep", [], "And I trust you will be as understanding when I hunt you down like the dog you are!", "close_window",[(call_script, "script_change_player_relation_with_troop", "$g_talk_troop", -1)]],
# commoners chat begin
[anyone|plyr,"prisoner_chat_menu", [], "Hmmm... perhaps you're not as stupid as the rest of those rabble.", "prisoner_chat_offer",[]],
[anyone|plyr,"prisoner_chat_menu", [], "As wretched as you are, I cannot help but feel sorry for you.", "prisoner_chat_release",[]],
[anyone|plyr,"prisoner_chat_menu", [], "The sight of you makes me sick! You.. Die.. Now!", "prisoner_chat_die1",[]],
[anyone|plyr,"prisoner_chat_menu", [], "Get back in line, Scum!", "close_window",[]],
[anyone|plyr,"prisoner_chat_release", [], "I'm feeling magnanimous today. Begone, before I change my mind!", "prisoner_chat_release2", []],
[anyone, "prisoner_chat_release2", [], "Oh, thank you, {sir/madam}. Blessings on you!", "close_window",
[(remove_troops_from_prisoners, "$g_talk_troop", 1),(call_script, "script_change_player_honor", 1)]],
[anyone|plyr,"prisoner_chat_offer", [], "Listen, scum, you have one last chance to redeem yourself before I sell you to the slave-traders. "\
"Drop all your previous allegiances and swear fealty to me, obey my every order to the letter, and you'll be paid, fed and equipped. "\
"If you don't....well, let's just say that life as a slave will be seemingly unending years of agony, malnutrition and beatings. "\
"I'd advise you to think very, very carefully before choosing. ", "prisoner_chat_reaction",
[(call_script, "script_determine_prisoner_agreed", "$g_talk_troop", "$g_talk_troop_faction_relation")]],
[anyone, "prisoner_chat_reaction", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 1)], "Thank you for your mercy, {sir/madam}. I swear on my mothers grave I will serve you, my {lord/lady}!","prisoner_chat_accept1",[]],
[anyone, "prisoner_chat_reaction", [], "I'll show you what I think of your offer! (The prisoner spits at your feet) There. Now get lost, I'm not interested.", "prisoner_chat_refuse",[]],
[anyone|plyr,"prisoner_chat_refuse", [], "I see...", "prisoner_chat_menu",[]],
[anyone|plyr,"prisoner_chat_die1", [], "(You advance on the prisoner...)", "prisoner_chat_die2",[]],
[anyone, "prisoner_chat_die2", [], "Please, {sir/madam}, don't kill me. I am a defenceless prisoner. Surely you're not that cruel?", "prisoner_chat_die3",[]],
[anyone|plyr,"prisoner_chat_die3", [], "(Kill the prisoner)", "prisoner_chat_die4",[]],
[anyone|plyr,"prisoner_chat_die3", [], "No, I will not sink that low.", "close_window",[]],
[anyone|plyr,"prisoner_chat_die4", [], "(The prisoner struggles against his shackles, desperate to free himself and escape you, but to no avail. You slit their throat with a knife and watch, satisfied, as his corpse sags to the floor.)", "close_window",
[(remove_troops_from_prisoners, "$g_talk_troop", 1),
(call_script, "script_change_player_honor", -1)]],
[anyone|plyr, "prisoner_chat_accept1", [], "If you so much as fail to tremble on my command, I will have you severely disciplined!", "prisoner_chat_accept2",[]],
[anyone|plyr, "prisoner_chat_accept1", [], "In my camp we are all treated as equals. I expect your obedience, but also your trust.", "prisoner_chat_accept2",[]],
[anyone, "prisoner_chat_accept2", [], "I will obey your wishes, my {lord/lady}. I swear!", "prisoner_chat_accept3",[]],
[anyone|plyr, "prisoner_chat_accept3", [(neg|troops_can_join, 1)], "Oh! Apparently there isn't enough room for you in my party. I will be back when I have made space.", "close_window", []],
[anyone|plyr, "prisoner_chat_accept3", [(troops_can_join, 1)], "Excellent. Report to the quartermaster for provisions and equiment. There is hard fighting ahead.", "close_window",
[(troop_set_slot, "$g_talk_troop", slot_prisoner_agreed, 0),
(remove_troops_from_prisoners, "$g_talk_troop",1),
(party_add_members, "p_main_party", "$g_talk_troop", 1),
(call_script, "script_change_troop_renown", "trp_player", 1),]],
[anyone|plyr, "prisoner_chat_treason", [(str_store_troop_name, s1, "$g_talk_troop"), (str_store_faction_name, s2, "$players_kingdom")],
"{s1}, you have committed cimes against the {s2}, for which you will now stand trial.^How plead you?", "prisoner_chat_treason_plead",
[
# determine the noble's reaction to this accusation
(store_random_in_range, reg0, 1, 5),#bug: must set upper number one higher to actually generate correct range
#TODO: weight the reaction according to the renown? Or at least according to king or not...
(troop_set_slot, "$g_talk_troop", slot_prisoner_agreed, reg0),
]
],
[anyone, "prisoner_chat_treason_plead", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 1),],
"Please have mercy upon my soul. All I have done, I have done in the name of my King and Country! I am but a patriot, as you, and I deserve your respect, if nothing else.", "prisoner_chat_treason_choose", []],
[anyone, "prisoner_chat_treason_plead", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 2),],
"You are gravely mistaken! I am an honorable Lord, and I have done nothing that you would not do were our roles exchanged.", "prisoner_chat_treason_choose", []],
[anyone, "prisoner_chat_treason_plead", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 3),],
"I spit on you and yours! You are but a cur come to put on airs, as though you were Noble and had any right whatsoever to judge me! Me! You are a nothing but a common brigand and a coward! I do not bow to you. You should drop to your knees and beg *my* forgiveness!", "prisoner_chat_treason_choose", []],
[anyone, "prisoner_chat_treason_plead", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 4),],
"You dare accuse me?! You sniveling whelpling! I should see you flogged and put in chains in one of my prisons for your insolence!", "prisoner_chat_treason_choose", []],
[anyone|plyr, "prisoner_chat_treason_choose", [], "I am a {man/woman} of honor. I shall spare your life this day!", "prisoner_chat_treason_not_guilty",
[
#TODO: have the relation with the prison have a mixed (random) result - relief, anger, etc, which dictates their final monologue to the player before exiting the dialog
# make sure we don't try to recruit this prisoner later!
(troop_set_slot, "$g_talk_troop", slot_prisoner_agreed, 0),
]
],
[anyone, "prisoner_chat_treason_not_guilty", [(str_store_troop_name, s1, "trp_player")], "There is yet hope for you, {s1}.", "close_window", []],
[anyone|plyr, "prisoner_chat_treason_choose", [], "You do not deserve leiniency. You must pay for your crimes with your life.", "prisoner_chat_treason_guilty", []],
[anyone|plyr, "prisoner_chat_treason_guilty", [], "For your many crimes against {s1}, I hereby sentence you to death, to be carried out immediately. Have you any final words to say?", "prisoner_chat_treason_final_words",
[(store_random_in_range, reg0, 1, 6), (troop_set_slot, "$g_talk_troop", slot_prisoner_agreed, reg0)]],
[anyone, "prisoner_chat_treason_final_words", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 1)], "I believe you will one day come to regret your actions. There is only one who is worthy to decide another's fate... and that one is not you.", "prisoner_chat_treason_execute", []],
[anyone, "prisoner_chat_treason_final_words", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 2)], "You are a coward and a dog! May your soul rot eternal, damn you!", "prisoner_chat_treason_execute", []],
[anyone, "prisoner_chat_treason_final_words", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 3)], "Winter's mortality,^locked in frozen indifference,^melts with Spring's rebirth.", "prisoner_chat_treason_execute", []],
[anyone, "prisoner_chat_treason_final_words", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 4)], "You will find no peace on this earth! I shall haunt thee eternal! Unto death you will find nothing but unhappiness and fear. And beyond... only torture and pain!", "prisoner_chat_treason_execute", []],
[anyone, "prisoner_chat_treason_final_words", [(troop_slot_eq, "$g_talk_troop", slot_prisoner_agreed, 5)], "Who are you?^A day passes^We are but children", "prisoner_chat_treason_execute", []],
[anyone|plyr, "prisoner_chat_treason_execute", [],
"(The prisoner struggles against his shackles, desperate to free himself and escape you, but to no avail. You slit his throat and watch, satisfied, as his corpse sags to the floor.)",
"close_window",
[
# attempt to allow the player to see the consequences of their actions
#(set_show_messages, 1), # this not only fails - but messages are hereafter disabled in the main game...
# make sure we don't try to recruit this prisoner stack later!
(troop_set_slot, "$g_talk_troop", slot_prisoner_agreed, 0),
# "kill" the NPC - force the 48 hr respawn kingdom heros trigger to ignore this troop (no party will be created for this troop, ever again)
# [q.v. script_create_kingdom_hero_party]
(troop_set_slot, "$g_talk_troop", slot_troop_occupation, slto_dead),
# remove them from their faction
(troop_set_slot, "$g_talk_troop", slot_troop_change_to_faction, "fac_no_faction"),
(troop_set_slot, "$g_talk_troop", slot_troop_original_faction, "fac_no_faction"),
# determine the penalty for this act (based on the honor of the troop they've killed)
(troop_get_slot, ":impact", "$g_talk_troop", slot_troop_renown),
(val_div, ":impact", -33),
(store_div, ":half", ":impact", 2),
# reduce the player's relationship with every village, town, and castle
(try_for_range, ":center", centers_begin, centers_end),
(store_faction_of_party, ":faction", ":center"),
(store_relation, ":relation", ":faction", "$g_talk_troop_faction"),
(try_begin),
(le, ":relation", -10),
# enemies, half impact
(call_script, "script_change_player_relation_with_center", ":center", ":half"),
(else_try),
# not at war, full impact
(call_script, "script_change_player_relation_with_center", ":center", ":impact"),
(try_end),
(try_end),
# reduce the player's relationship with every hero, companion, lady, and daughter
(try_for_range, ":troop", trp_npc1, trp_heroes_end),
# don't make the dead any angrier than they already are!
(neg|troop_slot_eq, ":troop", slot_troop_occupation, slto_dead),
(store_troop_faction, ":faction", ":troop"),
(store_relation, ":relation", ":faction", "$g_talk_troop_faction"),
(try_begin),
(le, ":relation", -10),
# enemies, half impact
(call_script, "script_change_player_relation_with_troop", ":troop", ":half"),
(else_try),
# not at war, full impact
(call_script, "script_change_player_relation_with_troop", ":troop", ":impact"),
(try_end),
(try_end),
# reduce the player's relationship with every faction (enemies 1/2 as much)
(try_for_range, ":faction", kingdoms_begin, kingdoms_end),
(store_relation, ":relation", ":faction", "$g_talk_troop_faction"),
(try_begin),
(le, ":relation", -10),
# enemies, half impact
(call_script, "script_change_player_relation_with_faction", ":faction", ":half"),
(else_try),
# not at war, full impact
(call_script, "script_change_player_relation_with_faction", ":faction", ":impact"),
(try_end),
(try_end),
# apply the honor hit
(call_script, "script_change_player_honor", ":impact"),
# party morale takes a hit as well
(call_script, "script_change_player_party_morale", ":half"),
# but give them renown for this evil deed (their deed spreads upon every tongue, impressing some, and cowing others)
(val_mul, ":impact", -1),
(call_script, "script_change_troop_renown", "trp_player" , ":impact"),
# start with the assumption that the fief should return to its faction for redistribution
(assign, ":fief_faction", "$g_talk_troop_faction"),
(try_begin),
# handle executing the King!
(faction_slot_eq, "$g_talk_troop_faction", slot_faction_leader, "$g_talk_troop"),
# find best candidate to become king
(assign, ":best_troop", -1),
(assign, ":best_renown", -1),
(try_for_range, ":troop", trp_kingdom_heroes_including_player_begin, trp_knight_6_20),
(neg|troop_slot_eq, ":troop", slot_troop_occupation, slto_dead), #can't choose a dead hero!
(store_troop_faction, ":faction", ":troop"),
(eq, ":faction", "$g_talk_troop_faction"),
(troop_slot_eq, ":troop", slot_troop_occupation, slto_kingdom_hero), #only other heros of this faction may become the king
(troop_get_slot, ":renown", ":troop", slot_troop_renown),
(gt, ":renown", ":best_renown"),
(assign, ":best_troop", ":troop"),
(assign, ":best_renown", ":renown"),
(try_end),
(try_begin),
# check if a candidate was found
(neq, ":best_troop", -1),
# make them king
(faction_set_slot, "$g_talk_troop_faction", slot_faction_leader, ":best_troop"),
# announce it!
#TODO: generate a presentation for this! (start_presentation, "prsnt_enemy_succession"),
(str_store_troop_name, s1, ":best_troop"),
(str_store_faction_name, s2, "$g_talk_troop_faction"),
(display_message, "@{s1} is the new King of the {s2}!!!", 0xFFFF2222),
#TODO: update the game log for this event
(else_try),
# all of the lords have been eliminated - so eliminate the faction by making their last fief neutral (q.v. trigger: # Check if a faction is defeated every day)
(assign, ":fief_faction", "fac_no_faction"),
(try_end),
(try_end),
# free up the deceased's fief
(try_for_range, ":fief", centers_begin, centers_end),
(party_get_slot, ":lord", ":fief", slot_town_lord),
(eq, ":lord", "$g_talk_troop"),
(call_script, "script_give_center_to_faction", ":fief", ":fief_faction"),
(try_end),
# no longer our prisoner
(call_script, "script_remove_troop_from_prison", "$g_talk_troop"),
(remove_troops_from_prisoners, "$g_talk_troop", 1),
]
],
###################################################################################################
# End Prisoner Talk
###################################################################################################
####Mordechai EPC Begin
slto_dead = 146
slot_prisoner_agreed = 147
####Mordechai EPC End
#MORDACHAI - update whether the specified prisoner would like to join the player's party
# script_determine_prisoner_agreed
# Input: arg1 = troop, arg2 = troop faction relation
# Output: slot_prisoner_agreed is set to 1 if they agreed, or 0 if not
# reg0 = agreed or not
("determine_prisoner_agreed",
[
(store_script_param, ":troop", 1),
(store_script_param, ":relation", 2),
# upper bound = Persuasion*3 + Charisma + Leadership*3 + Honor/2 + Renown/100
(store_attribute_level, ":charisma", "trp_player", ca_charisma),
(store_skill_level, ":persuasion", "skl_persuasion", "trp_player"),
(store_skill_level, ":leadership", "skl_leadership", "trp_player"),
(val_mul, ":persuasion", 3),
(val_mul, ":leadership", 3),
(store_div, ":half_honor", "$player_honor", 2),
(troop_get_slot, ":renown_factor", slot_troop_renown),
(val_div, ":renown_factor", 100),
(assign, ":upper_bound", ":persuasion"),
(val_add, ":upper_bound", ":leadership"),
(val_add, ":upper_bound", ":charisma"),
(val_add, ":upper_bound", ":half_honor"),
(val_add, ":upper_bound", ":renown_factor"),
(val_min, ":relation", ":upper_bound"),
# determine their reaction (relation...upper_bound)
(store_random_in_range, ":reaction", ":relation", ":upper_bound"),
(assign, reg1, ":reaction"),
(assign, reg2, ":relation"),
(assign, reg3, ":upper_bound"),
#(display_message, "@Prisoner Agrees Check: rolled a {reg1} out of a possible {reg2}-{reg3}"),#diagnostic only
# record whether they agree or not
(try_begin),
(ge, ":reaction", 0),
(troop_set_slot, ":troop", slot_prisoner_agreed, 1),
(else_try),
(troop_set_slot, ":troop", slot_prisoner_agreed, 0),
(try_end),
# return the results
(troop_get_slot, reg0, ":troop", slot_prisoner_agreed),
#(display_message, "@Prisoner Agrees Check: slot_prisoner_agreed = {reg0?yes:no}"),#diagnostic only
]
),