OSP Code MP Kill Assist System

Users who are viewing this thread

minnakodunum

Knight at Arms
Dont'use this code in a mission template which has instant respawn (deathmatch, tdm..).

Because when an agent respawns, it automatically gets a new  agent_id, and if he assisted some kills, assister will be another player or bot which uses his old agent_id.
This wont happen with no respawn mods, because if agent dies his agent_id will remain until round ends.


Step 1:
common_asist_system_1 =   (ti_on_agent_hit, 0, 0, [],
  [
  (store_trigger_param_1, ":agent_damaged"),
  (store_trigger_param_2, ":dealer_agent"),
  (store_trigger_param_3, ":damage"),
 
  (agent_is_human, ":agent_damaged"),
  (agent_is_human, ":dealer_agent"),
  (agent_is_active, ":agent_damaged"),
  (agent_is_active, ":dealer_agent"),
 
 
  (assign, ":begin", "trp_find_item_cheat"),
 
  (val_add, ":agent_damaged", ":begin"),
  (troop_get_inventory_slot, ":damage_ex", ":agent_damaged", ":dealer_agent"),
  (ge, ":damage", 0),
  (val_add, ":damage", ":damage_ex"),
  (troop_set_inventory_slot, ":agent_damaged", ":dealer_agent", ":damage"), #This saves, agent_damaged into a troop id.
                                                                                                              #Dealer_agent into an inventory slot number of the "agent_damaged" troop id. And damage is the value of the slot.

  (val_sub, ":agent_damaged", ":begin"),
 
  # (assign, reg1, ":damage1"),
 
  # (agent_get_troop_id, ":dealer_troop", ":dealer_agent"),
  # (str_store_troop_name, s1, ":dealer_troop"),
  # (assign, reg2, ":dealer_agent"),
 
  # (agent_get_troop_id, ":troop_damaged", ":agent_damaged"),
  # (str_store_troop_name, s2, ":troop_damaged"),
  # (assign, reg3, ":agent_damaged"),
  # (display_message, "@ {s1}({reg2}) has dealt {reg1} total damage to {s2}({reg3})"),
################
  ])
common_asist_system_2 = (ti_before_mission_start, 0,0, [],
[
(assign, ":limit", 150),
(val_add, ":limit", 1),
(assign, ":begin", "trp_find_item_cheat"),
(val_add, ":limit", ":begin"),
(try_for_range, ":trp", ":begin", ":limit"),
# (troop_get_inventory_capacity, ":capacity", ":trp"),
(assign, ":capacity", 150),
(val_add, ":capacity", 1),
(try_for_range, ":inv", 0,  ":capacity"),
(troop_set_inventory_slot, ":trp", ":inv",  0),
(try_end),
(try_end),
])
common_asist_system_3 =      (ti_on_agent_killed_or_wounded, 0, 0, [],
      [
  (this_or_next|multiplayer_is_server),
  (multiplayer_is_dedicated_server),
    (store_trigger_param_1, ":dead_agent_no"),
    (store_trigger_param_2, ":killer_agent_no"),

(agent_is_human, ":dead_agent_no"),
(agent_is_human, ":killer_agent_no"),
(gt, ":dead_agent_no", 0),
(gt, ":killer_agent_no", 0),
 
(assign, ":begin", "trp_find_item_cheat"),

(store_add, ":cur_troop", ":dead_agent_no", ":begin"),
# (store_free_inventory_capacity, ":capacity", ":cur_troop"),
(assign, ":capacity", 150),
(val_add, ":capacity", 1),

(assign, reg1, ":capacity"),
(assign, reg2, ":killer_agent_no"),
(assign, reg3, ":dead_agent_no"),

# (display_message, "@ Capacity: {reg1}, Killer Agent No: {reg2}, Dead Agent No: {reg3}"),

(try_for_range, ":agent", 0, ":capacity"),
(troop_get_inventory_slot, ":damage", ":cur_troop", ":agent"),

(try_begin),
(ge, ":damage", 20),
(neq, ":killer_agent_no", ":agent"),
(troop_set_inventory_slot, ":cur_troop", ":agent", 0),
(try_begin),
(agent_is_non_player, ":agent"),
(assign, reg1, ":agent"),
(str_store_string, s1, "@AGENT"),
(display_message, "@{s1} {reg1} HAS ASSISTED!"),

(try_begin),
(neg|agent_is_non_player, ":killer_agent_no"),
(agent_get_player_id, ":killer_player", ":killer_agent_no"),
(str_store_player_username, s2, ":killer_player"),
(else_try),
(agent_get_troop_id, ":killer_troop", ":killer_agent_no"),
(str_store_troop_name, s2, ":killer_troop"),
(try_end),

(try_begin),
(neg|agent_is_non_player, ":dead_agent_no"),
(agent_get_player_id, ":dead_player", ":dead_agent_no"),
(str_store_player_username, s3, ":dead_player"),
(else_try),
(agent_get_troop_id, ":dead_troop", ":dead_agent_no"),
(str_store_troop_name, s3, ":dead_troop"),
(try_end),

(else_try),
(agent_get_player_id, ":player_id", ":agent"),
(str_store_player_username, s1, ":player_id"),
(assign, reg1, ":player_id"),

(try_begin),
(neg|agent_is_non_player, ":killer_agent_no"),
(agent_get_player_id, ":killer_player", ":killer_agent_no"),
(str_store_player_username, s2, ":killer_player"),
(else_try),
(agent_get_troop_id, ":killer_troop", ":killer_agent_no"),
(str_store_troop_name, s2, ":killer_troop"),
(try_end),

(try_begin),
(neg|agent_is_non_player, ":dead_agent_no"),
(agent_get_player_id, ":dead_player", ":dead_agent_no"),
(str_store_player_username, s3, ":dead_player"),
(else_try),
(agent_get_troop_id, ":dead_troop", ":dead_agent_no"),
(str_store_troop_name, s3, ":dead_troop"),
(try_end),
(player_get_score, ":score", ":player_id"),
(val_add, ":score", 1),
(player_set_score, ":player_id", ":score"),
(try_end),
(str_store_string, s0, "@{s1} [Player: {reg1}] HAS ASSISTED {s2} by KILLING {s3}!"),####
(get_max_players, ":max_players"),                    ####
(val_add, ":max_players", 1),              #### These lines are optional. If you want the assist message shown in log, dont remove these lines.
(try_for_range, ":cur_player", 1, ":max_players"),          ####If you dont want to assist message shown in log, just remove this lines. And you can skip step 2.
(player_is_active, ":cur_player"),                      ####
(multiplayer_send_string_to_player, ":cur_player", event_show_message, s0),              ####
(try_end),
(else_try),
(troop_set_inventory_slot, ":cur_troop", ":agent", 0),
(try_end),

(try_end),
        ])

Step 2:
Code:
event_show_message                                            = 113

Step 3:
Exchange this with the original "multiplayer_stats_chart".  (I made only a few changes on it. But really don't remember what did I changed. This is a really old work :grin: ). This makes score seen on the stats chart. Kills:2 points Assists: 1 points.
Code:
  ("multiplayer_stats_chart", prsntf_read_only|prsntf_manual_end_only, 0, [
    (ti_on_presentation_load,
     [(set_fixed_point_multiplier, 1000),

      (create_mesh_overlay, reg0, "mesh_mp_score_b"),
      (position_set_x, pos1, 100),
      (position_set_y, pos1, 105),
      (overlay_set_position, reg0, pos1),
      (position_set_x, pos1, 1000),
      (position_set_y, pos1, 1000),
      (overlay_set_size, reg0, pos1),

      (assign, ":team_1_rows", 0),
      (assign, ":team_2_rows", 0),
      (assign, ":spectator_rows", 0),
      (get_max_players, ":num_players"),
      (try_for_range, ":player_no", 0, ":num_players"),
        (store_add, ":slot_index", ":player_no", multi_data_player_index_list_begin),
        (try_begin),
          (player_is_active, ":player_no"),
          (troop_set_slot, "trp_multiplayer_data", ":slot_index", 1),
          (player_get_team_no, ":player_team", ":player_no"),
          (try_begin),
            (eq, ":player_team", 0),
            (val_add, ":team_1_rows", 1),
          (else_try),
            (eq, ":player_team", 1),
            (val_add, ":team_2_rows", 1),
          (else_try),
            (eq, ":player_team", multi_team_spectator),
            (val_add, ":spectator_rows", 1),
          (try_end),
        (else_try),
          (troop_set_slot, "trp_multiplayer_data", ":slot_index", 0),
        (try_end),
      (try_end),
      (try_begin),
        (gt, "$g_multiplayer_num_bots_team_1", 0),
        (val_add, ":team_1_rows", 1),
      (try_end),
      (try_begin),
        (gt, "$g_multiplayer_num_bots_team_2", 0),
        (val_add, ":team_2_rows", 1),
      (try_end),

      (assign, ":total_rows", ":team_1_rows"),
      (val_max, ":total_rows", ":team_2_rows"),
      (val_add, ":total_rows", ":spectator_rows"),

      (str_clear, s0),
      (create_text_overlay, "$g_presentation_obj_stats_chart_container", s0, tf_scrollable_style_2),
      (position_set_x, pos1, 100),
      (position_set_y, pos1, 120),#120
      (overlay_set_position, "$g_presentation_obj_stats_chart_container", pos1),
      (position_set_x, pos1, 746),
      (position_set_y, pos1, 530),#530
      (overlay_set_area_size, "$g_presentation_obj_stats_chart_container", pos1),
      (set_container_overlay, "$g_presentation_obj_stats_chart_container"),

      (store_mul, ":y_needed", ":total_rows", 20),
      (val_add, ":y_needed", 100),
      (try_begin),
        (gt, ":spectator_rows", 0),
        (val_add, ":y_needed", 70),
      (try_end),

      (multiplayer_get_my_player, ":my_player_no"),       

      (try_begin),
        (gt, ":y_needed", 490),
        (assign, "$g_stats_chart_update_period", 8),
      (else_try),
        (assign, "$g_stats_chart_update_period", 1),
      (try_end),

      (try_begin), #counting number of flags each team has.
        (eq, "$g_multiplayer_game_type", multiplayer_game_type_headquarters),
        (call_script, "script_get_headquarters_scores"),
        (assign, ":team_1_num_flags", reg0),
        (assign, ":team_2_num_flags", reg1),
      (try_end),

      #assuming only 2 teams in scene
      (try_for_range, ":i_team", 0, multi_team_spectator),
        (assign, ":number_of_players", 0),
        (get_max_players, ":num_players"),
        (try_for_range, ":player_no", 0, ":num_players"),
          (player_is_active, ":player_no"),
          (player_get_team_no, ":team_no", ":player_no"),
          (eq, ":team_no", ":i_team"),
          (val_add, ":number_of_players", 1),
        (try_end),
        (assign, reg0, ":number_of_players"),
        (try_begin),
          (neq, ":number_of_players", 1),
          (create_text_overlay, reg1, "str_reg0_players", 0),
        (else_try),
          (create_text_overlay, reg1, "str_reg0_player", 0),
        (try_end),

        (assign, ":cur_y", ":y_needed"),
        (team_get_faction, ":cur_faction", ":i_team"),
        (str_store_faction_name, s1, ":cur_faction"),
        (create_text_overlay, reg0, s1, 0),
        (try_begin),
          (eq, ":i_team", 0),
          (overlay_set_color, reg0, 0xFF0000),
          (overlay_set_color, reg1, 0xFF0000),
        (else_try),
          (overlay_set_color, reg0, 0x0099FF),
          (overlay_set_color, reg1, 0x0099FF),
        (try_end),
        (assign, ":distance_between_teams", 378),
        (store_mul, ":cur_x", ":distance_between_teams", ":i_team"),
        (val_add, ":cur_x", 42),
        (store_add, ":cur_x_add_15", ":cur_x", 15),
        (position_set_x, pos3, ":cur_x_add_15"),
        (position_set_y, pos3, ":cur_y"),
        (store_add, ":cur_x_add_35", ":cur_x", 35),
        (position_set_x, pos1, ":cur_x_add_35"),
        (position_set_y, pos1, ":cur_y"),
        (copy_position, pos2, pos1),
        (store_sub, ":cur_y_sub_10", ":cur_y", 10),
        (position_set_x, pos2, ":cur_x_add_35"),
        (position_set_y, pos2, ":cur_y_sub_10"),
        (overlay_set_position, reg0, pos1),
        (overlay_set_position, reg1, pos2),
        (position_set_x, pos1, 1000),
        (position_set_y, pos1, 1000),
        (position_set_x, pos2, 600),
        (position_set_y, pos2, 600),
        (overlay_set_size, reg0, pos1),
        (overlay_set_size, reg1, pos2),

        (team_get_faction, ":faction_of_team_1", 0),
        (team_get_faction, ":faction_of_team_2", 1),
          
        (try_begin),
          (eq, ":faction_of_team_1", ":faction_of_team_2"),
          (eq, ":i_team", 1),
          (create_mesh_overlay, reg0, "mesh_ui_kingdom_shield_7"),
        (else_try),
          (eq, ":cur_faction", "fac_kingdom_4"),
          (create_mesh_overlay, reg0, "mesh_ui_kingdom_shield_1"),
        (else_try),
          (eq, ":cur_faction", "fac_kingdom_2"),
          (create_mesh_overlay, reg0, "mesh_ui_kingdom_shield_2"),
        (else_try),
          (eq, ":cur_faction", "fac_kingdom_3"),
          (create_mesh_overlay, reg0, "mesh_ui_kingdom_shield_3"),
        (else_try),
          (eq, ":cur_faction", "fac_kingdom_5"),
          (create_mesh_overlay, reg0, "mesh_ui_kingdom_shield_4"),
        (else_try),
          (eq, ":cur_faction", "fac_kingdom_6"),
          (create_mesh_overlay, reg0, "mesh_ui_kingdom_shield_5"),
        (else_try),
          (eq, ":cur_faction", "fac_kingdom_1"),
          (create_mesh_overlay, reg0, "mesh_ui_kingdom_shield_6"),
        (try_end),
      
        (position_set_x, pos1, 100),
        (position_set_y, pos1, 100),
        (overlay_set_position, reg0, pos3),
        (position_set_x, pos1, 50),
        (position_set_y, pos1, 50),
        (overlay_set_size, reg0, pos1),      

        (team_get_score, reg0, ":i_team"),
        (create_text_overlay, reg0, "str_score_reg0", tf_right_align),
        (overlay_set_color, reg0, 0xFFFFFF),
        (store_add, ":sub_cur_x", ":cur_x", 325), #325
        (store_add, ":sub_cur_y", ":cur_y", 0),
        (position_set_x, pos1, ":sub_cur_x"),
        (position_set_y, pos1, ":sub_cur_y"),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1200),
        (position_set_y, pos1, 1200),
        (overlay_set_size, reg0, pos1),      

        (try_begin), #counting number of flags each team has only at hq mod.
          (eq, "$g_multiplayer_game_type", multiplayer_game_type_headquarters),
          (try_begin),
            (eq, ":i_team", 0),
            (assign, reg0, ":team_1_num_flags"),
          (else_try),
            (eq, ":i_team", 1),
            (assign, reg0, ":team_2_num_flags"),
          (try_end),
          (create_text_overlay, reg0, "str_flags_reg0", 0),
          (overlay_set_color, reg0, 0xFFFFFF),
          (store_add, ":sub_cur_x", ":cur_x", 258),
          (store_add, ":sub_cur_y", ":cur_y", -10),
          (position_set_x, pos1, ":sub_cur_x"),
          (position_set_y, pos1, ":sub_cur_y"),
          (overlay_set_position, reg0, pos1),
          (position_set_x, pos1, 600),
          (position_set_y, pos1, 600),
          (overlay_set_size, reg0, pos1),      
        (try_end),

        (val_sub, ":cur_y", 60),
      
        (create_text_overlay, reg0, "str_player_name", 0),
        (overlay_set_color, reg0, 0xFFFFFF),
        (position_set_x, pos1, ":cur_x"),
        (position_set_y, pos1, ":cur_y"),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg0, pos1),

        (try_begin), #at headquarters and capture the flag write score instead before kill count
          (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_capture_the_flag),
          (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_battle),
          (eq, "$g_multiplayer_game_type", multiplayer_game_type_headquarters),      
          (create_text_overlay, reg0, "str_score", 0),
          (overlay_set_color, reg0, 0xFFFFFF),
          (store_add, ":sub_cur_x", ":cur_x", 138),
          (position_set_x, pos1, ":sub_cur_x"),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg0, pos1),
        (try_end),
      
        (create_text_overlay, reg0, "str_kills", tf_center_justify),
        (overlay_set_color, reg0, 0xFFFFFF),
        (store_add, ":sub_cur_x", ":cur_x", 206), #191
        (position_set_x, pos1, ":sub_cur_x"),
        (position_set_y, pos1, ":cur_y"),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg0, pos1),

        (create_text_overlay, reg0, "str_deaths", tf_center_justify),
        (overlay_set_color, reg0, 0xFFFFFF),
        (store_add, ":sub_cur_x", ":cur_x", 260), #232
        (position_set_x, pos1, ":sub_cur_x"),
        (position_set_y, pos1, ":cur_y"),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg0, pos1),
      
        (create_text_overlay, reg0, "str_ping", tf_center_justify),
        (overlay_set_color, reg0, 0xFFFFFF),
        (store_add, ":sub_cur_x", ":cur_x", 308), #291
        (position_set_x, pos1, ":sub_cur_x"),
        (position_set_y, pos1, ":cur_y"),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg0, pos1),
      
        (create_mesh_overlay, reg0, "mesh_white_plane"),
        (overlay_set_color, reg0, 0xFFFFFF),
        (overlay_set_alpha, reg0, 0xD0),
        (store_add, ":sub_cur_x", ":cur_x", 0),
        (position_set_x, pos1, ":sub_cur_x"),
        (store_add, ":sub_cur_y", ":cur_y", -10),
        (position_set_y, pos1, ":sub_cur_y"),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 16500),
        (position_set_y, pos1, 50),
        (overlay_set_size, reg0, pos1),

        (val_sub, ":cur_y", 35),
      
        (store_add, ":end_cond", ":num_players", 1),
        (try_for_range, ":unused", 0, ":end_cond"),
          (assign, ":max_score_plus_death", -30030),
          (assign, ":max_score_plus_death_player_no", -1),
          (try_for_range, ":player_no", 0, ":num_players"),            
            (store_add, ":slot_index", ":player_no", multi_data_player_index_list_begin),
            (troop_slot_eq, "trp_multiplayer_data", ":slot_index", 1),
            (player_get_team_no, ":player_team", ":player_no"),
            (eq, ":player_team", ":i_team"),

            (try_begin),
              (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_capture_the_flag),
              (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_battle),
              (eq, "$g_multiplayer_game_type", multiplayer_game_type_headquarters),      
              (player_get_score, ":kill_count", ":player_no"), #get score in "capture the flag" or "headquarters"
            (else_try),
              (player_get_kill_count, ":kill_count", ":player_no"), #get kill count in "siege" or "battle" or "team deathmatch" or "deathmatch"
            (try_end),
      
            (player_get_death_count, ":death_count", ":player_no"), #get_death_count

            (store_mul, ":player_score_plus_death", ":kill_count", 1000),
            (val_sub, ":player_score_plus_death", ":death_count"),
      
            (this_or_next|gt, ":player_score_plus_death", ":max_score_plus_death"),
            (eq, ":player_score_plus_death", -30030),
      
            (assign, ":max_score_plus_death", ":player_score_plus_death"),
            (assign, ":max_score_plus_death_player_no", ":player_no"),
          (try_end),
          (try_begin),
            (ge, ":max_score_plus_death_player_no", 0),
            (store_add, ":slot_index", ":max_score_plus_death_player_no", multi_data_player_index_list_begin),
            (troop_set_slot, "trp_multiplayer_data", ":slot_index", 0),
      
            (try_begin),
              (eq, ":my_player_no", ":max_score_plus_death_player_no"),
              (create_mesh_overlay, reg0, "mesh_white_plane"),
              (overlay_set_color, reg0, 0xFFFFFF),
              (overlay_set_alpha, reg0, 0x35),
              (store_add, ":sub_cur_x", ":cur_x", 0),
              (position_set_x, pos1, ":sub_cur_x"),
              (store_add, ":sub_cur_y", ":cur_y", 0),
              (position_set_y, pos1, ":sub_cur_y"),
              (overlay_set_position, reg0, pos1),
              (position_set_x, pos1, 16500),
              (position_set_y, pos1, 1000),
              (overlay_set_size, reg0, pos1),
            (try_end),
  
            (try_begin), #at headquarters and capture the flag write score instead dead label before kill count
              (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_capture_the_flag),
              (this_or_next|eq, "$g_multiplayer_game_type", multiplayer_game_type_battle),
              (eq, "$g_multiplayer_game_type", multiplayer_game_type_headquarters),      

              (assign, ":font_color", 0xFFFFFF),
              (player_get_agent_id, ":max_score_plus_death_agent_id", ":max_score_plus_death_player_no"),
              (try_begin),
                (this_or_next|lt, ":max_score_plus_death_agent_id", 0),
                (neg|agent_is_alive, ":max_score_plus_death_agent_id"),
                (assign, ":font_color", 0xFF0000),
              (try_end),

              (player_get_score, reg0, ":max_score_plus_death_player_no"),
              (create_text_overlay, reg0, "str_reg0", tf_right_align),
              (overlay_set_color, reg0, ":font_color"),
              (position_set_x, pos1, 750),
              (position_set_y, pos1, 750),
              (overlay_set_size, reg0, pos1),      
              (store_add, ":sub_cur_x", ":cur_x", 165), #150
              (position_set_x, pos1, ":sub_cur_x"),
              (position_set_y, pos1, ":cur_y"),
              (overlay_set_position, reg0, pos1),
            (else_try),
              (assign, ":font_color", 0xFFFFFF),
              (player_get_agent_id, ":max_score_plus_death_agent_id", ":max_score_plus_death_player_no"),
              (try_begin),
                (this_or_next|lt, ":max_score_plus_death_agent_id", 0),
                (neg|agent_is_alive, ":max_score_plus_death_agent_id"),
                (assign, ":font_color", 0xFF0000),
                (create_text_overlay, reg0, "str_dead", 0),
                (overlay_set_color, reg0, ":font_color"),
                (position_set_x, pos1, 750),
                (position_set_y, pos1, 750),
                (overlay_set_size, reg0, pos1),
                (store_add, ":sub_cur_x", ":cur_x", 130),
                (position_set_x, pos1, ":sub_cur_x"),
                (position_set_y, pos1, ":cur_y"),
                (overlay_set_position, reg0, pos1),
              (try_end),
            (try_end),

            (str_store_player_username, s1, ":max_score_plus_death_player_no"),
            (create_text_overlay, reg0, s1, 0),
            (overlay_set_color, reg0, ":font_color"),
            (position_set_x, pos1, 750),
            (position_set_y, pos1, 750),
            (overlay_set_size, reg0, pos1),
            (position_set_x, pos1, ":cur_x"),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, reg0, pos1),
      
            (player_get_kill_count, reg0, ":max_score_plus_death_player_no"), #get_kill_count
            (create_text_overlay, reg0, "str_reg0", tf_right_align),
            (overlay_set_color, reg0, ":font_color"),
            (position_set_x, pos1, 750),
            (position_set_y, pos1, 750),
            (overlay_set_size, reg0, pos1),      
            (store_add, ":sub_cur_x", ":cur_x", 215), #200
            (position_set_x, pos1, ":sub_cur_x"),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, reg0, pos1),
      
            (player_get_death_count, reg0, ":max_score_plus_death_player_no"),
            (create_text_overlay, reg0, "str_reg0", tf_right_align),
            (overlay_set_color, reg0, ":font_color"),
            (position_set_x, pos1, 750),
            (position_set_y, pos1, 750),
            (overlay_set_size, reg0, pos1),      
            (store_add, ":sub_cur_x", ":cur_x", 265), #250
            (position_set_x, pos1, ":sub_cur_x"),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, reg0, pos1),
      
            (player_get_ping, reg0, ":max_score_plus_death_player_no"),
            (create_text_overlay, reg0, "str_reg0", tf_right_align),
            (overlay_set_color, reg0, ":font_color"),
            (position_set_x, pos1, 750),
            (position_set_y, pos1, 750),
            (overlay_set_size, reg0, pos1),
            (store_add, ":sub_cur_x", ":cur_x", 315), #300
            (position_set_x, pos1, ":sub_cur_x"),
            (position_set_y, pos1, ":cur_y"),
            (overlay_set_position, reg0, pos1),
            (val_sub, ":cur_y", 20),
          (else_try),
            (try_begin),
              (try_begin),
                (eq, ":i_team", 0),
                (assign, ":number_of_bots_in_cur_team", "$g_multiplayer_num_bots_team_1"),
              (else_try),
                (assign, ":number_of_bots_in_cur_team", "$g_multiplayer_num_bots_team_2"),
              (try_end),
             
              (team_get_bot_kill_count, reg0, ":i_team"),
              (team_get_bot_death_count, reg1, ":i_team"),
              (try_begin),
                (this_or_next|neq, reg0, 0),
                (this_or_next|neq, reg1, 0),
                (neq, ":number_of_bots_in_cur_team", 0),
                (assign, ":write_bot_informations_of_team", 1),
              (else_try),
                (assign, ":write_bot_informations_of_team", 0),
              (try_end),
      
              (eq, ":write_bot_informations_of_team", 1),

              (assign, ":number_of_alive_bots", 0),
              (try_for_agents, ":cur_agent"),
                (agent_is_non_player, ":cur_agent"),
                (agent_is_alive, ":cur_agent"),
                (agent_get_team, ":cur_agent_team", ":cur_agent"),
                (eq, ":cur_agent_team", ":i_team"),
                (val_add, ":number_of_alive_bots", 1),
              (try_end),
              (store_sub, ":number_of_dead_bots", ":number_of_bots_in_cur_team", ":number_of_alive_bots"),
              (try_begin),
                (eq, ":number_of_alive_bots", 0),
                (assign, ":font_color", 0xFF0000),
              (else_try),
                (assign, ":font_color", 0xD0D0D0),
              (try_end),

              (try_begin),
                (gt, ":number_of_dead_bots", 0),
                (try_begin),
                  (eq, ":number_of_bots_in_cur_team", 1),
                  (create_text_overlay, reg0, "str_dead", 0),
                  (store_add, ":sub_cur_x", ":cur_x", 130),
                (else_try),
                  (assign, reg0, ":number_of_dead_bots"),
                  (create_text_overlay, reg0, "str_reg0_dead", 0),
                  (store_add, ":sub_cur_x", ":cur_x", 123),
                (try_end),      
                (overlay_set_color, reg0, ":font_color"),
                (position_set_x, pos1, 750),
                (position_set_y, pos1, 750),
                (overlay_set_size, reg0, pos1),
                (position_set_x, pos1, ":sub_cur_x"),
                (position_set_y, pos1, ":cur_y"),
                (overlay_set_position, reg0, pos1),
              (try_end),

              (try_begin),
                (gt, ":number_of_bots_in_cur_team", 1),
                (assign, reg0, ":number_of_bots_in_cur_team"),
                (create_text_overlay, reg0, "str_bots_reg0_agents", 0),
              (else_try),
                (create_text_overlay, reg0, "str_bot_1_agent", 0),
              (try_end),
              (overlay_set_color, reg0, ":font_color"),
              (position_set_x, pos1, 750),
              (position_set_y, pos1, 750),
              (overlay_set_size, reg0, pos1),
              (position_set_x, pos1, ":cur_x"),
              (position_set_y, pos1, ":cur_y"),
              (overlay_set_position, reg0, pos1),
      
              (team_get_bot_kill_count, reg0, ":i_team"),
              (create_text_overlay, reg0, "str_reg0", tf_right_align),
              (overlay_set_color, reg0, ":font_color"),
              (position_set_x, pos1, 750),
              (position_set_y, pos1, 750),
              (overlay_set_size, reg0, pos1),
              (store_add, ":sub_cur_x", ":cur_x", 215), #200
              (position_set_x, pos1, ":sub_cur_x"),
              (position_set_y, pos1, ":cur_y"),
              (overlay_set_position, reg0, pos1),
      
              (team_get_bot_death_count, reg0, ":i_team"),
              (create_text_overlay, reg0, "str_reg0", tf_right_align),
              (overlay_set_color, reg0, ":font_color"),
              (position_set_x, pos1, 750),
              (position_set_y, pos1, 750),
              (overlay_set_size, reg0, pos1),
              (store_add, ":sub_cur_x", ":cur_x", 265), #250
              (position_set_x, pos1, ":sub_cur_x"),
              (position_set_y, pos1, ":cur_y"),
              (overlay_set_position, reg0, pos1),
              (val_sub, ":cur_y", 20),
            (try_end),
            (assign, ":end_cond", 0), #all players are written for this team, break
          (try_end),
        (try_end),

        (try_begin),
          (eq, ":i_team", 0),
          (assign, ":old_cur_y", ":cur_y"),
        (try_end),
      (try_end),

      (try_begin),
        (le, ":old_cur_y", ":cur_y"),
        (assign, ":cur_y", ":old_cur_y"),
      (try_end),

      (assign, ":cur_x", 42),

      #white line between playing players and spectators
      (create_mesh_overlay, reg0, "mesh_white_plane"),
      (overlay_set_color, reg0, 0xFFFFFF),
      (overlay_set_alpha, reg0, 0xD0),
      (store_add, ":sub_cur_x", ":cur_x", 0),
      (position_set_x, pos1, ":sub_cur_x"),
      (store_add, ":sub_cur_y", ":cur_y", 10),
      (position_set_y, pos1, ":sub_cur_y"),
      (overlay_set_position, reg0, pos1),
      (position_set_x, pos1, 36000),
      (position_set_y, pos1, 50),
      (overlay_set_size, reg0, pos1), 

      (try_begin),
        (gt, ":spectator_rows", 0),

        (assign, ":cur_x", 280),
        (val_sub, ":cur_y", 50),

        #"spectators" text 
        (create_text_overlay, reg0, "str_spectators", 0),
        (overlay_set_color, reg0, 0xFFFFFF),
        (position_set_x, pos1, ":cur_x"),
        (position_set_y, pos1, ":cur_y"),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 1000),
        (position_set_y, pos1, 1000),
        (overlay_set_size, reg0, pos1),

        (create_text_overlay, reg0, "str_ping", tf_right_align),
        (overlay_set_color, reg0, 0xFFFFFF),
        (store_add, ":sub_cur_x", ":cur_x", 215), #200
        (position_set_x, pos1, ":sub_cur_x"),
        (position_set_y, pos1, ":cur_y"),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 750),
        (position_set_y, pos1, 750),
        (overlay_set_size, reg0, pos1),

        #white line for spectators list
        (create_mesh_overlay, reg0, "mesh_white_plane"),
        (overlay_set_color, reg0, 0xFFFFFF),
        (overlay_set_alpha, reg0, 0xD0),
        (store_add, ":sub_cur_x", ":cur_x", 0),
        (position_set_x, pos1, ":sub_cur_x"),
        (store_add, ":sub_cur_y", ":cur_y", -10),
        (position_set_y, pos1, ":sub_cur_y"),
        (overlay_set_position, reg0, pos1),
        (position_set_x, pos1, 12000),
        (position_set_y, pos1, 50),
        (overlay_set_size, reg0, pos1),

        (val_sub, ":cur_y", 30),

        (assign, ":font_color", 0xC0C0C0),

        (store_add, ":end_cond", ":num_players", 1),
        (try_for_range, ":player_no", 0, ":end_cond"),
          (store_add, ":slot_index", ":player_no", multi_data_player_index_list_begin),
          (troop_slot_eq, "trp_multiplayer_data", ":slot_index", 1),

          (player_get_team_no, ":player_team", ":player_no"),
          (eq, ":player_team", multi_team_spectator), #to not to allow dedicated server to pass below, dedicated servers have -1 for team_no not 2(multi_team_spectator).

          (troop_set_slot, "trp_multiplayer_data", ":slot_index", 1),

          (try_begin),
            (eq, ":my_player_no", ":player_no"),
            (create_mesh_overlay, reg0, "mesh_white_plane"),
            (overlay_set_color, reg0, 0xFFFFFF),
            (overlay_set_alpha, reg0, 0x35),
            (store_add, ":sub_cur_x", ":cur_x", 0),
            (position_set_x, pos1, ":sub_cur_x"),
            (store_add, ":sub_cur_y", ":cur_y", 0),
            (position_set_y, pos1, ":sub_cur_y"),
            (overlay_set_position, reg0, pos1),
            (position_set_x, pos1, 12000),
            (position_set_y, pos1, 1000),
            (overlay_set_size, reg0, pos1),
          (try_end),

          (str_store_player_username, s1, ":player_no"),
          (create_text_overlay, reg0, s1, 0),
          (overlay_set_color, reg0, ":font_color"),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg0, pos1),
          (position_set_x, pos1, ":cur_x"),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          
          (player_get_ping, reg0, ":player_no"),
          (create_text_overlay, reg0, "str_reg0", tf_right_align),
          (overlay_set_color, reg0, ":font_color"),
          (position_set_x, pos1, 750),
          (position_set_y, pos1, 750),
          (overlay_set_size, reg0, pos1),
          (store_add, ":sub_cur_x", ":cur_x", 215), #200
          (position_set_x, pos1, ":sub_cur_x"),
          (position_set_y, pos1, ":cur_y"),
          (overlay_set_position, reg0, pos1),
          (val_sub, ":cur_y", 20),      
        (try_end),
      (try_end),

      (omit_key_once, key_mouse_scroll_up),
      (omit_key_once, key_mouse_scroll_down),
      
      (presentation_set_duration, 999999),
      ]),
    (ti_on_presentation_run,
     [(store_trigger_param_1, ":cur_time"),
      (try_begin),
        (this_or_next|key_clicked, key_mouse_scroll_up),
        (key_clicked, key_mouse_scroll_down),
        (omit_key_once, key_mouse_scroll_up),
        (omit_key_once, key_mouse_scroll_down),
      (try_end),
      (try_begin),
        (eq, "$g_multiplayer_stats_chart_opened_manually", 1),
        (neg|game_key_is_down, gk_leave),
        (assign, "$g_multiplayer_stats_chart_opened_manually", 0),
        (clear_omitted_keys),
        (presentation_set_duration, 0),
      (try_end),
      (try_begin),
        (store_mul, ":update_period_time_limit", "$g_stats_chart_update_period", 1000),
        (gt, ":cur_time", ":update_period_time_limit"),
        (clear_omitted_keys),
        (presentation_set_duration, 0),
        (start_presentation, "prsnt_multiplayer_stats_chart"),
      (try_end),
      ]),
    ]),

Step 4:
In module_scripys.py find these lines: (script_multiplayer_server_on_agent_killed_or_wounded_common):

module_scripts said:
.
.
.

              (try_end),
            (try_end),
          (try_end),
        (try_end),
        (neg|agent_is_non_player, ":killer_agent_no"),
        (agent_get_player_id, ":killer_agent_player_id", ":killer_agent_no"),
        (player_is_active, ":killer_agent_player_id"),
        (player_get_score, ":killer_agent_player_score", ":killer_agent_player_id"),
        (agent_get_team, ":killer_agent_team", ":killer_agent_no"),
        (agent_get_team, ":dead_agent_team", ":dead_agent_no"),
        (try_begin),
          (neq, ":killer_agent_team", ":dead_agent_team"),
          (val_add, ":killer_agent_player_score", 1),  Make this 2. This will increase your score by 2 instead of 1 when you kill an enemy. 
        (else_try),
.
.
.

Step 5:
Find this in module scripts. (game_receive_network_message):
Code:
.
.
.
          (try_begin),
            (get_player_agent_no, ":player_agent"),
            (agent_is_active, ":player_agent"),
            (agent_set_slot, ":player_agent", slot_agent_in_duel_with, -1),
            (agent_clear_relations_with_agents, ":player_agent"),
          (try_end),
        (else_try),
          (eq, ":event_type", multiplayer_event_show_server_message),
          (display_message, "str_server_s0", 0xFFFF6666),
        (try_end),
     ]),
     ]),
.
.
.

Add this before (try_end), after (display_message, "str_server_s0", 0xFFFF6666),
Code:
		  ###### NEW EVENTS
	    (else_try),
          (eq, ":event_type", event_show_message),
          (display_message, s0),

This seems work fine by now. But I couldn't try it with real players because I have no friends who play warband actively. If it doesn't work, or you get some bugs, feel free to edit this code. And please report me what is wrong.
 
Back
Top Bottom