niBBa

Tougher merchants mod for K1 and K2

Recommended Posts

Hey, been trying to edit the merchant prices with KotOR Tool by changing markup value for the various merchants, but they aren't working. So, I will pay someone via PayPal to make merchants have higher prices for both games.

Share this post


Link to post
Share on other sites

Deadlystream modders cannot accept donations, modders mod from the kindness of their heart or insanity so close your wallet.

 

Merchants are an easy thing to mod so if you could explain exactly what you want to achieve we can probably teach you to do it yourself.

  • Haha 1

Share this post


Link to post
Share on other sites

Merchant markup is set by the script that opens the store, not in the store file. This is how, for example, Suvam is able to give you a discount after you beat him at pazaak, but the items in his store remain the same.

// 378: Open oStore for oPC.
void OpenStore(object oStore, object oPC, int nBonusMarkUp=0, int nBonusMarkDown=0);

I believe the last two are percentage increases/decreases, the first for the merchant's inventory and the second for anything they buy from the player.

One would have to locate the scripts for each merchant, decompile them, adjust the values, and recompile. It's not difficult - assuming the scripts will decompile properly - but tracking them all down would be a bit of work.

Share this post


Link to post
Share on other sites

N-DreW - I'd like to raise the prices of items that merchants offer. All of the merchants. In K1 and K2. JCarter said I'd have to find the scripts and all that but I don't even know where to begin. I figured it wouldn't be as simple as using KotOR Tool.

Share this post


Link to post
Share on other sites
28 minutes ago, niBBa said:

I figured it wouldn't be as simple as using KotOR Tool

Rarely are things as simple as using KTool. In many ways it's just a can opener (or rather a Swiss army knife). It can get you access to the juicy contents, but it can't make you a meal.

  • Like 1

Share this post


Link to post
Share on other sites
9 minutes ago, niBBa said:

So what can I do?

Exactly what JCarter said.

KTool will let you extract the compiled scripts (NCS) from each module. You'll want DeNCS to decompile them (NSS) which you can then edit in a text editor. You'll then need to recompile the modified scripts, which can be done in KTool, via NWNSSCOMP directly, KOTOR Scripting Tool, etc. Depending on the script names and their uniqueness, you'll probably have to inject them into MODs to avoid clashes, for which you'll want the ERF/RIM Editor. And if you plan on a public release, you'll need TSLPatcher in order to make your mod compatible.

Share this post


Link to post
Share on other sites

It's really not that bad once you get the hang of it. Pretty much all you're doing is decompiling the scripts, modifying the MarkSown/MarkUp values, recompiling, and throwing the scripts into your override folder.

Share this post


Link to post
Share on other sites

I've never touched these tools before and I know DarthParametric laid out the groundwork but I'd be very grateful if someone could maybe do a walkthrough/step-by-step for me. 😎

Share this post


Link to post
Share on other sites
Guest Qui-Gon Glenn

In K1, decompiled source scripts can be found in scripts.bif.

Your source code for each merchant, is called a script and is saved in a format called .nss

You can create a new script in any text editor, I prefer notepad or the KotOR Tool editor. The KotOR Tool editor is helpful as it has a codebase in it to search functions and their proper syntax. That is helpful for deeper mods; what you are doing is very simple value editing, with no actual logic changes or additions.

So, if you have found your source script in scripts.bif or using DeNCS, open that file with the KotOR Tool text editor.

You will presented with something that looks similar to C/++ code. You need to change numbers as others in the thread have described.

Then, use KotOR Tool to save your edited script, save as .nss and replace if asked. Then, compile the script using KT, selecting which game (K1/TSL) your script is being compiled for.

This will produce an .ncs file of the same name as your edited .nss

So, if your script to edit is merchant01.nss (this is just an example), when you compile you will have merchant01.ncs as output. This file will then need to be inserted into the module where your merchant lives - someone else can pick up the tut from here.

Share this post


Link to post
Share on other sites
3 minutes ago, Qui-Gon Glenn said:

decompiled source scripts can be found in scripts.bif.

For some scripts, not all scripts. Most, if not all, of the module-specific scripts have no included source and must be manually decompiled.

Share this post


Link to post
Share on other sites
Guest Qui-Gon Glenn
25 minutes ago, DarthParametric said:

For some scripts, not all scripts. Most, if not all, of the module-specific scripts have no included source and must be manually decompiled.

Never said otherwise. Just saying, you don't have to DeNCS everything. When given the opportunity to get the same or better results with less effort, I take it.

Share this post


Link to post
Share on other sites

Ok, I'm in KotOR 1 -> BIFs -> scripts.bif -> Script, Source and... wow. Not sure how anyone could find all the necessary merchant files in here. Unless I'm doing something wrong which is almost certain.

Share this post


Link to post
Share on other sites
Guest Qui-Gon Glenn

Ok. Each merchant has an in-game location.

For K1, you need to enableconsole, so you can use whereami to get the module name you are in. Better, download this mod:

https://www.nexusmods.com/kotor/mods/1076

That will give you the tag of your merchant as well, which will be helpful.

Find the dialog file for that merchant and you will be able to find the script that fires for opening his store. Make a list of these, so that you can look for them in scripts.bif or use DeNCS to get the source .nss.

Look at this mod for ideas:

https://www.nexusmods.com/kotor/mods/533/?tab=3&navtag=http%3A%2F%2Fwww.nexusmods.com%2Fkotor%2Fajax%2Fmodimages%2F%3Fuser%3D0%26id%3D533%26gid%3D234

 

It probably has done most of your work for you ;)

 

Share this post


Link to post
Share on other sites

Sorry for rezzing this thread, but I would love some assistance. In 2018, I contracted a modder to make merchant changes for me. That worked for a bit, but the changes weren't steep enough for me, and he is busy, so he helped me do it myself.

 

Through DeNCS and the KotOR Script Tool, I was able to change these variables, but they don't seem to change the prices past putting it at 100. Anything below that changes the prices, but after that? Nothing. Is there anything I can do?

mark.JPG

Share this post


Link to post
Share on other sites

Presumably it's hard capped at 100%. If that's the case you are out of luck as far as scripting goes. You'd need to change all the base item prices in the global UTIs (item templates). That's what Bioware did for the stimpaks, except they created a second set. There are the regular ones you get at the beginning of the game, then if you nuke the giant fish they swap to the other set that cost more.

  • Like 1

Share this post


Link to post
Share on other sites

Hey Darth, good to hear from you.

I figured that was the case. Really disappointing, but if I can find a way to edit the global UTIs as you say, maybe there's hope. Might you be able to tell me how I can do that?

Share this post


Link to post
Share on other sites

To be clear: I can edit the items from KTool, then save them, and put them in my Override folder? Or am I making assumptions? I'm not sure I believe it is that easy (sounding). 

 

EDIT: What is the "Additional Cost" listed under "Cost" in KTool?

 

EDIT2: "Additional Cost" seems to be the only setting that affects the price, so that's good, I guess.

Share this post


Link to post
Share on other sites

Assuming there are no file name conflicts, yes, that should work.

It's somewhat better practice for compatibility purposes to use TSLPatcher to patch the merchant file in a .mod file, but this isn't strictly necessary, especially if this is for your own personal use.

The only caveat to add is that you have to load a save from before you ever entered the area where the merchant is.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.