Jump to content

Home

How to create stores (merchants)


Recommended Posts

Originally posted by StrangeJ

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?

 

I'm rather poor at explaining things and my english isn't the best, but hopefully this will give some hint at least.. :)

 

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:

 

BuySellFlag (BYTE):

Determines if the merchant will sell items, buy items or do both.

1 = Only sells

2 = Only buys

3 = Buys and Sells

 

ID (BYTE):

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.

 

LocName (CExoLocString):

Set this string to the name of the store. This is usually the name of the merchant NPC who owns the store.

 

MarkDown (INT):

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.

 

MarkUp (INT):

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.

 

OnOpenStore (CResRef):

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.

 

Resref (CResRef):

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.

 

Tag (CExoLocString):

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.

 

ItemList (List):

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:

 

// ST: st_startstore.nss

void main() {
object oStore = GetObjectByTag("TAG_OF_STORE_HERE");
       object oSpeaker = GetPCSpeaker();

if (!GetIsObjectValid(oStore))
	oStore = CreateObject(OBJECT_TYPE_STORE, "RESREF_OF_STORE_HERE", GetLocation(OBJECT_SELF));

if (GetIsObjectValid(oStore))
	DelayCommand(0.5, OpenStore(oStore, oSpeaker));
}

 

Edit the script and put the tag you specified above where it says "TAG_OF_STORE_HERE", and put the resref you specified above where it says "RESREF_OF_STORE_HERE".

 

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.

Link to comment
Share on other sites

Originally posted by RedHawke

Merchant Creation

--------------------------------------------------

The script to activate a merchant is in the ORD Mandell source scripts as well (Though you will have to change the merchant tag in the script for your own use).

 

All you really have to do is create an NPC and a dialogue for them with a tree ending with a node that has the PC select something like "What do you have for sale?" and you attach the open merchant script at that point, with KT now having a Merchant Editor it is rediculously easy to create the actual merchant file.

 

With KT simply open an existing or create a Merchant .utm file for your NPC, place in the Items you want them to sell, and save the .utm.

 

Pack the (1)activate script, (2)the NPC .utc, (3)the NPC .dlg, (4)and the NPC .utm, plus (5)the NPC spawn script and edited game dialogue (if any) into your module or drop them into override and go in the game to your spawned or placed NPC and test it out.

 

Check out my Elder Rodian Merchant Mod for reference on how to do a merchant.

 

Both of these tasks arent really very hard, Quest Creation is just tedious, write everything out beforehand and take notes step-by-step on where you are in the quest creation process, especially what dialogue file activates what stage, this helps immensely.

 

I hope this helps with a couple of the things you asked about!

 

 

Don't know if this helps or not, but I saw and figured I would repost it.

 

Edit tk102: Added hyperlink to original post

Link to comment
Share on other sites

Originally posted by StrangeJ

If it is a custom module do you need to do anything in the *.git file, since there is a "store list" list?

 

You don't need to.. It's a choice you have, just like with creatures, placeables, etc.

 

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

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...