nwscript.nss is the script containing all of the general actions and constants in the KotOR and TSL programming language (named "nw" due to its original use in NeverWinter Nights). It must be placed in the Override folder of the game directory for KotOR Tool to be able to read scripts (kept as a source script, not a compiled script). Due to differences between the nwscript for KotOR 1 and TSL, scripts written for one game may not work in the other (this is also why DeNCS is only able to be used reliably with TSL scripts).


The nwscript.nss for TSL.

N.B.: Before modding scripts in TSL, it is necessary to correct an error in nwscript.nss for TSL[1]. This is because all scripts call the source for nwscript.nss is used in all script compilings. Near to line 5710 is a line which reads:
void SetOrientOnClick( object = OBJECT_SELF, int nState = TRUE );

Change the line to:

void SetOrientOnClick( oCreature = OBJECT_SELF, int nState = TRUE );

Once this is done, save the corrected nwscript.nss to the SWKotOR2\Override\ folder.