• Please note that we've updated the Mount & Blade II: Bannerlord save file system which requires you to take certain steps in order for your save files to be compatible with e1.7.1 and any later updates. You can find the instructions here.

export/import companions buildmodule error

Users who are viewing this thread

Malik Faris

Squire
M&BWBWF&SNW
using rubiks base code works great for the original 16 companions, but when i tried to add on more pages, i get this error:
    ("export_import_next",[],"Next page", [(jump_to_menu, "mnu_export_import_npcs_3")]),
TypeError: 'list' object is not callable

Code:
     ("export_import_npcs", mnf_enable_hot_keys,
       "Please choose an NPC, then press key C to view and export/import this character.^^You choose {reg0?{s0}:none}.",
       "none",
        [
          (assign, reg0, "$g_player_troop"),
          (str_store_troop_name, s0, "$g_player_troop"),
        ],
        [
          ("export_import_back",[],"Go back",
            [
              (assign, "$g_player_troop", "trp_player"),
              (set_player_troop, "$g_player_troop"),
              (jump_to_menu, "mnu_camp_action"),
            ]
          ),
        ]+[("export_import_npc"+str(x+1),
            [
              (store_add, ":dest_npc", "trp_npc1", x),
              (str_store_troop_name, s0, ":dest_npc"),
            ], "{s0}",
            [
              (store_add, ":dest_npc", "trp_npc1", x),
              (assign, "$g_player_troop", ":dest_npc"),
              (set_player_troop, "$g_player_troop"),
            ]) for x in range(0, 8)]+[
          ("export_import_next",[],"Next page", [(jump_to_menu, "mnu_export_import_npcs_2")]),
        ]
      ),
     
      ("export_import_npcs_2", mnf_enable_hot_keys,
        "Please choose an NPC, then press key C to view and export/import this character.^^You choose {reg0?{s0}:none}.",
        "none",
         [
           (assign, reg0, "$g_player_troop"),
           (str_store_troop_name, s0, "$g_player_troop"),
         ],
        [
          ("export_import_prev",[],"Previous page", [(jump_to_menu, "mnu_export_import_npcs")]),
        ]+[("export_import_npc"+str(x+1),
          [
            (store_add, ":dest_npc", "trp_npc1", x),
            (str_store_troop_name, s0, ":dest_npc"),
          ], "{s0}",
          [
            (store_add, ":dest_npc", "trp_npc1", x),
            (assign, "$g_player_troop", ":dest_npc"),
            (set_player_troop, "$g_player_troop"),
          ]) for x in range(8, 16)]
           ("export_import_next",[],"Next page", [(jump_to_menu, "mnu_export_import_npcs_3")]),
 
      ),
      ("export_import_npcs_3", mnf_enable_hot_keys,
        "Please choose an NPC, then press key C to view and export/import this character.^^You choose {reg0?{s0}:none}.",
        "none",
         [
           (assign, reg0, "$g_player_troop"),
           (str_store_troop_name, s0, "$g_player_troop"),
         ],
        [
          ("export_import_prev",[],"Previous page", [(jump_to_menu, "mnu_export_import_npcs_2")]),
        ]+[("export_import_npc"+str(x+1),
          [
            (store_add, ":dest_npc", "trp_npc1", x),
            (str_store_troop_name, s0, ":dest_npc"),
          ], "{s0}",
          [
            (store_add, ":dest_npc", "trp_npc1", x),
            (assign, "$g_player_troop", ":dest_npc"),
            (set_player_troop, "$g_player_troop"),
          ]) for x in range(16, 24)]
           ("export_import_next",[],"Next page", [(jump_to_menu, "mnu_export_import_npcs_4")]),
          
      ),
 

Somebody

Code Pope
Baron
WBWF&S
You need to append another list after for x in range(8, 16)], with +[("export_import_next",[],"Next page", [(jump_to_menu, "mnu_export_import_npcs_3")]),]
Depending on however many companions you may need to have and your basic understanding of python, you could create another loop to make the code cleaner. It won't make a difference in game performance-wise, but it will look neater.
 
Top Bottom