Hello everyone,
I am noob at moding but with SupaNinjaMan's help, I managed to create personal kill counter in battle. Same as Prophecy of Pendor mod but little uglier. In battle, Kill count displays the amount of troops you killed or wounded.
Update #1: I've made adjustments to the code according to Dj_FRedy's comments.
Update #2: I've made the personal kill count more visible and less ugly. I am sure there is better way to do this but at the moment this is the best I can do.
Update #3: I've made the personal kill count more visible and less ugly. And I've greatly reduced the number of mesh-related garbage scripts.
Screenshot in spoiler
Source code in spoiler,
As I mentioned above I am 99.9% noob at coding and as you already figure that I am not native English speaker but I think all of you understand what I meant.
Feel free to use and modify. (If you actually modify please share your code here so I can learn. )
Cheers,
I am noob at moding but with SupaNinjaMan's help, I managed to create personal kill counter in battle. Same as Prophecy of Pendor mod but little uglier. In battle, Kill count displays the amount of troops you killed or wounded.
Update #1: I've made adjustments to the code according to Dj_FRedy's comments.
Update #3: I've made the personal kill count more visible and less ugly. And I've greatly reduced the number of mesh-related garbage scripts.
Screenshot in spoiler
Source code in spoiler,
Search "(agent_set_slot, ":cur_agent", slot_agent_map_overlay_id, 0)", in module_presentations.py, then insert the line as following:
Paste the following into module_presentations.py:
Search "lead_charge", "village_attack_bandits", "village_raid", "besiege_inner_battle_castle", "castle_attack_walls_defenders_sally", "castle_attack_walls_belfry", "castle_attack_walls_ladder" and "bandit_lair" in module_mission_templates.py and paste "(0, 0, ti_once, [], [(start_presentation, "prsnt_killcount")]), # Personal Kill Count" below of common_battle_order_*. Just as follows:
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),
######################################################################################
### BEGIN + PERSONAL KILL COUNT by Artam
######################################################################################
(start_presentation, "prsnt_killcount"),
######################################################################################
### END - PERSONAL KILL COUNT
######################################################################################
(try_end),
Code:
######################################################################################
### BEGIN + PERSONAL KILL COUNT by Artam
######################################################################################
("killcount",prsntf_read_only,0,[
(ti_on_presentation_load,
[
(assign, "$presentation_killcount"),
(set_fixed_point_multiplier, 1000),
(create_mesh_overlay, "$g_presentation_obj_1", "mesh_white_plane"),
(overlay_set_color, "$g_presentation_obj_1", 0x000000),
(overlay_set_alpha, "$g_presentation_obj_1", 0x80),
(position_set_x, pos1, 4200),
(position_set_y, pos1, 1700),
(overlay_set_size, "$g_presentation_obj_1", pos1),
(position_set_x, pos1, 0),
(position_set_y, pos1, 700),
(overlay_set_position, "$g_presentation_obj_1", pos1),
(create_text_overlay, "$g_presentation_obj_2", s1, tf_with_outline|tf_left_align),
(overlay_set_color, "$g_presentation_obj_2", 0xFFFFFF),
(overlay_set_position, "$g_presentation_obj_2", pos1),
(presentation_set_duration, 999999),
]),
(ti_on_presentation_run,
[
(get_player_agent_no, ":player_agent"),
(agent_get_kill_count, reg1, ":player_agent", 1), #SupaNinjaMan
(agent_get_kill_count, ":kill_count", ":player_agent"), #SupaNinjaMan
(agent_get_kill_count, ":wound_count", ":player_agent", 1), #SupaNinjaMan
(store_add, reg1, ":kill_count", ":wound_count"),
(str_store_string, s1, "@{reg1} kills"),
(overlay_set_text, "$g_presentation_obj_2", s1),
]),
]),
######################################################################################
### END - PERSONAL KILL COUNT
######################################################################################
Code:
common_battle_order_panel,
common_battle_order_panel_tick,
(0, 0, ti_once, [], [(start_presentation, "prsnt_killcount")]), # Personal Kill Count
As I mentioned above I am 99.9% noob at coding and as you already figure that I am not native English speaker but I think all of you understand what I meant.
- I couldn't do this personal kill count thing without help of rubik's troop ratio bar presentation and SupaNinjaMan, I thank them sincerely.
- I thank Dj FRedy for his kind comments and guidance.
Cheers,