View Full Version : .nss editor

03-11-2004, 03:09 PM
I'm fairly new to modding, and I'm trying to find a .nss editor so I can edit the revan reincarnate mod. All I can find are dos programs that don't work on XP. I have found a compiler already, but I would much appreciate any help.

03-11-2004, 03:51 PM
These .nss files are just plain text file, so any text editor will do. On XP, notepad will work. Just make sure that when you're saving the files, you save them as plain text (as opposed to formatted text like .doc files which is the default for more "advanced" text editing programs).

Kitty Kitty
03-11-2004, 04:39 PM
Yep. They're all simple text files. If you've done any C or C++ (or anything even similar) you shouldn't have too much trouble figuring them out.

Now the .ncs files are another story all together. Once compiled, they're pretty much impossible to do anything with unless you have the source available. Even decompiling them won't really help, since the way NWNscript stores things on a compile doesn't include any syntax or such. So what you get out of it is pretty much raw formatted data that doesn't really make any sense.

Well, it DOES make sense, but it doesn't give you enough information to reconstruct the source sadly.


03-11-2004, 09:34 PM
Thanks for the help. The problem is that, when I alter the script in the revan reincarnate mod to give me the star forge robes rather than revans, and the vacuum mask, when I compile it and enter the game, that section doesn't work. I don't get the robes or a lightsaber or the mask. Could you help me with this please.

Kitty Kitty
03-11-2004, 10:00 PM
How are you compiling the script? (NWN toolset or the modified DOS based compiler?)

If you're using the DOS based one, are you including the -v1.00 command line option? It's been known to produce erroneous scripts otherwise.

No matter which one you're using, are all the necesary include files (listed near the top of any script you edit) for that file either present in the same folder (if using the DOS based one) or added as part of the module (if using the NWN toolset with the KotOR! mod)?

That's about all I can think of off the top of my head... provided your changes to the script itself are correct that is. :)


03-12-2004, 02:50 PM
I have a compiler made by torlack, which runs on DOS. It doesn't seem to be working. The files are copied and converted but it still doesn't work.
I've looked around for the nwn toolset but all I can find is a beta version of someone elses. When I go to use it it says something about a retail version of neverwinter nights. Could you direct me too a website where I could find it please? Thanks again.

Kitty Kitty
03-12-2004, 04:31 PM
To the best of my knowledge, there is no way to get the NWN toolset without buying NWN. The tools sticky thread here however does have a DOS based compiler that works, but as stated, there are a couple of important parameters you'll need to include in your batch file for it to function correctly.

Most notable being that -v1.00 one. Outside of that, everything else should be fairly straight forward if you read the help screen for the program.

Sorry I can't be more helpful.


03-12-2004, 04:38 PM
It says I need to include k_inc_utility. Does anyone know what that is?

Kitty Kitty
03-12-2004, 04:42 PM
It's one of several include scripts. You can find them with KotOR_Tool under
Script, Source

Then just scroll down till you find the one(s) you need, highlight them, and click the Extract button. Path them where you need to save 'em and hit the save button.

Once you have all the files listed as included files in the same folder with the one(s) you've edited, they should compile fine. :)


03-12-2004, 05:29 PM
I am sorry to go on about this, but I've found the missing files in the KOTOR tools, and added them, but now torlacks compiler won't compile them and it ignores it. Could you please tell me how to edit the -v100 thing, because whenever I use the program the only things I can do is press one button to compile and one to exit.

03-12-2004, 05:32 PM
Also, whenever I go to enter the nwnnsscomp.exe, it imediantly exits.

03-12-2004, 05:36 PM
Wait, just so we're on the same page, you're using HazardX's modified Tolack compiler right and not the original Tolack compiler right? Can you compile a simple script, say:

void main()

03-12-2004, 06:28 PM
I'm using torlacks original program found on /www.torlack.com/ called a script compiler.

03-12-2004, 06:40 PM
OK, that is one problem then. Torlack's original compiler is written for NWN so it will be using the wrong nwscript.nss file. Unless you have NWN installed (in which case you need to extract the swkotor's version of nwscript.nss into the same directory as nwnnsscomp.exe) you want thw SWKOTOR's port of that compiler. This thread by Kitty http://www.lucasforums.com/showthread.php?s=&threadid=122049

has a link to that port. Scroll down to the link for Hazardx's "KotOR port of Torlack's NWN Script Compiler " link and use that version of nwnnsscomp.

03-12-2004, 06:56 PM
Ok, thanks for that. I've done it and now it's saying it will ignore the k_inc_utility file and the k_inc_end file because they are both "an include file" How can I edit it so it is set to -v100, because I can't load up nwnnsscomp because it exits every time I enter it.

03-12-2004, 07:10 PM
Ok, you don't compile the include files by themselves. They just need to be there for your main script file to access. Supposed your script file is named test.nss and contains something like:

#include "k_inc_utility"
void main()


To compile this script, you would need k_inc_utility.nss in your directory. Then in the DOS prompt, type in

nwnnsscomp -v1.00 test.nss

This should compile your script and generates test.ncs which you would put in the override folder.

You mentioned that nwnnsscomp exits every time you run it. Since this is a console program, you would want to start a DOS prompt (click on the "command prompt" or "MS DOS prompt" icon or run command.com) and run the program from there. Just clicking on the nwnnsscomp icon from windows will make the console window pops up for a brief second then disappears as just described.

03-12-2004, 07:38 PM
Ok then... I've followed that, I'm using Dos to open the program, yet it says it can't detect nwnnights, so it won't do anything. Also when I just type in -v1.00 it just says theres no such bach file or something. I'm sorry to have to keep on asking you about this.

03-12-2004, 09:31 PM
The original Tolack's nwnnsscomp aborts if NWN registry setting is not detected. I assumed that HazardX's version changed this, but from what you're saying, this doesn't seem to be the case. (I do have NWN installed so I never got this message.)

If you want, you can download the source code found from tolack's site and comment out the part that checks for NWN (some features will consequently not work, but you don't need them anyways). Alternately, I can recompile the code for you; In this case give me your email so I can send the file over.

Unless someone else has another idea, this is all I can think of that could give that error message. Even without the -v1.00 switch, the compilation of the scripts should go smoothly, just that the compiled files won't work correctly in the game.

EDIT: Think HazardX's version checks for swkotor and not nwn, but if sw is not found it displays the message that nwn isn't found.

03-12-2004, 09:40 PM
ok. My e-mail is e-mail removedif you could send it over it would be much appreciated. Thanks for all the help.

03-13-2004, 10:37 AM
Do you want me to send the files over to you?

03-13-2004, 03:03 PM
I sent the file over but got an invalid E-mail address message. Try downloading it from here: http://webpages.charter.net/varuttam/nwnnsscomp.zip Let me know how it goes.

03-13-2004, 03:19 PM
I did it and it said the same thing again "unable to locate neverwinter nights". It seems you have to have neverwinter nights if you want to compile something properly. I suppose it was worth a try though. Thanks for the help.

03-13-2004, 03:27 PM
Umm, are you sure you aren't using your original version? Try deleting the original file before you extract the new one. I tested this version by transferring to a computer without NWN installed and it compiled fine. Besides, the message that NWN is not installed has been removed from the program so it couldn't possibly show up.

Try extracting it to a clean directory with nothing but this version of nwnnsscomp and a simple script file. Maybe that will make it easier to track the different versions of the program you have.

If all else fails and if you really want, you can send me the scripts so I can compile it. My address is
However, you should be able to compile them yourself.

03-13-2004, 03:43 PM
Good! I've am able now to access the program and it will consider compiling it. However whenever I attempt to compile it, I can't fidn it. It says it is unable to open the imput file. I have dumped all the files in the override folder, and the dos thing is in my windows file, is there anywhere I need to put the .nss's to be able to compile them?

03-13-2004, 03:48 PM
I use HazardX's version and in that one you specify the filename along with the filepath.

For example:
nwnnsscomp -c "c:\my scripts\script1.nss"

Helodermatid, are you able to read .pcode (decompiled) well enogh to rewrite it as an .nss (source) scripts?

03-13-2004, 03:51 PM
Almost there! Put the .nss files in the same directory as the nwnnsscomp.exe file (techically not required but then you have to worry about paths and such) OR copy nwnnsscomp.exe to your override folder (and replacing the old version if it is there) where your scripts are.

03-13-2004, 03:57 PM
tk102: For some simple pcodes I can guess what the source should look like but for the more complicated ones keeping track of which variables are where on a stack is a major pain. Not to mention, pcodes from a source that has a lot of #include can be big with lines that aren't even executed. Trying to understand those is presently beyond me.

Why do you ask?

03-13-2004, 04:14 PM
Brilliant!! I finally got it working! Thanks Helodermatid
for all of the help :D

03-13-2004, 04:16 PM
Congratulations! You're one step closer to being an expert modder. :D

03-13-2004, 05:05 PM
I'm trying to solve the cutscene problem with early jedi classing.

Captian Subtext
11-07-2004, 04:07 PM
I updated Kotor to ver 1.7 (i think)do i need to put -v1.7 instead my scripts wont work with -v1.00

11-07-2004, 04:13 PM
No, all scripts need to use the -v1.00 switch when compiling.

See this
thread for functions that can be used to help debug your script.

About half the time, the problem is with the .dlg or .utt and the debug functions mentioned in that thread can help you determine whether or not your script is even firing. If you're still stuck, feel free to post or PM.

02-17-2005, 03:04 PM
I just downloaded hazardXs nwnsscomp. readme says it's version 1.3. Should i still enter -v1.00 or should it be -v1.30?


Fred Tetra
02-17-2005, 04:48 PM
You could also just add the files to a Project in Kotor Tool and let it compile the files for you. It can even build a .mod file for you, if needed.

02-17-2005, 05:58 PM
@clydeski: See my post, 3 post up. It still applies.

02-26-2005, 03:38 AM
Thanks Fred and TK