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 next message
Flugente

 
Messages:3218
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):

<MERCHANTSLIST>
  <MERCHANT>
    <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
    <addToCoolness>1</addToCoolness>
    <coolnessProgressRate>10</coolnessProgressRate>
    <daysDelayMin>2</daysDelayMin>
    <daysDelayMax>3</daysDelayMax>
    <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
  </MERCHANT>
...
</MERCHANTSLIST>


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.
http://i47.tinypic.com/29uss9v.jpg

http://i48.tinypic.com/r28aw3.jpg
A local woman sells food, seems normal...

http://i49.tinypic.com/2e3afkg.jpg
... but her son clearly has bad music taste, or watches a bit too much 2012 Anime. Or something.

http://i50.tinypic.com/xqfkhh.jpg
This guy repairs all their stuff.

http://i45.tinypic.com/2e65w92.jpg
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]



Re: New feature: Externalised Merchants[message #313376] Thu, 20 December 2012 11:26 Go to previous messageGo to next message
smeagol

 
Messages:2713
Registered:June 2008
Location: Bremen, Germany
unfortunately too late to make it into aimnas xmas release.


very nice new addition!!!


Re: New feature: Externalised Merchants[message #313381] Thu, 20 December 2012 13:01 Go to previous messageGo to next message
Madd_Mugsy

 
Messages:637
Registered:July 2005
Location: Canada
Nice work!


Re: New feature: Externalised Merchants[message #313388] Thu, 20 December 2012 18:44 Go to previous messageGo to next message
Wil473

 
Messages:2826
Registered:September 2004
Location: Canada
Hmmm, Charlie's Hot Dog Emporium (UC) may have hot dogs... or not (in-game speech). This will make it into UC-1.13 v4.xx as it slowly creeps towards start of production.


Re: New feature: Externalised Merchants[message #313403] Fri, 21 December 2012 03:59 Go to previous messageGo to next message
Clarkew

 
Messages:80
Registered:May 2011
Location: East Texas, USA
Sounds like a great excuse to turn off ALT-LMB selling!
Re: New feature: Externalised Merchants[message #313410] Fri, 21 December 2012 19:10 Go to previous messageGo to next message
RoWa21

 
Messages:2048
Registered:October 2005
Location: Austria
very nice feature for the modders. awesome work Smile


Re: New feature: Externalised Merchants[message #316708] Fri, 29 March 2013 07:41 Go to previous messageGo to next message
Clarkew

 
Messages:80
Registered:May 2011
Location: East Texas, USA
Too bad there's no way to turn off speech for individuals during the sales interface. Every time I buy some porn from Hans he threatens to kill me Smile

In my current game I'm going through and taking notes on all the merchants (or likely merchants) and tweaking their inventory as an aside to my Economy Balancing xml edits for 1.13.

I'm taking my sweet time and trying to set up stuff that makes sense but doesn't break the game. So far I've dumbed down the food a bit (bars sell bar food, clubs sell restaurant style food) added useless leather jackets, low chance revolver holster/regular holster to Angel and of course was thinking of Hans actually selling porn.

Anyway, again this is a great addition that I'm having fun just screwing around with.

Re: New feature: Externalised Merchants[message #341344 is a reply to message #316708] Thu, 04 June 2015 16:00 Go to previous messageGo to next message
Flugente

 
Messages:3218
Registered:April 2009
Location: Germany
As or r7887 & GameDir r2251, Kyle finally takes over the San Mona leather shop once his quest is over (it always seemed a bit odd that he moved out of the tattoo parlour but never arrived in the leather shop - now he'll be there). He sells leather clothes (not that we have a wide selection of those) just like he said he would, plus all sorts of clothes. And a bit of kinky stuff, because gays in video games are always over-the-top kinky.
He also sells LBE MOLLE gear, so you now can get MOLLE in the country, if you do a quest beforehand. Quest reward or whatever.



Saren threw his head back and screamed in impotent fury, before falling to his throne, head in his claws, trembling in horrified disbelief.

Then he heard a faint chime as Sovereign subscribed to her ECHO channel.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: New feature: Externalised Merchants[message #342220 is a reply to message #341344] Thu, 27 August 2015 19:21 Go to previous messageGo to next message
navaroe

 
Messages:78
Registered:August 2012
Anyone seen Kyle actually appear in Angel's leather shop so far? I gave him the deed on day 39, on day 45 there is still no sign of him, checked throughout a day, especially between 9.-12. hour.

Re: New feature: Externalised Merchants[message #342221 is a reply to message #342220] Thu, 27 August 2015 19:55 Go to previous messageGo to next message
M16AMachinegun

 
Messages:308
Registered:September 2013
I've played through the game throughout multiple builds and i've not seen Kyle in the shop, nope

Course, i've been playing AFS mods, so...
Re: New feature: Externalised Merchants[message #342223 is a reply to message #342221] Thu, 27 August 2015 20:22 Go to previous messageGo to next message
Flugente

 
Messages:3218
Registered:April 2009
Location: Germany
If the mod you are playing with does not use the altered scripts, no wonder.



Saren threw his head back and screamed in impotent fury, before falling to his throne, head in his claws, trembling in horrified disbelief.

Then he heard a faint chime as Sovereign subscribed to her ECHO channel.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: New feature: Externalised Merchants[message #342228 is a reply to message #342223] Thu, 27 August 2015 21:59 Go to previous messageGo to next message
navaroe

 
Messages:78
Registered:August 2012
Hm, unlike M16AM I play just plain 1.13.
I took look into lua scripts and found, that Kyle appears when proper if condion checks on gubQuest( Quests.QUEST_LEATHER_SHOP_DREAM ) == qStatus.QUESTNOTSTARTED. So game does not consider the quest even started. Probably nothing to do about that now...

But he still isn't considered a merchant - he does not have "buy/sell" in conversation options. Any ideas what's wrong?
Re: New feature: Externalised Merchants[message #342230 is a reply to message #342228] Fri, 28 August 2015 02:22 Go to previous messageGo to next message
Flugente

 
Messages:3218
Registered:April 2009
Location: Germany
No. That is not what the script says. The script refers to the quest having the status qStatus.QUESTDONE. At that point, Kyle is moved to the shop and is allowed to be a shopkeeper (which of course requires xml shopkeeper settings).



Saren threw his head back and screamed in impotent fury, before falling to his throne, head in his claws, trembling in horrified disbelief.

Then he heard a faint chime as Sovereign subscribed to her ECHO channel.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: New feature: Externalised Merchants[message #342238 is a reply to message #342230] Fri, 28 August 2015 16:38 Go to previous messageGo to next message
navaroe

 
Messages:78
Registered:August 2012
I think you misunderstood - I finished the quest - Kyle has given me money for deed and went. But game still thinks that quest status is "not started", as evidenced by gubQuest( Quests.QUEST_LEATHER_SHOP_DREAM ) == qStatus.QUESTNOTSTARTED evaluating to true. Nevermind - I can cheat Kyle to appear by changing the lua script.

As for XML settings for Kyle being a merchant - I understand those are already in place since r7887 & GameDir r2251 and of course I have those. I checked Kyle is present in merchants.xml - <ubShopKeeperID>95</ubShopKeeperID> which is Kyle (according to comment enumarating NPCs in merchants.xml), tried to copy some other functioning merchant (Darrel's) settings over Kyle's - no effect, Kyle still can't make business. What am I missing?

If only proper entry in merchants.xml was enought for Kyle to be merchant, he would be merchant even in C5 sector before quest, right?

Re: New feature: Externalised Merchants[message #342242 is a reply to message #342238] Fri, 28 August 2015 22:22 Go to previous messageGo to next message
Flugente

 
Messages:3218
Registered:April 2009
Location: Germany
Manny and Kyle can only be merchants once specific quests have been done. That is hardcoded, no way around that. If the quest is not considered finished by the game (for whatever reason), Kyle won't be a shopkeeper.



Saren threw his head back and screamed in impotent fury, before falling to his throne, head in his claws, trembling in horrified disbelief.

Then he heard a faint chime as Sovereign subscribed to her ECHO channel.

If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.


Re: New feature: Externalised Merchants[message #342244 is a reply to message #342242] Sat, 29 August 2015 01:33 Go to previous messageGo to next message
navaroe

 
Messages:78
Registered:August 2012
Aha, thanks.

So no flamboyant merchants for me :'{
Re: New feature: Externalised Merchants[message #351854 is a reply to message #342244] Sun, 31 December 2017 21:06 Go to previous messageGo to next message
88vs1984

 
Messages:8
Registered:August 2015
Location: Belarus
Flugente, what these tegs do?

<addToCoolness>1</addToCoolness>
<coolnessProgressRate>10</coolnessProgressRate>
<daysDelayMin>2</daysDelayMin>
<daysDelayMax>3</daysDelayMax>
Re: New feature: Externalised Merchants[message #351920 is a reply to message #351854] Fri, 05 January 2018 05:00 Go to previous message
todd0001

 
Messages:8
Registered:November 2017
Quote:
Flugente, what these tegs do?

<addToCoolness>1</addToCoolness>
<coolnessProgressRate>10</coolnessProgressRate>
<daysDelayMin>2</daysDelayMin>
<daysDelayMax>3</daysDelayMax>

Bump! Just learning this too!
Previous Topic: New feature: combat jeeps
Next Topic: New feature: new animations
Goto Forum:
  


Current Time: Thu Feb 22 06:56:53 EET 2018

Total time taken to generate the page: 0.00960 seconds