Canaan Sadow Posted July 14, 2010 Share Posted July 14, 2010 First off, I would suggest that you create a new folder for your mod to go in... Show spoiler (hidden content - requires Javascript to show) 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 (hidden content - requires Javascript to show) Show spoiler (hidden content - requires Javascript to show) 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 (hidden content - requires Javascript to show) 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 (hidden content - requires Javascript to show) 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 (hidden content - requires Javascript to show) 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 (hidden content - requires Javascript to show) 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 (hidden content - requires Javascript to show) 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 (hidden content - requires Javascript to show) 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 (hidden content - requires Javascript to show) ID: The ID is always set to 5 for stores... so don't change anything. Show spoiler (hidden content - requires Javascript to show) 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 (hidden content - requires Javascript to show) Show spoiler (hidden content - requires Javascript to show) Now then, resave your Merchant's store and over write the file, that you had it renamed as... 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 More sharing options...
Bane's Heart Posted July 15, 2010 Share Posted July 15, 2010 The only part I'm not getting is the script part. How on earth do you compile it? Link to comment Share on other sites More sharing options...
Canaan Sadow Posted July 15, 2010 Author Share Posted July 15, 2010 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. (: Link to comment Share on other sites More sharing options...
Bane's Heart Posted July 15, 2010 Share Posted July 15, 2010 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. Link to comment Share on other sites More sharing options...
Canaan Sadow Posted July 15, 2010 Author Share Posted July 15, 2010 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. Link to comment Share on other sites More sharing options...
Bane's Heart Posted July 15, 2010 Share Posted July 15, 2010 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. Link to comment Share on other sites More sharing options...
Dak Drexl Posted April 18, 2011 Share Posted April 18, 2011 Thanks a lot for this tut, but I just want to point out that in the script there is a problem: // ST: st_startstore.nss void main() { object oStore = GetObjectByTag("TAG_OF_STORE_HERE"); object oSpeaker = GetPCSpeaker(); if ([color="Red"]![/color]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. Link to comment Share on other sites More sharing options...
stoffe Posted April 18, 2011 Share Posted April 18, 2011 Thanks a lot for this tut, but I just want to point out that in the script there is a problem: // ST: st_startstore.nss void main() { object oStore = GetObjectByTag("TAG_OF_STORE_HERE"); object oSpeaker = GetPCSpeaker(); if ([color="Red"]![/color]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. Link to comment Share on other sites More sharing options...
Canaan Sadow Posted April 18, 2011 Author Share Posted April 18, 2011 ^^^ Ahhh! The Master has spoken! 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 ) Link to comment Share on other sites More sharing options...
newbiemodder Posted April 18, 2011 Share Posted April 18, 2011 This should accompany the already existing tutorial on merchants under general modding nicely Link to comment Share on other sites More sharing options...
Dak Drexl Posted April 18, 2011 Share Posted April 18, 2011 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! Link to comment Share on other sites More sharing options...
Qui-Gon Glenn Posted April 18, 2011 Share Posted April 18, 2011 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 Link to comment Share on other sites More sharing options...
Canaan Sadow Posted April 18, 2011 Author Share Posted April 18, 2011 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 ) Link to comment Share on other sites More sharing options...
stoffe Posted April 20, 2011 Share Posted April 20, 2011 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. 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: void main() { object oStore = [color=Orange]Get existing store object identified by its Tag value[/color] object oSpeaker = [color=Orange]Get the object (player, usually) that I'm in dialog with[/color] if ([color=Orange]there is no object in the area matching the specified Tag[/color]) oStore = [color=Orange]Create a new store object at my location from the UTM template with the Resref set here[/color] if ([color=Orange]there is now a oStore object, either previously existing or just created[/color]) [color=Orange]open the store with the person I'm in dialog with after 0.5 seconds.[/color] } Link to comment Share on other sites More sharing options...
Qui-Gon Glenn Posted April 23, 2011 Share Posted April 23, 2011 ^^^ Good clarification PM coming your way stoffe. Link to comment Share on other sites More sharing options...
redindianman13 Posted January 13, 2013 Share Posted January 13, 2013 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? Link to comment Share on other sites More sharing options...
Hassat Hunter Posted January 14, 2013 Share Posted January 14, 2013 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? Link to comment Share on other sites More sharing options...
redindianman13 Posted January 14, 2013 Share Posted January 14, 2013 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. Link to comment Share on other sites More sharing options...
redindianman13 Posted January 16, 2013 Share Posted January 16, 2013 Can anyone help me please, ^^^ Link to comment Share on other sites More sharing options...
CaptainPike Posted September 3, 2014 Share Posted September 3, 2014 I can't change the numbers on anything, anywhere. When I try to change the amount of the store (by hitting enter, tab, whatever), it goes back to the original value. I also can not change the mark up/mark down amount. I enter what I want, press >enter<, leave the field, save, and reopen to find the same numbers there as when I first opened the store. Quite frustrating. Is there a way to script markup/markdown when calling on the store? Link to comment Share on other sites More sharing options...
Fair Strides 2 Posted September 3, 2014 Share Posted September 3, 2014 I can't change the numbers on anything, anywhere. When I try to change the amount of the store (by hitting enter, tab, whatever), it goes back to the original value. I also can not change the mark up/mark down amount. I enter what I want, press >enter<, leave the field, save, and reopen to find the same numbers there as when I first opened the store. Quite frustrating. Is there a way to script markup/markdown when calling on the store? Send me the file via PM(upload somewhere and send a link) and I'll check it out. As to scripting the markup and markdown, you can do so in the OpenStore function I showed you. Also, note that it is often frowned upon for resurrecting threads older than 2 months... Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.