Users who are viewing this thread

Ishapar

Regular
Hidden chests are a great way to add content to your mod. The chests can be used to create possible story elements in role playing mods or used to encourage and reward exploration for the casual game. Originally coming with the Strange Armor set, these chests can be used to hoard a number of items from common food goods to unique armor inaccessible at merchant shops. Using hidden chests in Warband opens up a lot of potential for the modder, but there is one roadblock: how do you add hidden chests to various other regions of Calradia?
I came across this problem in making a new mod, and I could not find an answer to this riddle anywhere on the web. With the permission of the forum moderators, I decided to post my findings to help any newbie get past this hurdle in creating a new mod. I'm going to show you how to place a hidden chest in the village of Azgad near Praven. This is the first time I made a tutorial on coding, so please forgive me if I my instructions are vague or I use improper terminology.

1. Adding a Chest to the scene.

The first thing you want to do is add a hidden chest to a scene. To do this, you have to enable Edit mode prior to running your mod. There are plenty of guides out there on using Edit Mode, so I'll bypass repeating the information. Before turning on Edit mode, find a spot in Azgad you would want to place the hidden chest. Be creative with it: you can stick the chests behind props, in the water, under snow, and even inside prison cells. Once you figured out where you want to place the chest, turn on Edit mode and find scene props. You will find various chest props, but you have to find a prop that would be considered "sokf_type_container." If you don't, you cannot access the contents of the chest as it won't be identified as a container. You'll find the information in module_scene_props.py with a quick search, but here is the information for those too lazy to search:

Code:
scene_props = [
  ("invalid_object",0,"question_mark","0", []),
  ("inventory",sokf_type_container|sokf_place_at_origin,"package","bobaggage", []),
  ("empty", 0, "0", "0", []),
  ("chest_a",sokf_type_container,"chest_gothic","bochest_gothic", []),
  ("container_small_chest",sokf_type_container,"package","bobaggage", []),
  ("container_chest_b",sokf_type_container,"chest_b","bo_chest_b", []),
  ("container_chest_c",sokf_type_container,"chest_c","bo_chest_c", []),
  ("player_chest",sokf_type_container,"player_chest","bo_player_chest", []),
  ("locked_player_chest",0,"player_chest","bo_player_chest", []),
Choose any of these chests and place it in the scene via Edit mode. Close the Editor and make sure you save the scene. Now you have a hidden chest in Azgad, but you still need to edit the chest contents and link the chest to Azgad through the module.

2. Creating the Chest in the Module

In the module files, there are two files you need to edit the chest and scene:

module_troops.py
module_scene.py

You should also open up module_parties.py as you'll need it for step 3.

In Mount and Blade, a container chest would be considered a troop instead of a scene prop. As such, you have to add a new chest troop to the module. Go to module_troops.py and do a quick search for "chests." Look for this item:
Code:
["bonus_chest_1","{!}Bonus Chest","{!}Bonus Chest",tf_hero|tf_inactive, 0,reserved,  fac_neutral,[itm_strange_armor,itm_strange_short_sword],def_attrib|level(18),wp(60),knows_common, 0],
This troop is the bonus chest found in Rivacheg that contains the Strange Armor and the Strange Short Sword. Use this item code as a base to create a new chest. In the module, you will actually find 3 bonus chests; if you wish to add a new chest you have to add the chest below the 3rd bonus chest. Simply paste the first chest code a line below chest 3 as so:
Code:
["bonus_chest_1","{!}Bonus Chest","{!}Bonus Chest",tf_hero|tf_inactive, 0,reserved,  fac_neutral,[itm_strange_armor,itm_strange_short_sword],def_attrib|level(18),wp(60),knows_common, 0],
["bonus_chest_2","{!}Bonus Chest","{!}Bonus Chest",tf_hero|tf_inactive, 0,reserved,  fac_neutral,[itm_strange_boots,itm_strange_sword],def_attrib|level(18),wp(60),knows_common, 0],
["bonus_chest_3","{!}Bonus Chest","{!}Bonus Chest",tf_hero|tf_inactive, 0,reserved,  fac_neutral,[itm_strange_helmet,itm_strange_great_sword],def_attrib|level(18),wp(60),knows_common, 0],
["bonus_chest_1","{!}Bonus Chest","{!}Bonus Chest",tf_hero|tf_inactive, 0,reserved,  fac_neutral,[itm_strange_armor,itm_strange_short_sword],def_attrib|level(18),wp(60),knows_common, 0],
Change the id of your 4th chest to "bonus_chest_4" to distinguish it from the bonus chest 1. Now you have 4 bonus chests in the game. You can use module_items.py to find the id of various items to place in your 4th chest, but for now you can leave the Strange Equipment in the chest.

If you don't want to add a new chest, you can skip step 1 and just edit any of the other bonus chests in the module, but be warned that bonus chests 2 and 3 are techniquely not in the scenes. If you travel to Tihr or Jelka, you will not find these chests; instead you have to use Edit mode to place the chests in the scene. To get around this hassle, repeat step 1 for both Tihr and Jelka and hide the chest in the scene.

So we have a chest prop in Azgad and have created a chest troop in module_troops.py. Now comes the hard part.

3. Linking the Chest to the Correct Scene

If you went to Azgad at this point, you still will not have access to the items in the chest you placed in the scene. We still need to link the chest troop you created with the chest in Azgad and to do this we need to edit module_scene.py.
Before doing so, open up module_parties.py. Do a quick search for "Azgad" and find this information:
Code:
  ("village_3", "Azgad",  icon_village_a|pf_village, no_menu, pt_none, fac_neutral,0,ai_bhvr_hold,0,(-97.4, 36),[], 120),
"village_3" is the party id for the village Azgad in the game. Any scene in the game can be identified by the party id, and you need this id for linking the chest troop to the right scene. Take another look and find "Rivacheg." You find Rivacheg's party id is "town_13". Open up module_scene and search for "town_13." You need to find the match that indicates a town center otherwise you may choose the castle, prison, arena, or another scene set in Rivacheg. Look for this code:
Code:
  ("town_13_center",sf_generate,"none", "none",(0,0),(100,100),-100,"0x300416a600035cd600007ee80000012100003fbc",
    [],["bonus_chest_1"]),
As you can see, "bonus_chest_1" is the hidden chest found in the town center of Rivacheg. Use this code as a guide for placing other hidden chests in the scene.
Now search for Azgad by searching for "village_3".
Code:
  ("village_3",sf_generate,"none", "none", (0,0),(100,100),-100,"0x000000023003dc4e0006118b000029f8000034670000105f",
    [],[],"outer_terrain_plain"),
By looking at the Rivacheg's code, we would place the 4th bonus chest in the last brackets of the code as such:
Code:
  ("village_3",sf_generate,"none", "none", (0,0),(100,100),-100,"0x000000023003dc4e0006118b000029f8000034670000105f",
    [],["bonus_chest_4"],"outer_terrain_plain"),
Save the code and build the module. You should receive no errors if you spelled everything correctly. Load your module and come to the chest you created in Azgad. You should now be able to access the contents of the chest as you would with the chest in Rivacheg.

I don't know if there is a limit to the number of hidden chests you can place in a mod. I have over 25 in mine and they are all functioning properly. You can replace the Strange Equipment with any item you have in the Native game or other items you have added to the mod via python or Morgh's. Be creative and have fun. If you have a question, let me know.
 
Last edited by a moderator:
Back
Top Bottom