How to cretae merchants?
I've searched (probably missed it though), but couldn't find any tutorial or guide to creating merchants...
So can someone point me to the right thread or tutorial please?
The easiest way is probably to extract an existing merchant template and modify that to your need.
For example, in KotorTool, open RIMs --> Modules --> 202TEL_s.rim --> Blueprint, Merchant. Select the file named m_202_003.utm and press the Extract button. This is the merchant template for Samhan Dobo, the "immoral" Duros Merchant on Citadel Station.
Now, rename this file to something unique and then open it in the GFF Editor. Change the fields in the GFF Editor to match how you want your Store to work:
Determines if the merchant will sell items, buy items or do both.
1 = Only sells
2 = Only buys
3 = Buys and Sells
I think this is the Palette ID in the toolset for Stores, but since we have no toolset it probably makes no difference. It's always set to 5 for Stores as far as I can see, so I suggest you leave it at that.
Set this string to the name of the store. This is usually the name of the merchant NPC who owns the store.
Set this to the percentage of the base item value that the store will pay for items you sell to it. 50 makes the store give you 50% of the item's base value for it.
Set this to the percentage of the base item value that the store will charge for an item when you buy it. 100 makes the store sell items for their base value, 125 will make items 25% more expensive than their base value.
This is a Resref (filename) to a script that will be triggered when the Store is started. Unless you want something special to happen whenever the store is opened, just leave this blank.
This should be set to match the name of the file exactly, but without the .UTM suffix. If you renamed the file above to "st_customstore.utm", then you'd set this field to "st_customstore". Note that Resrefs shouldn't be longer than 16 characters.
This is an identifier that scripts can use to access your store. For simplicity you'll probably want to set this to the same value as the Resref field, unless you have a good reason not to.
This category contains a list of all the items the stort will initially contain. The easiest way is to just modify the item entries that are already in the list from the store you copied, and change the InventoryRes field to point to the items you wish the store to contain. Delete any leftover entries from the old store when you are done.
If you need to add more entries, select one of those presently in the list and click "Copy Node/Subtree" in the Edit menu. Then click on the "ItemList" top entry and click "Paste as child node" in the Edit menu. Now select your newly created entry and in the panel to the right in the GFF Editor, change the value in the "FieldID" field to a value one higher than the highest of the indexes of the already existing entries. I.e. if the last entry was 30, type 31 here.
Each entry in this list contains the fields:
* InventoryRes (CResRef): A Resref (filename) to the item blueprint for this item. For example putting "a_robe_08" here would place a standard Jedi Robe in the store.
* Repos_PosX, Repos_PosY (WORD): X and Y coordinates for where in the store the item should appear. I don't know if they are actually used or merely leftovers from Neverwinter Nights since KOTOR/TSL uses a list to present inventory content. Just in case make sure that no items have the same set of X/Y coordinates.
* Infinite (BYTE): This field is optional, but if it exists and is set to 1, the store will have an infinite supply of this item.
Note that if you want more than one of a specific item in the store, but don't want an infinite supply, you'll have to create a separate entry for each of the duplicate items, and set the InventoryRes of the entries to point to the same item blueprint.
Now you've created the blueprint for your store. Place it in the override folder. In order to actually use this store in the game though, you'll need to do two things. First you need to create an object of your store in-game, then you'll need to create or add onto an NPCs conversation that will start the store.
This is done the easiest way through a script that you attach to the dialog node that will start your store. I believe a script like this would work:
Then name the script something unique, compile the script and put it in the override folder. In your Dialog file, where you want the store to start, put the name of this file in the field labeled "Script #1" if you are using the DLG Editor.
Edit tk102: Added hyperlink to original post
If it is a custom module do you need to do anything in the *.git file, since there is a "store list" list?
You can reference a store object in the GIT file, or you can spawn it dymanically using CreateObject function. (stoffe's example above)
tk102: See also the official documentation on Merchants (Stores) here
|All times are GMT -4. The time now is 04:09 AM.|
Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
LFNetwork, LLC ©2002-2011 - All rights reserved.