OSP Code SP [WB] No Cheat using Export/Import Character System

Users who are viewing this thread

MnB have good feature to export/import character but this feature can be used for cheating. A Player can export his character, editing the file to give instant gold and stats.
Thanks "game_get_statistics_line" script, now we can  prevent the player to do that on Warband. Yes, I know, players have modding skills can easily modify the scripts.txt to dismiss  this system.

Code:
 ("game_get_statistics_line",
    [
      (store_script_param_1, ":line_no"),
      (try_begin),
        (eq, ":line_no", 0),
        (get_player_agent_kill_count, reg1),
        (str_store_string, s1, "str_number_of_troops_killed_reg1"),
        (set_result_string, s1),
      (else_try),
        (eq, ":line_no", 1),
        (get_player_agent_kill_count, reg1, 1),
        (str_store_string, s1, "str_number_of_troops_wounded_reg1"),
        (set_result_string, s1),
      (else_try),
        (eq, ":line_no", 2),
        (get_player_agent_own_troop_kill_count, reg1),
        (str_store_string, s1, "str_number_of_own_troops_killed_reg1"),
        (set_result_string, s1),
      (else_try),
        (eq, ":line_no", 3),
        (get_player_agent_own_troop_kill_count, reg1, 1),
        (str_store_string, s1, "str_number_of_own_troops_wounded_reg1"),
        (set_result_string, s1),
     # Dunde's ANTI CHEAT begin	  
     (else_try), 	
        (eq, ":line_no", 9),
        (call_script, "script_save_character_stat"),
        (assign, "$g_vision_anti_cheat", 1),		
    # Dunde's ANTI CHEAT end	  
    (try_end),
  ]),
Code:
  ("game_get_skill_modifier_for_troop",
   [(store_script_param, ":troop_no", 1),
    (store_script_param, ":skill_no", 2),
    (assign, ":modifier_value", 0),
    (try_begin),
      (eq, ":skill_no", "skl_wound_treatment"),
      #(call_script, "script_get_troop_item_amount", ":troop_no", "itm_book_wound_treatment_reference"),
      #(gt, reg0, 0),
      (call_script, "script_cf_troop_has_item",  ":troop_no", "itm_book_wound_treatment_reference"),
      (val_add, ":modifier_value", 1),
    (else_try),
      (eq, ":skill_no", "skl_trainer"),
      #(call_script, "script_get_troop_item_amount", ":troop_no", "itm_book_training_reference"),
      #(gt, reg0, 0),
      (call_script, "script_cf_troop_has_item",  ":troop_no", "itm_book_training_reference"), 
      (val_add, ":modifier_value", 1),
    (else_try),
      (eq, ":skill_no", "skl_surgery"),
      #(call_script, "script_get_troop_item_amount", ":troop_no", "itm_book_surgery_reference"),
      #(gt, reg0, 0),
      (call_script, "script_cf_troop_has_item",  ":troop_no", "itm_book_surgery_reference"), 
      (val_add, ":modifier_value", 1),
    (try_end),
    # Dunde's ANTI CHEAT begin
    (try_begin),
        (eq, "$g_vision_anti_cheat", 1), 
        (assign, "$g_vision_anti_cheat", 0),
        (call_script, "script_restore_character_stat"),
    (try_end),   
    # Dunde's ANTI CHEAT end
    (set_trigger_result, ":modifier_value"),
    ]),
Code:
# Dunde's ANTI CHEAT scripts begin

("save_character_stat",
 [(store_troop_gold, reg3, "trp_player"), ]),

("restore_character_stat", 
 [(store_troop_gold, reg2, "trp_player"),
  (try_begin),
       (neq, reg2, reg3),
       (val_sub, reg3, reg2),
       # DEBUG : # (display_message, "@CHEAT detected! Restored..."),
      (set_show_messages, 0),
      (troop_add_gold, "trp_player", reg3),
      (set_show_messages, 1),
  (try_end),  ]),

# Dunde's ANTI CHEAT scripts end

I only check the gold here. Feel free to modify booth scripts above to include another stats. If you check multiple stats, you can use "trp_temp_array_a" slots as array to save character stats. And, using current last version of WSE, we can retrieve undistributed attribute and skill points
 
Back
Top Bottom