View Full Version : Spawn merchants for dummies guide?

05-13-2009, 01:39 PM
I am having a horrible time trying to learn how to get merchant shops to pop up in my new area.

I have gotten all of my doors to spawn fine, however when I use the same method (extracting a ut* file, modifying it, and then referencing it in the GIT file) nothing happens. Nothing shows up.

Can someone explain to me as if I have no clue, because I do not, how to get shops and merchants into my new area? I have looked at all the tutorials but none seem to help me.


05-14-2009, 02:43 AM
A merchant requires a NPC/Computer Panel file (.utc or .utp) a dialog file fired from the NPC or Panel, a script to open it fired from the dialog file, and a .utm file for the actual items in stock at that merchant.

Take a look at my Rodian Elder Merchant mod on my site, that one adds a merchant to the Elder encampment in K1 and it would be a similar process for TSL.

For making/editing an area it is the same thing just place the NPC/Computer Panel in the area and you pack the extra files in as well... a dialog for that NPC that fires a script to open your merchant .utm file. ;)

The dialog can be as simple or intricate as you want...

Hey pal, you wanna buy something or what?
..... Yes. (Fires Script)
..... No thanks. (End)

05-14-2009, 08:20 AM
Thanks I will check out your merchant mod. I am just not understanding the dynamics of what is needed to do things in kotor i think. Like what files are needed to get things to work.

Edit: So for example if I wanted to spawn your merchant in my new area just to test out how it works, what is the first step? Modify my GIT file to call one of your files, and then pack everything into my MOD file?

05-14-2009, 05:49 PM
Sounds fine to me, if you wanted to edit the module. I'm pretty sure you could also do it via a script fired when you, say, go through a door.

As for the dynamics part, this may help you understand better.
1) You enter the area where the merchant* is. You click on him, which triggers dialog.
2) This dialog** may have several options like if you want to buy something.
3) At least one option would fire the script*** which would cause the merchant**** window to pop up, allowing you to buy/sell things

As you may see, there are several files involved:
* .utc or .utp file (like RedHawke said)

** .dlg file

*** .nss/.ncs file

**** .utm files
If you need any help with specifics, let me know.
Hope I can help

05-15-2009, 02:43 AM
Edit: So for example if I wanted to spawn your merchant in my new area just to test out how it works, what is the first step? Modify my GIT file to call one of your files, and then pack everything into my MOD file?
You would need to place the NPC .utc file reference in a location in your git in the NPC location section (forget what it is called), then pack the .utc, .dlg, start merchant script, and the .utm from my mod into your modules files.

As Mal indicated to open a merchant is a chain of events in the game involving 4 different files...

The NPC (.utc) or Computer Panel Placeable (.utp) that has the dialog set in it so when it is interacted with it opens the specified dialog.
The Dialog file (.dlg) that contains the lines you want with the information you want that when one particular selection is made by the player it fires the script to bring up the merchant window.
The Script (.ncs/.nss) that when run brings up the merchant window and calls the merchant file you specify.
The Merchant inventory file itself (.utm) that lists the available items for sale.

Your NPC or Placeable file has to be set in the proper areas of your .git if you are making a new module and all the files have to be packed into your modules .mod file.

05-15-2009, 06:12 AM
...and you must enter the module for the very first time! Otherwise the merchant (or anything else you put anew into the .git file) will not trigger.

Good luck!

05-15-2009, 09:01 AM
I've got the same problem, because my merchant script isn't working.
Could anyone post a "OpenMerchant"-Script, please?

05-15-2009, 12:42 PM
Here's one Stoffe posted:

// ST: st_startstore.nss

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

if (!GetIsObjectValid(oStore))

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

And here's one one made using jmac7142's KotOR Script Generator

#include "k_inc_debug"
#include "k_inc_utility"

void main()
object oStore = CreateObject(OBJECT_TYPE_STORE, "Store ResRef", GetLocation(GetFirstPC()));
AssignCommand(GetFirstPC(), OpenStore(oStore, GetFirstPC()));

Hope this helps

05-15-2009, 05:41 PM
I'll give it a try. Thanks.