Author Topic: [Code] Improved Trade Goods Mod (small)  (Read 4576 times)

0 Members and 1 Guest are viewing this topic.

Lav

  • Knight
  • *
    • View Profile
  • Faction: Vaegir
  • MP nick: Lav
  • M&BWB
[Code] Improved Trade Goods Mod (small)
« on: July 31, 2011, 12:16:22 PM »
This small mod will greatly improve your trading experience in the world of Calradia.

More than a dozen various item modifiers are enabled for trade goods and food items, directly affecting their prices and morale values.

As most modifiers noticeably increase item prices, average profit per inventory slot grows proportionally, turning trading into a very lucrative business.

Amount of money available to general merchants in the world has been buffed up as well, so they can actually buy all those goodies you bring to them.

Food morale values are also affected - stuff your inventory with exquisite foods to make your men happy! If you can afford the price of course.

Finally, there's also a slight tweak to the "Deliver grain to village" quest. Trust me - if you bring those peasants large bags of grain instead of regular ones, they will be grateful!

Download URL #1: http://mountandblade.nexusmods.com/mods/3108
Download URL #2: http://www.mbrepository.com/file.php?id=3108

Both TXT and source files are included in the download, see readme.txt for details. Mod is tested for savegame compatibility with Native.

Code extracts follow:
(click to show/hide)

(click to show/hide)

(click to show/hide)

(click to show/hide)

Eiríkr Rauði

  • Guest
Re: Trade Goods Mod (small)
« Reply #1 on: July 31, 2011, 12:21:08 PM »
 :o

I love the energy in this community. Every day, there's a nice new lil' script to use to enhance Single Player. Awesome work!

Lav

  • Knight
  • *
    • View Profile
  • Faction: Vaegir
  • MP nick: Lav
  • M&BWB
Re: Trade Goods Mod (small)
« Reply #2 on: July 31, 2011, 12:32:06 PM »
Just in case someone is interested, here's the list of all item modifiers available in the game and their effects. I needed this list to use as a reference but couldn't find it anywhere, so compiled it myself.

In fact the entire Trade Goods mod is just a side-effect of me building this list. :-)

First value is constant name. Second is game text. Third is price modifier. Fourth is modifier rarity. And finally there's a list of all applicable item types and corresponding effects for that item.
Code: [Select]
# imod_plain       Plain_%s         1.000000  1.000000
# imod_cracked     Cracked_%s       0.500000  1.000000  Armor (ac-4), Shield (ac-4, hp-46), Weapon (damage-5), Horse (ac-4, hp-46)
# imod_rusty       Rusty_%s         0.550000  1.000000  Armor (ac-3), Shield (ac-3), Weapon (dmg-3), Horse (ac-3)
# imod_bent        Bent_%s          0.650000  1.000000  Shield (speed-3), Weapon (dmg-3, speed-3)
# imod_chipped     Chipped_%s       0.720000  1.000000  Weapon (dmg-1)
# imod_battered    Battered_%s      0.750000  1.000000  Armor (ac-2), Shield (ac-2, hp-26), Horse (ac-2, hp-26)
# imod_poor        Poor_%s          0.800000  1.000000 
# imod_crude       Crude_%s         0.830000  1.000000  Armor (ac-1), Shield (ac-1), Weapon (dmg-2), Horse (ac-1)
# imod_old         Old_%s           0.860000  1.000000
# imod_cheap       Cheap_%s         0.900000  1.000000
# imod_fine        Fine_%s          1.900000  0.600000  Weapon (dmg+1)
# imod_well_made   Well_Made_%s     2.500000  0.500000
# imod_sharp       Sharp_%s         1.600000  0.600000
# imod_balanced    Balanced_%s      3.500000  0.500000  Shield (speed+3), Weapon (dmg+3, speed+3)
# imod_tempered    Tempered_%s      6.700000  0.400000  Weapon (dmg+4)
# imod_deadly      Deadly_%s        8.500000  0.300000
# imod_exquisite   Exquisite_%s    14.500000  0.300000
# imod_masterwork  Masterwork_%s   17.500000  0.300000  Armor (req+4), Shield (speed+1), Weapon (dmg+5, speed+1, req+4)
# imod_heavy       Heavy_%s         1.900000  0.700000  Armor (ac+3, req+1), Shield (ac+3, hp+10, speed-2, req+1), Weapon (speed-2, damage+2, req+1), Horse (ac+3, charge+4, hp+10)
# imod_strong      Strong_%s        4.900000  0.400000  Armor (req+2), Shield (speed-3), Weapon (dmg+3, speed-3, req+2)
# imod_powerful    Powerful_%s      3.200000  0.400000
# imod_tattered    Tattered_%s      0.500000  1.000000  Armor (ac-3), Shield (ac-3), Horse (ac-3)
# imod_ragged      Ragged_%s        0.700000  1.000000  Armor (ac-2), Shield (ac-2), Horse (ac-2)
# imod_rough       Rough_%s         0.600000  1.000000
# imod_sturdy      Sturdy_%s        1.700000  0.500000  Armor (ac+1), Shield (ac+1), Horse (ac+1)
# imod_thick       Thick_%s         2.600000  0.350000  Armor (ac+2), Shield (ac+2, hp+47), Horse (ac+2, hp+47)
# imod_hardened    Hardened_%s      3.900000  0.300000  Armor (ac+3), Shield (ac+3), Horse (ac+3)
# imod_reinforced  Reinforced_%s    6.500000  0.250000  Armor (ac+4), Shield (ac+4, hp+83), Horse (ac+4, hp+83)
# imod_superb      Superb_%s        2.500000  0.250000
# imod_lordly      Lordly_%s       11.500000  0.250000  Armor (ac+6), Shield (ac+6, hp+155), Horse (ac+6, hp+155)
# imod_lame        Lame_%s          0.400000  1.000000  Horse (speed-10, maneuver-5)
# imod_swaybacked  Swaybacked_%s    0.600000  1.000000  Horse (speed-4, maneuver-2)
# imod_stubborn    Stubborn_%s      0.900000  1.000000  Shield (hp+5), Horse (hp+5, req+1)
# imod_timid       Timid_%s         1.800000  1.000000
# imod_meek        Meek_%s          1.800000  1.000000
# imod_spirited    Spirited_%s      6.500000  0.600000  Horse (speed+2, maneuver+1, charge+1)
# imod_champion    Champion_%s     14.500000  0.200000  Horse (speed+4, maneuver+2, charge+2, req+2)
# imod_fresh       Fresh_%s         1.000000  1.000000
# imod_day_old     Day-old_%s       1.000000  1.000000
# imod_two_day_old Two_Days-old_%s  0.900000  1.000000
# imod_smelling    Smelling_%s      0.400000  1.000000
# imod_rotten      Rotten_%s        0.050000  1.000000
# imod_large_bag   Large_Bag_of_%s  1.900000  0.300000  Food (qty+6), Ammo (amount+6), Crossbow (capable to fire twice)

cmpxchg8b

  • Modder++
  • Grandmaster Knight
  • *
  • Master of rglPool
    • View Profile
  • Faction: Vaegir
  • MP nick: cmp
  • M&BWBWF&SNW
Re: Trade Goods Mod (small)
« Reply #3 on: July 31, 2011, 12:47:58 PM »
Fourth I have no idea what it is.
Rarity.
Warband Script Enhancer v3.1.5 - additional operations, game scripts and triggers for Warband modders


royfang

  • Knight
  • *
    • View Profile
  • Faction: Neutral
  • MP nick: Azugi
  • M&BWBWF&SNW
Re: Improved Trade Goods Mod (small)
« Reply #5 on: July 31, 2011, 04:58:35 PM »
Nice, hopefully the mod makers will incorporate this into their mods  :D


Ikaguia

  • Master Knight
  • *
  • Floris Improved Mod Pack, Coder
    • View Profile
    • Bandits Rule Calradia
  • Faction: Nord
  • MP nick: Ikaguia
  • WBWF&SNW
Re: Improved Trade Goods Mod (small)
« Reply #6 on: July 31, 2011, 06:22:20 PM »
I think I'll add this to FIMP, nice and well done...


Sorry for my poor English, I'm Brazilian.

Lav

  • Knight
  • *
    • View Profile
  • Faction: Vaegir
  • MP nick: Lav
  • M&BWB
Re: Improved Trade Goods Mod (small)
« Reply #7 on: July 31, 2011, 06:41:11 PM »
I think I'll add this to FIMP, nice and well done...
Sure, but - do you have any foods in FIMP which have morale value less than +2? I designed the code to be savegame-compatible with Native, but because of this the code doesn't process such situation properly, and may display something like "+-1 to party morale". It's quite easy to fix (just a few more changed lines in script_game_get_item_extra_text). I'll add the fix now to the first post as commented code.

Dynamite Jewduh

  • Sergeant
  • *
    • View Profile
    • Live Mount & Blade: Warband streams, supported battle time coop campaign!
  • Faction: Rhodok
  • M&BWBWF&S
Re: [Code] Improved Trade Goods Mod (small)
« Reply #8 on: August 27, 2011, 08:32:02 PM »
Man this is so good. I appreciate this code so much man really! Made me have to login and post. lol This is a must have for me now. Thx again. :mrgreen:

Join my Diplomacy Compilation battle time campaign! Visit http://www.twitch.tv/kewl_tv or Diplomacy Compilation (Download + Battle Time Campaign) Thread, for more info!!

pino69

  • Sergeant at Arms
  • *
  • Pro Deo E Rege
    • View Profile
    • Pino Armors Pack
  • Faction: Neutral
  • M&BWB
Re: [Code] Improved Trade Goods Mod (small)
« Reply #9 on: December 09, 2011, 01:34:23 PM »
Hello,

I'm trying to install the mod but I can't find "script_refresh_center_inventories" in module_scripts.py.
Where the hell is this damned script ?
Playing Diplomacy+PBO

Thanks for the answers.

Lav

  • Knight
  • *
    • View Profile
  • Faction: Vaegir
  • MP nick: Lav
  • M&BWB
Re: [Code] Improved Trade Goods Mod (small)
« Reply #10 on: December 09, 2011, 01:42:27 PM »
Hello,

I'm trying to install the mod but I can't find "script_refresh_center_inventories" in module_scripts.py.
Where the hell is this damned script ?
Playing Diplomacy+PBO

Thanks for the answers.
I'm not sure what Warband version that script appeared in. In the earlier versions IIRC the merchant inventories were refreshed in triggers, not in scripts. Try looking not for the script name, but for the specific code lines, variable names and operation calls.

pino69

  • Sergeant at Arms
  • *
  • Pro Deo E Rege
    • View Profile
    • Pino Armors Pack
  • Faction: Neutral
  • M&BWB
Re: [Code] Improved Trade Goods Mod (small)
« Reply #11 on: December 09, 2011, 04:01:57 PM »
Lav,

I'm using 1.134.
Just found the solution : the code is in module_triggers.py.
I suggest you update your first post for 1.134 users ;-)

Thanks

Caba`drin

  • Administrator
  • *
  • It's time to toss the dice.
    • View Profile
  • Faction: Nord
  • MP nick: Caba_drin
  • M&BWBWF&SNW
Re: [Code] Improved Trade Goods Mod (small)
« Reply #12 on: December 09, 2011, 05:48:41 PM »
I'm using 1.134.
Just found the solution : the code is in module_triggers.py.
I suggest you update your first post for 1.134 users ;-)
The current version is 1.143 and the new script_referesh_center_* were added as part of a change in the way the engine handles the merchant inventory operations (thus, the merchant refresh code is no longer in module_triggers, but now in module_scripts). 1.134 is now 6 months out of date.



danest

  • Regular
  • *
    • View Profile
  • Faction: Neutral
Re: [Code] Improved Trade Goods Mod (small)
« Reply #13 on: April 18, 2012, 05:46:19 PM »
It looks like you have a way to add new item modifiers, am I understanding this right?! ;)
I've been searching like crazy on this subject to no avail ... hardcoded.  Or not.
If I'm right, that you've added new item modifiers, is there some kind of tutorial as to how I might be able to do it myself?  (I've been searching and searching, like I said, but found nothing but reports of it being hard-coded, so I'm looking in the wrong place, I guess?)
(I've been wanting to add more quality modifiers to horses and maybe some "fancy" weapon modifiers as well)
« Last Edit: April 18, 2012, 05:49:45 PM by danest »

Somebody

  • Grandmaster Knight
  • *
    • View Profile
  • Faction: Bandit
  • WBWF&S
Re: [Code] Improved Trade Goods Mod (small)
« Reply #14 on: April 18, 2012, 05:53:33 PM »
No, you can't add new item modifiers, as their effects are hardcoded (but their price modifier and rarity are modifiable in the txt file). In Native, most trade goods only possess the plain modifier. You can make any imodbit groups with | (binary or), which allows the item to appear as merchandise with any of those modifiers. To make "fancy" weapons just make a new item entry with whatever bonus you want.