Home » MODDING HQ 1.13 » Flugente's Magika Workshop » New feature: Externalised Merchants
New feature: Externalised Merchants[message #313363] Thu, 20 December 2012 02:04 Go to previous message

Registered:April 2009
Location: Germany
More (and externalised) merchants

As recent features have increased the need to buy local Arulcan products dramatically :angel: , I have increased the number of merchants that Arulco has. There can now be up to 21 additional merchants (arbitrary number, it seems enough for the moment). I also externalised the merchant data.

Thus it is now possible, via xml, to define any NPC to be a merchant or repairguy. I figure modders might have a use for this happy

There are new xmls in TableData/NPCInventory. The most interesting one is Merchants.xml, which has the following entries (lets look at Tony's entries as an example):

    <uiIndex>0</uiIndex>                                              <-- index of merchant
    <szName>Tony</szName>                                             <-- name of merchant (orientation purpose only ;-) )
    <dBuyModifier>0.75</dBuyModifier>                                 <-- buy cost modifier (speed modifier for repairguys)
    <dSellModifier>1.25</dSellModifier>                               <-- sell cost modifier (repair cost modifier for repairguys)
    <ubShopKeeperID>91</ubShopKeeperID>                               <-- ID of this NPC. Relevant values are on top of xml
    <ubTypeOfArmsDealer>0</ubTypeOfArmsDealer>                        <-- 0: buy/sell 1: sell only 2: buy only 3: repair
    <iInitialCash>15000</iInitialCash>                                <-- cash at begin of game
    <uiFlags>1342177280</uiFlags>                                     <-- behaviour flags, explanation below...
    <dailyIncrement>15000</dailyIncrement>                            <-- add this amount of money every day
    <dailyMaximum>15000</dailyMaximum>                                <-- maximum cash every day
    <dailyRetained>0</dailyRetained>                                  <-- we can carry this amount of money to the enxt day
    <minCoolness>1</minCoolness>                                      <-- min coolness for our stock
    <maxCoolness>10</maxCoolness>                                     <-- max coolness for our stock
    <useBRSetting>0</useBRSetting>                                    <-- use BR settings?
    <allInventoryAlwaysAvailable>0</allInventoryAlwaysAvailable>      <-- is all inventory always available?
    <nonprofile_loyaltyrequired>30</nonprofile_loyaltyrequired>       <-- required town loyalty if this is a non-profile based merchant (ubShopKeeperID 200) in a town

The <uiFlags> is a flagmask. Only some of them are relevant to us at this point. They define the merchants' behaviour when dealing items:
#define		ARMS_DEALER_ONLY_USED_ITEMS			0x08000000	// 134217728
#define		ARMS_DEALER_GIVES_CHANGE			  0x10000000	// 268435456	//The arms dealer will give the required change when doing a transaction
#define		ARMS_DEALER_ACCEPTS_GIFTS			  0x20000000	// 536870912	//The arms dealer is the kind of person who will accept gifts
#define		ARMS_DEALER_SOME_USED_ITEMS			0x40000000	// 1073741824	//The arms dealer can have used items in his inventory
#define		ARMS_DEALER_HAS_NO_INVENTORY		0x80000000	// 2147483648	//The arms dealer does not carry any inventory

The xml has slots for all merchants, and template fields for 20 new ones, jsut fill them in however ou like. The Inventory of the new merchants is set in TableData/NPCInventory/Additional_Dealer_xxx_Inventory.xml.

Note that UB gets a slightly different Merchants.xml, due to the different merchants there.

Some of the existing ini settings might alter Tony and Devin in a few regards - I'll eventually erase them I guess.

Note that this xml includes all existing merchants and removes hardcoded values. So any change will influence your dealers.
You can now simply define your own dealers, just fill in the correct values. However, when defining a new merchant, it can take a few days for them to get stock - better do that before starting a new game.

Non-merchant NPCs have no fitting speechfiles, thus they might say odd things when selling stuff. A noble exception is Tina. Altough no code section anywhere indicates that she was intended to be a merchant, her ingame story and speechfiles suggest exactly that. For this reason, I made her sell clothes and LBE gear from now on.

A local woman sells food, seems normal...

... but her son clearly has bad music taste, or watches a bit too much 2012 Anime. Or something.

This guy repairs all their stuff.

Lets hope he's not on the manufacturing side as well.

@JMich: I'll pm you the exact datatypes for the editor later.

By the way... this breaks savegame compatibility. Playing with this requires a new game, no way around that.
This is in the trunk since r5744, and requires GameDir >= r1578.

Go shopping! Christmas shows its ugly head!

[Updated on: Sun, 15 May 2016 18:28]

Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: New feature: Improved trade menu
Next Topic: Absurdly small code changes
Goto Forum:

Current Time: Sat Jan 25 07:07:27 EET 2020

Total time taken to generate the page: 0.01505 seconds