Making Merchants Sell The Flintlock & Cartridges

Users who are viewing this thread

I'm trying to make a modification for Mount&Blade: Warband version 1.174 in which the flintlock & cartridges are sold by merchants. I've researched the issue and it appears that despite them being labeled as merchandise the merchants won't stock the items because they are not listed in triggers.txt which is in a completely unfriendly format.

I would normally use the module system to add the information but I can't seem to find an updated version and I've already modded with TweakMB- so I'm left with trying to add the information to the existing file. How would I go about doing this? All the information I can find online does not seem to match the version of the file I have. Thanks!
 
First, you have to wait a few days (not sure if you even have to start a new save game) before a new item appears in the shops.

Second, it might be that the merchant script in module_triggers is not checking for guns and bullets, so you would need to add them to his script via module system. Basically it works similar like for the horse merchant in the thread I link to you, the other merchant's script should be above.
https://forums.taleworlds.com/index.php/topic,72533.msg1882304.html#msg1882304

For downloading the module system, have a look here:
https://forums.taleworlds.com/index.php/topic,326973.0.html

This here is a good guide for how to set it up, I started myself with it too:
https://forums.taleworlds.com/index.php/topic,240255.0.html

And here some additional information bits for you:
https://forums.taleworlds.com/index.php/topic,142422.0.html
 
[Bcw]Btm_Earendil said:
First, you have to wait a few days (not sure if you even have to start a new save game) before a new item appears in the shops.

Second, it might be that the merchant script in module_triggers is not checking for guns and bullets, so you would need to add them to his script via module system. Basically it works similar like for the horse merchant in the thread I link to you, the other merchant's script should be above.
https://forums.taleworlds.com/index.php/topic,72533.msg1882304.html#msg1882304

For downloading the module system, have a look here:
https://forums.taleworlds.com/index.php/topic,326973.0.html

This here is a good guide for how to set it up, I started myself with it too:
https://forums.taleworlds.com/index.php/topic,240255.0.html

And here some additional information bits for you:
https://forums.taleworlds.com/index.php/topic,142422.0.html

The module system you linked too is three versions out of date. I need to how to alter the txt file directly.
 
[Bcw]Btm_Earendil said:
1.171 is the current one, version 1.174 is only for steam, it included some multiplayer workshop fix but no changes in the module system :wink:

1.174 is also the current Good Old Games version and presumably the console versions as well.

I suppose if I have no other choice I could go the Python route- but I was really hoping to avoid it it. I've seen guides on how to alter the txt files directly but none that are updated to the current version. If anyone knows how to do that I would still really appreciate it.
 
It's difficult to add this in the .txt files. But not impossible if you really want to do this.

Here's the script that adds weapons:
Code:
  # script_refresh_center_weaponsmiths
  ("refresh_center_weaponsmiths",
  [
    (reset_item_probabilities, 100),
    (set_merchandise_modifier_quality, 150),
    (try_for_range, ":cur_merchant", weapon_merchants_begin, weapon_merchants_end),
	  (store_sub, ":cur_town", ":cur_merchant", weapon_merchants_begin),
      (val_add, ":cur_town", towns_begin), 
	  (troop_clear_inventory, ":cur_merchant"),
      (party_get_slot, ":cur_faction", ":cur_town", slot_center_original_faction),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_one_handed_wpn, 5),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_two_handed_wpn, 5),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_polearm, 5),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_shield, 6),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_bow, 4),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_crossbow, 3),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_thrown, 5),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_arrows, 2),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_bolts, 2),
      (troop_ensure_inventory_space, ":cur_merchant", merchant_inventory_space),
      (troop_sort_inventory, ":cur_merchant"), 
      (store_troop_gold, reg6, ":cur_merchant"),
      (lt, reg6, 1000),
      (store_random_in_range, ":new_gold", 250, 500),
      (call_script, "script_troop_add_gold", ":cur_merchant", ":new_gold"),
    (try_end),
  ]),

You need to insert something like:
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_pistol, 2),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_bullets, 2),

How do you do this in .txt?
Get a clean Native module system, add the changes, compile. Compare the changes in the scripts.txt files to Native and apply them carefully to your modded version.
You'll need a file comparison program for less pain, I used to use WinDiff.
 
Rodrigo Ribaldo said:
It's difficult to add this in the .txt files. But not impossible if you really want to do this.

Here's the script that adds weapons:
Code:
  # script_refresh_center_weaponsmiths
  ("refresh_center_weaponsmiths",
  [
    (reset_item_probabilities, 100),
    (set_merchandise_modifier_quality, 150),
    (try_for_range, ":cur_merchant", weapon_merchants_begin, weapon_merchants_end),
	  (store_sub, ":cur_town", ":cur_merchant", weapon_merchants_begin),
      (val_add, ":cur_town", towns_begin), 
	  (troop_clear_inventory, ":cur_merchant"),
      (party_get_slot, ":cur_faction", ":cur_town", slot_center_original_faction),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_one_handed_wpn, 5),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_two_handed_wpn, 5),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_polearm, 5),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_shield, 6),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_bow, 4),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_crossbow, 3),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_thrown, 5),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_arrows, 2),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_bolts, 2),
      (troop_ensure_inventory_space, ":cur_merchant", merchant_inventory_space),
      (troop_sort_inventory, ":cur_merchant"), 
      (store_troop_gold, reg6, ":cur_merchant"),
      (lt, reg6, 1000),
      (store_random_in_range, ":new_gold", 250, 500),
      (call_script, "script_troop_add_gold", ":cur_merchant", ":new_gold"),
    (try_end),
  ]),

You need to insert something like:
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_pistol, 2),
      (troop_add_merchandise_with_faction, ":cur_merchant", ":cur_faction", itp_type_bullets, 2),

How do you do this in .txt?
Get a clean Native module system, add the changes, compile. Compare the changes in the scripts.txt files to Native and apply them carefully to your modded version.
You'll need a file comparison program for less pain, I used to use WinDiff.

I saw this: https://forums.taleworlds.com/index.php?topic=58163.0

I was hoping someone could give me something more up to date. But it looks like I'll just have to bite the bullet and go the Python route. Thanks for the input though.
 
It's already in module_scripts.py and you need to find it and insert the two lines after the other troop_add_merchandise lines.
If you are unsure about module system stuff, there is a nice guide here to go through.
 
Rodrigo Ribaldo said:
It's already in module_scripts.py and you need to find it and insert the two lines after the other troop_add_merchandise lines.
If you are unsure about module system stuff, there is a nice guide here to go through.

Apologies, I didn't see the previous post wasn't from you. Guess I'll get to work on the scripts- thanks for your help.
 
RyanFialcowitz said:
[Bcw]Btm_Earendil said:
module_triggers most probably

Yeah, that's what the post I linked to said- I thought you were suggesting that was incorrect.
I never wrote it was incorrect, it is only from ten years ago in your link and most probably thus outdated.
The place should have stayed the same, only it might be that it is now handled in module_scripts like Rodrigo is writting. In that case my information is outdated too, happens sometimes  :grin:
 
[Bcw]Btm_Earendil said:
RyanFialcowitz said:
[Bcw]Btm_Earendil said:
module_triggers most probably

Yeah, that's what the post I linked to said- I thought you were suggesting that was incorrect.
I never wrote it was incorrect, it is only from ten years ago in your link and most probably thus outdated.
The place should have stayed the same, only it might be that it is now handled in module_scripts like Rodrigo is writting. In that case my information is outdated too, happens sometimes  :grin:

Yeah, I didn't check who replied before replying myself- again I apologize.

EDIT
Once I figured out how to get Python working the process was pretty painless. Everything is working now- many thanks, both of you, for your help!
 
Back
Top Bottom