• Welcome to the forums on our new hosting setup. Everything should be working the same, but if you run into any problems, please let us know over here.

Users who are viewing this thread

Ishapar

Recruit
I'm new to coding, and I have become frustrated with one particular problem.

I have been doing my own mod with the Diplomacy 4.3 MRCmod and bugfixes mod as my base. One feature I would love to add to this mod are some new hidden chests in various locations (towns, bandit lairs, villages, castles, prisons, etc.). Unfortunately, I still cannot figure out how to add a hidden chest to a scene with an item in the chest.

Now before anyone tries this, I have read this guide several times: https://forums.taleworlds.com/index.php?threads/chests.192338/. I have tried to follow this guide over and over, but the best results I got so far was a chest that either served as a storage chest or one that would equip your items (which Lav did refer to as problems that may occur if you don't do things right). I have searched the forum for any other help and have tried several times to do it on my own, but my luck and patience has ran out. I need help to add a hidden chest to the game, so I figured to just list some of my questions regarding the guide and the python files:

1. In the first section of his guide, Lav mentions that the troop functioning as the chest needs to be flagged "tf_is_merchant" and that the inventory manangement skill is important to increase the size of the chest's capacity. What confuses me is that when I open module_troops.py and find the bonus chests, I come across this:

["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(1:cool:,wp(60),knows_common, 0],

The first bonus chest is flagged as a hero and as being inactive. There is nothing there indicating it is a merchant (unlike the Seneshal used for the other merchants and town chests). For skills, there is also no inventory skill; just "knows_common." This is a working bonus chest in the vanilla game, but why does it look nothing like Lav mentioned in his guide? If I make a new troop to function as a chest, do I follow the coding for the bonus chests found in module_troops.py or do I change the one flag to "tf_is_merchant" and add inventory management as a skill at the end of the code?

2.In the third part of his guide, Lav makes mention of scene declaration, and this is where I am stumped. In module_scenes.py, comment #10 states:

# 10) List of chest-troops used in this scene {list of strings}. You can access chests by placing them in edit mode.
# The chest's variation-no is used with this list for selecting which troop's inventory it will access.
# town_1 Sargoth #plain
# town_2 Tihr #steppe
# town_3 Veluca #steppe
# town_4 Suno #plain
# town_5 Jelkala #plain
# town_6 Praven #plain
# town_7 Uxkhal #plain
# town_8 Reyvadin #plain
# town_9 Khudan #snow
# town_10 Tulga #steppe
# town_11 Curaw #snow
# town_12 Wercheg #plain
# town_13 Rivacheg #plain
# town_14 Halmar #steppe
# town_15 Yalen
# town_16 Dhirim
# town_17 Ichamur
# town_18 Narra
# town_19 Shariz
# town_20 Durquba
# town_21 Ahmerrad
# town_22 Bariyye

What is chest-troops and chest' variation-no? Lav remarks that you need to declare the chest troops that the scene the chest is in will use for the chest, but I really have no idea what this means. When I look at the coding, I am not sure what either of these things are. For example, if I bring up the town code for Rivacheg (which has the bonus chest in the native game):

("town_13_center",sf_generate,"none", "none",(0,0),(100,100),-100,"0x300416a600035cd600007ee80000012100003fbc",
[],["bonus_chest_1"]),

I don't see anything in the code that reminds me of "chest-troops" or a "chest variation-no." This doesn't help when in the fourth part of his guide, Lav mentions that you need to have the right variation number if you have more than one chest in a scene.
Lav also used an interior castle scene as an example to referencing the troop. All right, I will post Rivacheg's interior scene:

("town_13_castle",sf_indoors, "interior_castle_b", "bo_interior_castle_b", (-100,-100),(100,100),-100,"0",
["exit"],["town_13_seneschal"]),
What I am confused about is that for the seneschal (which I believe refers to the chest in the castle) seems to be referred to the scene's name (town_13). When you look at the bonus chest in Rivacheg, however, there is no such reference; only "bonus_chest_1."

So I guess I have a couple questions regarding this area:
1. What does the code mean by chest-troop and chest variation-no?
2. Where would these things be referenced in the code I listed?
3. Why does Lav make a big deal about scene declaration yet the code for the bonus chest in Rivacheg has no such referral in the code (at least compared to the interior castle's seneshal)?

I'm sorry for the length of the post, but I really am stumped with all this. I have tried so many times to get this and it just isn't clicking without some input. I know several mods have their own chests so adding a chest in a scene shouldn't be too hard to answer for the more experienced modders and coders on this forum. Could anyone please answer my questions or help explain the process of adding a working chest in the game a little bit better than Lav.

Thanks for your patience.
 
Solution
I think you missunderstood of which kind of chests Lav is speaking: He is talking about the chest in the castles at which the player normally stores inventory of his. For bonus chests you should not follow his tutorial although basic informations of it might be useful for you.
Basically you take the bonus chest troop which you have already identified and search for every mentioning of it (the troop id that is) in the scripts, mission templates and scenes. Then you implement your new bonus chest in a similar way.

Eärendil Ardamírë

Subforum Moderator
WBWF&SM&B
I think you missunderstood of which kind of chests Lav is speaking: He is talking about the chest in the castles at which the player normally stores inventory of his. For bonus chests you should not follow his tutorial although basic informations of it might be useful for you.
Basically you take the bonus chest troop which you have already identified and search for every mentioning of it (the troop id that is) in the scripts, mission templates and scenes. Then you implement your new bonus chest in a similar way.
 
Upvote 0
Solution

Ishapar

Recruit
Wow...I feel dumb.

Thanks for that useful information. So I guess it's time to do some researching through the module.

I'll give it a shot, but don't be surprised if I ask another question. Thanks for the help.
 
Upvote 0

Ishapar

Recruit
Always welcome. Happy modding :grin:
Am I allowed to share what I find on this forum? I'm new to the place, and while I did read the guide when I first registered I just want to make sure it would be all right with the forum if I shared my findings since I haven't seen any other tutorial about this subject in the forum.
 
Upvote 0

Ishapar

Recruit
You can create a tutorial in the Forge if you think it is something useful and isn't covered yet by another thread. Use [Tutorial, Module System] at the beginning of your thread title.
Sorry for the double post, but I just realized that I can't seem to make a post in the tutorial section of the Forge. It mentions that I have insufficient privileges to post threads here. I know I am a newbie on this forum, but is there another place in the Forge I could try to make the hidden chest tutorial? I've been trying it out a lot and now currently have 28 hidden chests in my mod. I wouldn't mind sharing my findings to others who are trying to start modding as I haven't really found a topic to cover this concept. Thanks.
 
Upvote 0

Eärendil Ardamírë

Subforum Moderator
WBWF&SM&B
You always post into the Forge itself. The threads are staying there for one or two weeks, so that others can notice them, before they get moved into the appropriate section. That's why I mentioned to use [Tutorial, Module System] at the beginning of your thread title, it indicates for the moderators where this thread should get moved to.
 
Upvote 0
Top Bottom