lfnetwork.com mark read register faq members calendar

Thread: Creating Merchants (with Kotor Tool)
Thread Tools Display Modes
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Old 07-14-2010, 03:48 AM   #1
Canaan Sadow
Junior Member
 
Canaan Sadow's Avatar
 
Join Date: Jul 2010
Location: Endor
Posts: 366
Current Game: Pokemon & K2
Creating Merchants (with Kotor Tool)

First off, I would suggest that you create a new folder for your mod to go in...

Show spoiler


Then once you've got everything settled in the exact way you want it, then you open up kotor tool and then go to a merchant, similar to what you are creating (like if you're going to create a droid merchant). If you create a droid merchant, you might choose to go to the Taris droid merchant... Kotor I -> RIMS -> Modules -> tar_m02ab_s.rim -> Blueprint, Merchant -> droidshop.utm then go back to the side and then to Extract file and extract it to your folder.

Show spoiler


Show spoiler


Now that you've gotten the file saved in your folder, it's time to go back and rename it. Just right-click on the file and click rename. Rename it to something unique that suits you... you could name it xyz.utm for all it matters. For the intents and purposes of this mod, I renamed it janitorshop.utm (because I'm just going to attatch it to the Janitor in Taris). Now then open up GFF editor (I'll be using the Kotor Tool GFF editor, because in my opinion it looks a little more simplified).

ResRef:
Change the ResRef to the exact same thing that you changed your .UTM file to, only leave off the .utm extension. ie I named my .UTM file to "janitorshop.utm" I put the ResRef as "janitorshop"

Show spoiler


LocName:
Set this to name of the store... normally it is the name of NPC who runs/owns the store... but you could set it to whatever...

Show spoiler


Tag:
An identifier that scripts can use to gain access to your custom store... probably you should rename it to what you named your ResRef, unless you really don't want to or you have a reason to do otherwise...

Show spoiler


Buy/Sell Flag:
Obviously, this is what you can set to make it to where the merchant will only buy, only sell, or buy and sell. Just click the arrow and then change it to whichever one you want.

Show spoiler


Mark Up:
This will set the store's price to sell their goods. 100 is the base price of the item... 125 is 25% more than the base price, 130 is 30% more than the base price and so forth and so forth.

Show spoiler


Mark Down:
Is the exact opposite of Mark Up, it sets the percentage at which the store will buy from you. Once again 100 is the base price, though normally it will be set to below 100, it's usually at about 40-60. 40 is 40% of the base price that they will use to buy from you... 50 is set to half of the base price and so forth and so forth.

Show spoiler


OnOpenScript:
Just a ResRef to a script that will fire when the store is open... unless you want something a little different to happen, just leave it blank.

Show spoiler


ID:
The ID is always set to 5 for stores... so don't change anything.

Show spoiler


INVENTORY:
Obviously this is what the store contains... you can add or destroy items within the store. To destroy an item from the inventory, just set the quantity to 0. To add them, click the + symbol on whatever type of thing you want to add and then drag one of the items over onto the grey inventory box. (As far as I can tell, you can't set any item as infinite in Kotor Tool, to do that, you'll need to download K-GFF by tk102 and you'll need to look at this thread.

Show spoiler


Show spoiler


Now then, resave your Merchant's store and over write the file, that you had it renamed as...


Quote:
Originally Posted by stoffe
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:

Code:
// 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.

Last edited by Canaan Sadow; 04-18-2011 at 04:31 AM. Reason: noticed a few things that didn't go along with the sceenshots, fixing that :P
Canaan Sadow is offline   you may: quote & reply,
Old 07-15-2010, 05:12 AM   #2
Bane's Heart
Rookie
 
Bane's Heart's Avatar
 
Join Date: Jul 2010
Location: Aussie Aussie OI OI!
Posts: 50
Current Game: Modding for KOTOR2
The only part I'm not getting is the script part. How on earth do you compile it?
Bane's Heart is offline   you may: quote & reply,
Old 07-15-2010, 05:34 AM   #3
Canaan Sadow
Junior Member
 
Canaan Sadow's Avatar
 
Join Date: Jul 2010
Location: Endor
Posts: 366
Current Game: Pokemon & K2
In Kotor Tool, there is this thing called Text Editor... you copy the script and then go to edit, paste and then save it... and then script button and put it for K1 or K2, depending and then script button again and hit compile. (:
Canaan Sadow is offline   you may: quote & reply,
Old 07-15-2010, 05:46 AM   #4
Bane's Heart
Rookie
 
Bane's Heart's Avatar
 
Join Date: Jul 2010
Location: Aussie Aussie OI OI!
Posts: 50
Current Game: Modding for KOTOR2
Ah I found that out in the scripting tutorials section, and brilliant tutorial. Although I would be interested in creating a new npc who likes to hang around the Ebon Hawk on tatooine, or around it at least.
Bane's Heart is offline   you may: quote & reply,
Old 07-15-2010, 06:15 AM   #5
Canaan Sadow
Junior Member
 
Canaan Sadow's Avatar
 
Join Date: Jul 2010
Location: Endor
Posts: 366
Current Game: Pokemon & K2
In the Scripting tutorial section, there's a frequently used script thread. You'll find scripts that'll help you to spawn custom made NPCs (: And thanks. Haha.
Canaan Sadow is offline   you may: quote & reply,
Old 07-15-2010, 07:16 PM   #6
Bane's Heart
Rookie
 
Bane's Heart's Avatar
 
Join Date: Jul 2010
Location: Aussie Aussie OI OI!
Posts: 50
Current Game: Modding for KOTOR2
Yeah in the scripting tutorial that's where I found out how to compile a script :X.

I've already had a skim through of that though and there's sadly no specification on the script to place a new NPC.
Bane's Heart is offline   you may: quote & reply,
Old 04-17-2011, 10:54 PM   #7
Dak Drexl
Senior Member
 
Dak Drexl's Avatar
 
Join Date: Jan 2010
Posts: 1,078
Helpful! 
Thanks a lot for this tut, but I just want to point out that in the script there is a problem:

Code:
// 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));
}
That exclamation point needs to come out if you want the script to work. It will still compile with it in, but it won't work unless you take it out; just a future warning to anyone!

But thanks again for this very helpful.

Dak Drexl is offline   you may: quote & reply,
Old 04-18-2011, 01:22 AM   #8
stoffe
Network Caretaker
 
stoffe's Avatar
 
Status: Administrator
Join Date: Apr 2002
Posts: 5,833
Helpful! 10 year veteran! Notable contributor 
Quote:
Originally Posted by Dak Drexl View Post
Thanks a lot for this tut, but I just want to point out that in the script there is a problem:

Code:
// 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));
}
That exclamation point needs to come out if you want the script to work. It will still compile with it in, but it won't work unless you take it out; just a future warning to anyone!

But thanks again for this very helpful.
Uh, no. The exclamation point is a negation operator. It makes the script create the store object if it does not already exist. If you remove the negation operator you'll spawn a new instance of the store object every time you talk to the merchant, instead of using the one that you already spawned the first time you talked to them. You'd flood the samegame with store object instances if it's a frequently visited merchant.

If you remove the negation operator you'd spawn the store object when an object with that tag already exists. So if your variant "works" it would mean that you've specified the tag of another non-store object within that area that already exists (and your store likely has the same tag as such an object). Change the tag of your store to something unique and it should work.

stoffe is offline   you may: quote & reply,
Old 04-18-2011, 04:22 AM   #9
Canaan Sadow
Junior Member
 
Canaan Sadow's Avatar
 
Join Date: Jul 2010
Location: Endor
Posts: 366
Current Game: Pokemon & K2
^^^ Ahhh! The Master has spoken!

Quote:
Originally Posted by Dak Drexl View Post
But thanks again for this very helpful.
Haha. No problem. I use KotOR Tool more often than I do KGFF editor (I only use KGFF editor if I'm wanting a custom appearance of an NPC, other than that it confuses the heck out of me ) and I figured there might be others (such as Bane's Heart) and so yeah haha.

As for the script I take stoffe's word for it, seeing as I always use that script and it functioned fine for me. (as stoffe just said )
Canaan Sadow is offline   you may: quote & reply,
Old 04-18-2011, 08:29 AM   #10
newbiemodder
Gentleman Modder
 
newbiemodder's Avatar
 
Join Date: Feb 2009
Location: Chicago
Posts: 701
Veteran Modder 
This should accompany the already existing tutorial on merchants under general modding nicely


Who's more foolish, the fool or the fool that follows?

Just exactly what is a head-piece to the Staff of Ra?

http://www.lucasforums.com/showthread.php?t=206819

http://www.lucasforums.com/showthread.php?t=206541

http://www.lucasforums.com/showthrea...t=newbiemodder
newbiemodder is offline   you may: quote & reply,
Old 04-18-2011, 05:42 PM   #11
Dak Drexl
Senior Member
 
Dak Drexl's Avatar
 
Join Date: Jan 2010
Posts: 1,078
Helpful! 
Quote:
Originally Posted by stoffe View Post
Uh, no. The exclamation point is a negation operator. It makes the script create the store object if it does not already exist. If you remove the negation operator you'll spawn a new instance of the store object every time you talk to the merchant, instead of using the one that you already spawned the first time you talked to them. You'd flood the samegame with store object instances if it's a frequently visited merchant.

If you remove the negation operator you'd spawn the store object when an object with that tag already exists. So if your variant "works" it would mean that you've specified the tag of another non-store object within that area that already exists (and your store likely has the same tag as such an object). Change the tag of your store to something unique and it should work.
I'm sorry, I just don't get it I'm scripting retarded and I just observed that the store wouldn't open when I had the exclamation point in there. When I took it out, it opens.

In this mod I have the merchant greet the player by name after he is met for the first time. Is it then when I want to have the ! a part of the script ("then" being the second time)? I hope I'm being clear, you'll have to forgive my ignorance here!

Dak Drexl is offline   you may: quote & reply,
Old 04-18-2011, 06:34 PM   #12
Qui-Gon Glenn
Necessary Roughneck
 
Qui-Gon Glenn's Avatar
 
Join Date: May 2007
Location: Thessia
Posts: 1,464
Current Game: ME3MP, Arkham Origins
Folder extraordinaire Helpful! Forum Veteran Veteran Modder 
Hey Dak!

So, when are you spawning the store? Is it spawned before or after the conversation takes place with the merchant? Or, as I re-read your post, is it that you are trying to spawn the store a second time while the Merchant now addressed the PC by name? If it was spawned already, the store should still be there, and there is no need to spawn the store again. You just need to edit the Merchant's dialog to lock off the part of the dialog where the merchant did not know the PC's name. This would be accomplished via a Dialog Conditional Script, which TB12 did an excellent tut on

The only reason why the script wouldn't work with the "!" is if you had already spawned the store earlier, perhaps in an OnEnter script via script injection. In that case, it would not create a second shop of the same tag, as that is what the !GetIs... does... it makes sure that such a thing is NOT already in existence.

EDIT: Nice tut KS


Want to play a game of ME3MP?
Qui-Gon_Glenn on the software of which we shall not name.... add me and the enemy shall fall in chunks of crimson salsa
Qui-Gon Glenn is offline   you may: quote & reply,
Old 04-18-2011, 06:45 PM   #13
Canaan Sadow
Junior Member
 
Canaan Sadow's Avatar
 
Join Date: Jul 2010
Location: Endor
Posts: 366
Current Game: Pokemon & K2
Quote:
Originally Posted by Qui-Gon Glenn View Post
Hey Dak!

So, when are you spawning the store? Is it spawned before or after the conversation takes place with the merchant? Or, as I re-read your post, is it that you are trying to spawn the store a second time while the Merchant now addressed the PC by name? If it was spawned already, the store should still be there, and there is no need to spawn the store again. You just need to edit the Merchant's dialog to lock off the part of the dialog where the merchant did not know the PC's name. This would be accomplished via a Dialog Conditional Script, which TB12 did an excellent tut on

The only reason why the script wouldn't work with the "!" is if you had already spawned the store earlier, perhaps in an OnEnter script via script injection. In that case, it would not create a second shop of the same tag, as that is what the !GetIs... does... it makes sure that such a thing is NOT already in existence.

EDIT: Nice tut KS
Thanks (sorry about the evil smiley, it's the only one that I saw that does the peace sign. xD )

And also thanks for answering his question, I was just about to start doing that, cuz I finally finished the rough draft of my paper, but now I don't have to. (Thankfully, cuz I'm not sure my brain could handle it right now, massive migrane and all xD )
Canaan Sadow is offline   you may: quote & reply,
Old 04-20-2011, 02:04 AM   #14
stoffe
Network Caretaker
 
stoffe's Avatar
 
Status: Administrator
Join Date: Apr 2002
Posts: 5,833
Helpful! 10 year veteran! Notable contributor 
Quote:
Originally Posted by Dak Drexl View Post
I'm sorry, I just don't get it I'm scripting retarded and I just observed that the store wouldn't open when I had the exclamation point in there. When I took it out, it opens.
Quote:
Originally Posted by Qui-Gon Glenn View Post
The only reason why the script wouldn't work with the "!" is if you had already spawned the store earlier, perhaps in an OnEnter script via script injection. In that case, it would not create a second shop of the same tag, as that is what the !GetIs... does... it makes sure that such a thing is NOT already in existence.
Pretty much. The only situation I can think of off the top of my head where it would work as DD described would be if there is another non-store object in the area already with the same tag as the store. In that case the script would find an existing object and not spawn a new store instance, but since the existing object isn't a store it would be unable to open it, and thus nothing would happen.

In preudo-code, the script essentially does:
Code:
void main() 
{
    object oStore = Get existing store object identified by its Tag value
    object oSpeaker = Get the object (player, usually) that I'm in dialog with
    
    if (there is no object in the area matching the specified Tag)
        oStore = Create a new store object at my location from the UTM template with the Resref set here

    if (there is now a oStore object, either previously existing or just created)
        open the store with the person I'm in dialog with after 0.5 seconds.
}

stoffe is offline   you may: quote & reply,
Old 04-23-2011, 03:55 PM   #15
Qui-Gon Glenn
Necessary Roughneck
 
Qui-Gon Glenn's Avatar
 
Join Date: May 2007
Location: Thessia
Posts: 1,464
Current Game: ME3MP, Arkham Origins
Folder extraordinaire Helpful! Forum Veteran Veteran Modder 
^^^ Good clarification

PM coming your way stoffe.


Want to play a game of ME3MP?
Qui-Gon_Glenn on the software of which we shall not name.... add me and the enemy shall fall in chunks of crimson salsa
Qui-Gon Glenn is offline   you may: quote & reply,
Old 01-13-2013, 02:16 PM   #16
redindianman13
Rookie
 
redindianman13's Avatar
 
Join Date: Jan 2013
Location: Tampa, Fl
Posts: 14
Current Game: KotOR 2,
Ok, I got to the scripting part and have done as instructed. But I want to make my new merchant into a Wookiee, and I want to place him somewhere on Onderon. Also I want him to have some interesting dialogue that I have thought up. Can anyone be of assistance to me?
redindianman13 is offline   you may: quote & reply,
Old 01-13-2013, 09:51 PM   #17
Hassat Hunter
Forumite
 
Join Date: Jan 2010
Posts: 535
UTC for making it a wookie, the GIT file for placing it on Onderon. A DLG-file for dialogue.
And then of course the store files (actual store, script to launch, script to stock if desired).

What do you need assistance with?
Hassat Hunter is offline   you may: quote & reply,
Old 01-13-2013, 11:17 PM   #18
redindianman13
Rookie
 
redindianman13's Avatar
 
Join Date: Jan 2013
Location: Tampa, Fl
Posts: 14
Current Game: KotOR 2,
Quote:
Originally Posted by Hassat Hunter View Post
UTC for making it a wookie, the GIT file for placing it on Onderon. A DLG-file for dialogue.
And then of course the store files (actual store, script to launch, script to stock if desired).

What do you need assistance with?
Well I followed the tut above so I have everything based off of Gegorran on Onderon. So I think I have the actual store files down pat but I need help into making him a Wookiee, placing him on Onderon, and then making the dialogue.
redindianman13 is offline   you may: quote & reply,
Old 01-16-2013, 05:22 PM   #19
redindianman13
Rookie
 
redindianman13's Avatar
 
Join Date: Jan 2013
Location: Tampa, Fl
Posts: 14
Current Game: KotOR 2,
?

Can anyone help me please, ^^^
redindianman13 is offline   you may: quote & reply,
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Go Back   LucasForums > Network > Knights of the Old Republic > Editing / Modding > Holowan Laboratories > Creating Merchants (with Kotor Tool)

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:53 PM.

LFNetwork, LLC ©2002-2011 - All rights reserved.
Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.