View Full Version : KOTOR 1 Adding to already-existant modules.

Nick Vader
07-27-2009, 07:14 AM
I wanted to add an NPC to Dantooine, which is not a custom module, but the normal one. I tried to do that but it didn't work quite well.(-Bugs). Any idea of what I should do ?:confused:

(For example:

I add a Jedi on Manaan who has a spacecraft and takes me to Corucsant.
How can I add him without "teasing" the rest of the module ?)

07-27-2009, 09:05 AM
You need to edit the on_enter script for the module. Rather than decompiling the script, however, what you should do is the following:

1) Go to KotOR tool and extract the on_enter script of the module you want. The way to find what script it actually is is to go to the module's .RIM file (the one without the _s), extract the "static area info" file (the .are file), scroll down to where it says "OnEnter" and read off the value. Then go back to KotOR tool, go to the other .RIM file for the module (the one with the _s), and extract it. For example, the OnEnter script for m15aa is k_pdan_15_area.

Once you've done that, drop the script in your override and rename it, putting an "old_" in front of the name.

2) Create a new script with the same name as the OnEnter script you extracted (but this time without the "old_" prefix). Putting this in your override will override the original on_enter script (don't forget to compile once you've finished making the script). In this script put the following:

void main() {

ExecuteScript("k_[Creature name]_spawn", OBJECT_SELF);
ExecuteScript("old_***", OBJECT_SELF);


3) Create a script called k_[Creature name]_spawn.nss and drop it in your override. In this script write:

void main() {

object oEntering = GetEnteringObject();
object oCreature = GetObjectByTag("[Your defined creature tag]");
if (GetIsPC(oEntering)) - This checks that the PC is entering the module.
if (GetIsObjectValid(oCreature) == FALSE) - This checks the creature isn't already spawned in the module.
CreateObject (OBJECT_TYPE_CREATURE, "[Creature tag]", Location(Vector (x.x, y.y, z.z), 270.0)); - This spawns the creature at the defined coordinates. To get these, download the WhereAmI Wristband mod by Darth333 and get the coordinates of where you want your creature to spawn.


4) Now that you've got the coding out of the way, all you need to do is make your creature's .utc file. Just go into KotOR tool and extract a random .utc file.

Once you've extracted it, go and rename it to the same creature tag as you referenced in your scripts (its not strictly necessary but it helps keep things organised. Once you've done that, go back into KotOR tool, press File-Open GFF Files then navigate to your extracted file. From here you can change everything about the person, but above all you must remember to change the "tag" field to the same tag as you wrote in your scripts.

If you want to make him have dialogue when you talk to him, write the name of a .dlg file in the "Conversation" box (at the bottom of the "Basic" tab). Then go into the dlgeditor, write your dialogue, and whack it in the override folder.

5) Well, that's it. A few points to remember:

Make sure all the tags are consistent throughout all your .dlg files, scripts and .utc files.
Remember to compile all your .nss files (it doesn't matter if you just compile them in the override and leave the .nss files there; it doesn't make any difference).
Make sure the latest version of your files are in the override folder.

Nick Vader
08-02-2009, 06:55 AM
Fixed. Thanks for looking & replying.