View Full Version : Regarding the decompiling of one *.NCS file

07-20-2007, 10:35 AM
Dear fellow LucasForums© members,

Even though most of yours have forsaken Star Wars™ : Knights of the Old Republic® in favor of the Sequel Obsidian Entertainment© devised for this video game, I have nevertheless chosen to keep developing minor modifications dedicated to it. However, it has once again appeared that reconstructing NeverWinter Nights Source Scripts out from compiled instructions was not that obvious, hence the current plea for help. As a consequence, and only in case skilled scripters would be going around this sub-forum, I would greatly appreciate their support for recovering the precise Script which was utilized in order to engender the NeverWinter Nights Compiled Script called « k_ptar_haspapers.ncs », which can be downloaded throughout this web-address (http://www.badongo.com/file/3805960), additionally to other resources you might be in need of.

While hoping you will bring me the answers I have failed in getting so far, I wish you all the best for achieving this task...

Thank you in advance !...

07-20-2007, 10:42 AM

You're trying to decompile scripts into source files? JdNoa and Dashus of Team Gizka developed a tool called DeNCS for exactly this purpose. You can find it here (http://www.starwarsknights.com/mtools/DeNCS.zip).

07-20-2007, 12:03 PM
The fact is that the NeverWinter Nights Compiled Script I am aiming to turn back into a fully-exploitable *.NSS file has not been successfully handled by the Modding Utility you have informed me about, possibly due to the Preprocessor(s) it originally invoked. Indeed, if I am not mistaking on the whole line, the NeverWinter Nights Source Script I am awfully requiring must refer to external instructions through one « #include "k_inc_tar" » statement, and it may clear up why DeNCS has not managed to decompile the *.NCS file discussed here.
Consequently, if it happens that either you or any other LucasForums© member looking at this thread would be inclined towards putting forward surrogate propositions for consideration, then feel free to do so...

07-20-2007, 04:43 PM
Extract the include file "k_inc_tar" into your override, or the folder where you've downloaded DeNCS to. That should fix the problem; DeNCS isn't programmed to read the BIF files in the game (as far as I know).

As a side note: make sure that the KotOR I NWScript.nss file is in the same directory as DeNCS, along with nwnsscomp.exe.

07-20-2007, 05:47 PM
Be sure I have done whatever might be susceptible to get this Modding Utility to work expectedly, which implies I have already attempted to gather any file DeNCS could demand into a common folder, unsuccessfully. On the other hand, no matter whether this program's Graphical User Interface has comported properly since I got my hands down on it, I am equally wondering whether the issues I ran into could be caused by the fact the Java™ Runtime Environment installed onto my Personal Computer is not the latest one available through Sun Microsystems®'s website. For that reason, I will download and unpack a more recent one as soon as I get time off for carrying « Trivial Activities » out, and I will keep you informed regarding my advancement...

07-21-2007, 05:52 AM
This is what DeNCS gave me. No guarantees it'll work as I'll be the first to admit that me and anything that involves scripting seems to be the eternal clash ;) The entire Holowan Labs community can attest to it.. :lol:

// Globals
int intGLOB_1 = 0;
int intGLOB_2 = 1;
int intGLOB_3 = 2;
int intGLOB_4 = 3;
int intGLOB_5 = 4;
int intGLOB_6 = 5;
int intGLOB_7 = 6;
int intGLOB_8 = 7;
int intGLOB_9 = 8;
int intGLOB_10 = 9;
int intGLOB_11 = 10;
int intGLOB_12 = 11;
int intGLOB_13 = 12;
int intGLOB_14 = 13;
int intGLOB_15 = 14;
int intGLOB_16 = 15;
int intGLOB_17 = 16;
int intGLOB_18 = 17;
int intGLOB_19 = 18;
int intGLOB_20 = 19;
int intGLOB_21 = 1100;
int intGLOB_22 = (-6);
int intGLOB_23 = (-5);
int intGLOB_24 = (-4);
int intGLOB_25 = (-2);
int intGLOB_26 = (-1);
int intGLOB_27 = 0;

int StartingConditional() {
int int1;
int nValid = GetIsObjectValid(GetItemPossessedBy(GetFirstPC(), "ptar_sithpapers"));
int1 = GetGlobalBoolean("TAR_PAPERSSHOWN");
return int1;

07-21-2007, 06:29 AM
This is what DeNCS gave me. No guarantees it'll work as I'll be the first to admit that me and anything that involves scripting seems to be the eternal clash ;) The entire Holowan Labs community can attest to it.. :lol:
// Globals
int intGLOB_1 = 0;
int intGLOB_2 = 1;

The globals at the top aren't really used though and can be removed. They are the result of many standard include files using global variables as if they were constants instead of real constants, which gets added to any including scripts whether they are used or not. (Which in this case is completely unnecessary since no functions from the include is used either in the script.)

Further, since the value of the nValid variable is never used for anything you might as well skip that line. I'd guess it's an old way of checking that they forgot to comment out when they changed how to keep track of the papers. So you'd end up with just:

int StartingConditional() {
return GetGlobalBoolean("TAR_PAPERSSHOWN");


07-21-2007, 10:37 AM
As I see, you have been elevated to the rank of « Super Moderator » since I left the LucasForums© Community, stoffe, and that's why I would have meant to congratulate you for having passed steps so speedily, although this might be belated. Furthermore, so as to get back to the subject we were talking of in the first place, I have to acknowledge that the NeverWinter Nights Source Script I endeavoured in restoring was likely to be one of the plainest *.NCS file to process throughout the whole video game, but I presume I have been somewhat influenced by the bringing up of optional constants and functions.

Once again, I would like to give thanks to all of yours for having been so helpful and competent...

P.S. : In addition, as you seem to be (almost) all willing to assist me by setting some Star Wars™ : Knights of the Old Republic®'s Scripts up, I was wondering whether you would not mind giving a look at some other thread, available through this URL (http://www.lucasforums.com/showthread.php?p=2347517)...