No Cheat using Export/Import Character System

From Mount&Blade Modding Wiki
Jump to: navigation, search

Contents

Description

For Warband.

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.

Module Scripts

Script: game_get_statistics_line

 ("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),
  ]),

Script: game_get_skill_modifier_for_troop

  ("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"),
    ]),

Forum Link

http://forums.taleworlds.com/index.php/topic,161800.msg3904965.html#msg3904965

Credit

By Dunde

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox