Hello everyone,
First, I am really sorry for my English. I will try to explain my problem as clearly as I can.
I'm trying to add personal kill count in battle for my personal mod. So I use"arena_training" code for base in module_presentation.py and merged modified version in troop ratio bar presentation. The problem is that my modified version of personal kill counter only count "enemy knock unconscious by me", not "total casualties inflected by me." (enemy knock unconscious + enemy killed) If that makes any sense.
Please see screenshot below.
As you can see in the screenshot, I killed one looter and knocked unconscious another. But only count knocked unconscious enemy. What I want is both knocked unconscious and killed enemy registered as Kills:
So here is the code I am working.
Thanks in advance for your suggestions.
Kind Regards,
First, I am really sorry for my English. I will try to explain my problem as clearly as I can.
I'm trying to add personal kill count in battle for my personal mod. So I use"arena_training" code for base in module_presentation.py and merged modified version in troop ratio bar presentation. The problem is that my modified version of personal kill counter only count "enemy knock unconscious by me", not "total casualties inflected by me." (enemy knock unconscious + enemy killed) If that makes any sense.
Please see screenshot below.
As you can see in the screenshot, I killed one looter and knocked unconscious another. But only count knocked unconscious enemy. What I want is both knocked unconscious and killed enemy registered as Kills:
So here is the code I am working.
Code:
(try_begin),
(gt, ":cur_time", 200),
(game_key_clicked, gk_view_orders),
(try_for_agents, ":cur_agent"),
(agent_set_slot, ":cur_agent", slot_agent_map_overlay_id, 0),
(try_end),
(presentation_set_duration, 0),
# Start - Troop Ratio Bar, Battle Mini Map & Personal Kill Count
(try_begin),
(this_or_next|eq, "$enable_troop_ratio_bar"),
(this_or_next|eq, "$enable_battle_minimap"),
(eq, "$enable_killcount"),
(start_presentation, "prsnt_troop_ratio_bar"),
(try_end),
# End - Troop Ratio Bar, Battle Mini Map & Personal Kill Count
(try_end),
]),
]),
Code:
## Start - Troop Ratio Bar, Battle Mini Map & Personal Kill Count
("troop_ratio_bar",prsntf_read_only,0,[
(ti_on_presentation_load,
[
(assign, "$presentation_troop_ratio_bar_active", 1),
(set_fixed_point_multiplier, 1000),
(create_mesh_overlay, "$g_presentation_obj_1", "mesh_status_troop_ratio_bar"),
(position_set_x, pos1, -30), # Original value is 30
(position_set_y, pos1, -700),# Original value is 700
(overlay_set_position, "$g_presentation_obj_1", pos1),
(position_set_x, pos1, 393), # Original value is 35
(position_set_y, pos1, 734),# Original value is 713
(create_mesh_overlay, "$g_presentation_obj_2", "mesh_white_plane"),
(overlay_set_color, "$g_presentation_obj_2", 0xAA1F1F),
(overlay_set_position, "$g_presentation_obj_2", pos1),
(create_mesh_overlay, "$g_presentation_obj_3", "mesh_white_plane"),
(overlay_set_color, "$g_presentation_obj_3", 0x1F1FAA),
(overlay_set_position, "$g_presentation_obj_3", pos1),
(create_mesh_overlay, "$g_presentation_obj_4", "mesh_white_plane"),
(overlay_set_color, "$g_presentation_obj_4", 0x1FAA1F),
(overlay_set_position, "$g_presentation_obj_4", pos1),
## WINDYPLAINS+ ## - Add battle map to the troop ratio bar presentation.
(try_begin),
(eq, "$enable_battle_minimap"),
## Clean out battle mini-map overlay ID's.
(try_for_agents, ":agent_no"),
(agent_set_slot, ":agent_no", slot_agent_map_overlay_id, 0),
(try_end),
(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", 150),
(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", 150),
(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),
(try_end),
## WINDYPLAINS- ##
## Start - Add personal kill count to the troop ratio bar presentation.
(try_begin),
(eq, "$enable_killcount"),
(get_player_agent_no, ":player_agent"),
(agent_get_kill_count, reg1, ":player_agent", 1),
(create_text_overlay, "$g_presentation_obj_1", s1),
(overlay_set_color, "$g_presentation_obj_1", 0xFFFFFF),
(position_set_x, pos1, 10),
(position_set_y, pos1, 713),
(overlay_set_position, "$g_presentation_obj_1", pos1),
(assign, reg1, 1),
(try_end),
## End - Add personal kill count to the troop ratio bar presentation.
(presentation_set_duration, 999999),
]),
(ti_on_presentation_run,
[
(store_trigger_param_1, ":cur_time"),
(set_fixed_point_multiplier, 1000),
(assign, ":player_count", 0),
(assign, ":ally_count", 0),
(assign, ":enemy_count", 0),
(assign, ":total_count", 0),
(try_for_agents, ":cur_agent"),
(agent_is_human, ":cur_agent"),
(agent_is_alive, ":cur_agent"),
(agent_get_party_id, ":agent_party", ":cur_agent"),
(try_begin),
(eq, ":agent_party", "p_main_party"),
(val_add, ":player_count", 1),
(else_try),
(agent_is_ally, ":cur_agent"),
(val_add, ":ally_count", 1),
(else_try),
(val_add, ":enemy_count", 1),
(try_end),
(try_end),
(val_add, ":total_count", ":player_count"),
(val_add, ":total_count", ":ally_count"),
(val_add, ":total_count", ":enemy_count"),
(position_set_x, pos1, 12000),
(position_set_y, pos1, 300),
(overlay_set_size, "$g_presentation_obj_2", pos1),
(store_add, ":ally_percent", ":player_count", ":ally_count"),
(val_mul, ":ally_percent", 12000),
(val_div, ":ally_percent", ":total_count"),
(position_set_x, pos1, ":ally_percent"),
(position_set_y, pos1, 300),
(overlay_set_size, "$g_presentation_obj_3", pos1),
(store_mul, ":player_percent", ":player_count", 12000),
(val_div, ":player_percent", ":total_count"),
(position_set_x, pos1, ":player_percent"),
(position_set_y, pos1, 300),
(overlay_set_size, "$g_presentation_obj_4", pos1),
(store_add, ":ally_percent_2", ":player_count", ":ally_count"),
(val_mul, ":ally_percent_2", 240),
(val_div, ":ally_percent_2", ":total_count"),
(val_add, ":ally_percent_2", 35),
(position_set_x, pos1, ":ally_percent_2"),
(position_set_y, pos1, 700),
(store_mul, ":player_percent_2", ":player_count", 240),
(val_div, ":player_percent_2", ":total_count"),
(val_add, ":player_percent_2", 35),
(position_set_x, pos1, ":player_percent_2"),
(position_set_y, pos1, 700),
## BATTLE MAP
(try_begin),
(eq, "$enable_battle_minimap"),
(get_scene_boundaries, pos2, pos3),
(try_for_agents,":cur_agent"),
(agent_is_human, ":cur_agent"),
(agent_get_party_id, ":agent_party", ":cur_agent"),
(agent_get_slot, ":agent_overlay", ":cur_agent", slot_agent_map_overlay_id),
(try_begin),
(eq, ":agent_party", "p_main_party"),
(try_begin),
(agent_is_alive, ":cur_agent"),
(call_script, "script_update_agent_position_on_map", ":cur_agent"),
(else_try),
### WINDYPLAINS+ ### - Done to prevent object #0 agents erasing object #0 (troop ratio bar background)
(neq, ":agent_overlay", 0),
### WINDYPLAINS- ###
(overlay_set_alpha, ":agent_overlay", 0),
(try_end),
(else_try),
(agent_is_ally, ":cur_agent"),
(try_begin),
(agent_is_alive, ":cur_agent"),
(call_script, "script_update_agent_position_on_map", ":cur_agent"),
(else_try),
### WINDYPLAINS+ ### - Done to prevent object #0 agents erasing object #0 (troop ratio bar background)
(neq, ":agent_overlay", 0),
### WINDYPLAINS- ###
(overlay_set_alpha, ":agent_overlay", 0),
(try_end),
(else_try),
(try_begin),
(agent_is_alive, ":cur_agent"),
(call_script, "script_update_agent_position_on_map", ":cur_agent"),
(else_try),
### WINDYPLAINS+ ### - Done to prevent object #0 agents erasing object #0 (troop ratio bar background)
(neq, ":agent_overlay", 0),
### WINDYPLAINS- ###
(overlay_set_alpha, ":agent_overlay", 0),
(try_end),
(try_end),
(try_end),
(try_end),
## PERSONAL KILL COUNT
(try_begin),
(eq, "$enable_killcount"),
(get_player_agent_no, ":player_agent"),
(agent_get_kill_count, reg1, ":player_agent", 1),
(str_store_string, s1, "@Kills: {reg1}"),
(overlay_set_text, "$g_presentation_obj_1", s1),
(try_end),
## PERSONAL KILL COUNT
(try_begin),
(eq, "$presentation_troop_ratio_bar_active", 1),
(gt, ":cur_time", 200),
(game_key_clicked, gk_view_orders),
(assign, "$presentation_troop_ratio_bar_active", 0),
(presentation_set_duration, 0),
(start_presentation, "prsnt_battle"),
(try_end),
]),
]),
## End - Troop Ratio Bar, Battle Mini Map & Personal Kill Count
Code:
common_battle_order_panel,
common_battle_order_panel_tick,
(0, 0, ti_once, [], [(start_presentation, "prsnt_troop_ratio_bar")]), # Troop Ratio Bar
],
Thanks in advance for your suggestions.
Kind Regards,