Recommended Posts

Most have likely seen my questions and work regarding creating a new character for recruit. Many mods use the tag and reference of an existing character in the template/.utc file. I thought this would overwrite the existing character. How do I create recruit function script to replace a character removed from the party by the game? The only instance I can find of this in the game is losing Trask Ulgo on the Endar Spire and adding Bastila Shan. Trask and Bastila use the same character slot on the party select screen. I have looked at most  script files, but I need help in finding a way to add the character to replace Bastila after she is captured on the Leviathan. I do not understand tutorials on destroying the original NPC, and the scripting tool will not recognize the path to my current version of KotOR. My character, template n_sarna, name Sarna, tag Sarna021, Template ResRef tar02_sarna021, spawns on Tatooine following asking the Customs Officer "What do I get for my 100 credits?". Sarna carries a Mandalorian Blaster, and I have assigned dialogue with some voice refs, with a node assigned script to recruit her, but I cannot compile recruit script to add the party member, template p_sarna, which adds a version of her wearing armor. I am trying to create new armor, but, currently, she wears Republic soldier armor.

Following checking other mods, my scripting tool stated it could not compile, then stated it had the path set to Program Files/LucasArts/SWKotOR, and could not initialize NwnStdLdr. This creates difficulty. I do not know how to change path.

20210531170144_1.jpg20210528142646_1.jpg.42c5dceded4d796dfda675fc2ed0d5a4.jpg

Share this post


Link to post
Share on other sites

https://deadlystream.com/topic/4568-kotor-tool-wont-work/?tab=comments#comment-47386

You have to edit your registry, try having a good look around the site... almost all of your questions will have been answered somewhere.

Share this post


Link to post
Share on other sites
16 minutes ago, Thor110 said:

https://deadlystream.com/topic/4568-kotor-tool-wont-work/?tab=comments#comment-47386

You have to edit your registry, try having a good look around the site... almost all of your questions will have been answered somewhere.

KotOR Tool is working. KotOR Scripting Tool will not allow scripts to be compiled, and there are other problems. I cannot clearly determine why recruit script will not compile. I checked tutorials and other recruit mods, but some are unclear.

Share this post


Link to post
Share on other sites
11 minutes ago, Neville said:

KotOR Tool is working. KotOR Scripting Tool will not allow scripts to be compiled, and there are other problems. I cannot clearly determine why recruit script will not compile.

Again try looking around, there are multiple answers to the same question as well as suggestions to not be using the compiler you are using and to instead use nwnnsscomp.

The above topic points to the first topic and both suggest updating your registry for the failed to find NWNStdLoader issue.

I use KotOR Scripting Tool with NWNSSComp.

Share this post


Link to post
Share on other sites
3 minutes ago, Thor110 said:The above topic points to the first topic and both suggest updating your registry for the failed to find NWNStdLoader issue.

I use KotOR Scripting Tool with NWNSSComp.

My spawn script compiled correctly with KotOR Scripting Tool, which uses NWNNSSComp. It had errors when I attempted to compile recruit script.

Share this post


Link to post
Share on other sites
1 minute ago, Neville said:

My spawn script compiled correctly with KotOR Scripting Tool, which uses NWNNSSComp. It had errors when I attempted to compile recruit script.

Then presumably something is written wrong in the script... why don't you post the code for your recruit script instead.

From reading your main post from what I can tell all you are trying to do is a few simple lines of code.

Spoiler

void main() { 
AddAvailableNPCByTemplate(0, "end_trask");
ShowPartySelectionGUI("", 0, 0xFFFFFFFF);
}

The first line adds the NPC by the template file named to slot 0

The second line shows the party selection screen with slot 0 forcefully selected.

The above script definitely compiles as I just checked it.

Try recompiling your spawn script to see if kotor scripting tool itself is still set up properly, it sounds like you need to alter your registry.

Share this post


Link to post
Share on other sites
15 minutes ago, Thor110 said:

Then presumably something is written wrong in the script... why don't you post the code for your recruit script instead.

From reading your main post from what I can tell all you are trying to do is a few simple lines of code.

  Hide contents

void main() { 
AddAvailableNPCByTemplate(0, "end_trask");
ShowPartySelectionGUI("", 0, 0xFFFFFFFF);
}

The first line adds the NPC by the template file named to slot 0

The second line shows the party selection screen with slot 0 forcefully selected.

The above script definitely compiles as I just checked it.

Try recompiling your spawn script to see if kotor scripting tool itself is still set up properly, it sounds like you need to alter your registry.

KotOR Tool is set to the proper directory. KotOR Scripting Tool will not recognize it, and now will not compile my original source script. I tried uninstalling the CD version of the game and the Scripting Tool, then reinstalling Scripting Tool. Scripts will not compile. KotOR Scripting Tool states it needs C:\Program Files\LucasArts\SWKotOR

This is my script.

void main()
{
object oTarget;
oTarget = GetObjectByTag("tar02_sarna022");

   DelayCommand(1.5,DestroyObject(oTarget, 0.0));
     AddAvailableNPCByTemplate(0, "p_sarna");
     DelayCommand(1.5, ShowPartySelectionGUI(0));
}

Share this post


Link to post
Share on other sites
30 minutes ago, Neville said:

KotOR Tool is set to the proper directory. KotOR Scripting Tool will not recognize it, and now will not compile my original source script. I tried uninstalling the CD version of the game and the Scripting Tool, then reinstalling Scripting Tool. Scripts will not compile. KotOR Scripting Tool states it needs C:\Program Files\LucasArts\SWKotOR

This is my script.

void main()
{
object oTarget;
oTarget = GetObjectByTag("tar02_sarna022");

   DelayCommand(1.5,DestroyObject(oTarget, 0.0));
     AddAvailableNPCByTemplate(0, "p_sarna");
     DelayCommand(1.5, ShowPartySelectionGUI(0));
}

Then follow the instructions to correct your registry like I linked to with my first reply...

Or add another registry entry that matches the one required but points to your actual install location.

Share this post


Link to post
Share on other sites
1 minute ago, Thor110 said:

Then follow the instructions to correct your registry like I linked to with my first reply...

Or add another registry entry that matches the one required but points to your actual install location.

The problem is that KotOR Scripting Tool, downloaded here, KotOR Scripting Tool - Modding Tools - Deadly Stream, will not recognize the path to the Steam version of KotOR.

Share this post


Link to post
Share on other sites
4 minutes ago, Neville said:

The problem is that KotOR Scripting Tool, downloaded here, KotOR Scripting Tool - Modding Tools - Deadly Stream, will not recognize the path to the Steam version of KotOR.

That is why I said you need to change the registry entry for the game so that it will recognize the path to the Steam version of kotor...

Share this post


Link to post
Share on other sites
2 minutes ago, Thor110 said:

That is why I said you need to change the registry entry for the game so that it will recognize the path to the Steam version of kotor...

How do I do that?

Share this post


Link to post
Share on other sites
Just now, Neville said:

How do I do that?

Try following one of the links I sent you and forget about the fact it mentions kotor tool for a moment, read some of the other comments and see that people have the same problem as you, then continue reading to the comments that mention how to solve said issue...

Share this post


Link to post
Share on other sites
1 minute ago, Thor110 said:

Try following one of the links I sent you and forget about the fact it mentions kotor tool for a moment, read some of the other comments and see that people have the same problem as you, then continue reading to the comments that mention how to solve said issue...

I have been looking all day. I have "nwscript.nss" in my Override folder, and I do not understand why the program stopped recognizing the Steam version.

Share this post


Link to post
Share on other sites
4 minutes ago, Neville said:

I have been looking all day. I have "nwscript.nss" in my Override folder, and I do not understand why the program stopped recognizing the Steam version.

Just correct the registry entry or add another one specifically for KotOR Scripting Tool.

Did you happen to install it from disc the other day and uninstall it? Pretty sure I read that you did in one of your posts from the other day.

Also as for

6 hours ago, Neville said:

I do not understand tutorials on destroying the original NPC,

Spoiler

void main() {
    if ((IsAvailableCreature(0) == 0)) {
        AddAvailableNPCByTemplate(0, "end_trask");
        SetAreaUnescapable(0);
        DelayCommand(0.1, ShowPartySelectionGUI("k_pend_reset", 0, 0xFFFFFFFF));
        DelayCommand(0.1, DestroyObject(OBJECT_SELF, 0.0, 1, 0.0));
        ActionStartConversation(GetFirstPC(), "end_trask01", 0, 0, 1, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0);
    }
}
 

Depending on what is firing

If the character that you want to delete fires the script for example from a dialog initiated with them you would simply use the following line

DestroyObject(OBJECT_SELF, 0.0, 1, 0.0);

the above example is from the Endar Spire.

It checks if slot 0 is free

then adds trask to slot 0

then sets the area to be unescapable ( can't change party )

the next two lines are set to a short delay of 0.1 seconds.

the first delayed line shows the party selection screen via a script and forces you to select slot 0, then sets the second forced slot to -1 or 0xFFFFFFFF

the second delayed line then destroys itself ( this would be Trask )

before starting the conversation with the player character using the dialog "end_trask01"

which will start the dialog with yourself but because Trask is now present behind you after being added to the party, the conversation is started with them.

I cut out a few lines from the above example that won't be relevant to you.

The solution is fix the registry or install to the original directory. ( alternatively you could try dumping dialog.tlk, chitin.key and the override + nwscript.nss ) into the original directory, I am not sure how much of the game it actually needs.

Share this post


Link to post
Share on other sites
25 minutes ago, Thor110 said:

Just correct the registry entry or add another one specifically for KotOR Scripting Tool.

Did you happen to install it from disc the other day and uninstall it? Pretty sure I read that you did in one of your posts from the other day.

Also as for

  Hide contents

void main() {
    if ((IsAvailableCreature(0) == 0)) {
        AddAvailableNPCByTemplate(0, "end_trask");
        SetAreaUnescapable(0);
        DelayCommand(0.1, ShowPartySelectionGUI("k_pend_reset", 0, 0xFFFFFFFF));
        DelayCommand(0.1, DestroyObject(OBJECT_SELF, 0.0, 1, 0.0));
        ActionStartConversation(GetFirstPC(), "end_trask01", 0, 0, 1, "", "", "", "", "", "", 0, 0xFFFFFFFF, 0xFFFFFFFF, 0);
    }
}
 

Depending on what is firing

If the character that you want to delete fires the script for example from a dialog initiated with them you would simply use the following line

DestroyObject(OBJECT_SELF, 0.0, 1, 0.0);

the above example is from the Endar Spire.

It checks if slot 0 is free

then adds trask to slot 0

then sets the area to be unescapable ( can't change party )

the next two lines are set to a short delay of 0.1 seconds.

the first delayed line shows the party selection screen via a script and forces you to select slot 0, then sets the second forced slot to -1 or 0xFFFFFFFF

the second delayed line then destroys itself ( this would be Trask )

before starting the conversation with the player character using the dialog "end_trask01"

which will start the dialog with yourself but because Trask is now present behind you after being added to the party, the conversation is started with them.

I cut out a few lines from the above example that won't be relevant to you.

The solution is fix the registry or install to the original directory. ( alternatively you could try dumping dialog.tlk, chitin.key and the override + nwscript.nss ) into the original directory, I am not sure how much of the game it actually needs.

I have tried most of that, but I will try again tomorrow. I had the CD version installed, but the script should have compiled anywhere. Thank you for your advice.

Share this post


Link to post
Share on other sites
45 minutes ago, Neville said:

I had the CD version installed, but the script should have compiled anywhere.

Scripts compile in the folder/directory of the first opened script in kotor scripting tool, for example if you open one script and then another in another folder, they will compile to the first folder, I find this frustrating but am use to it now.

If you had the CD version installed then I am guessing you uninstalled it, which would have deleted the registry entry for it. lol

You can either recreate the registry entry as shown in one of the links I posted or you can reinstall it.

Share this post


Link to post
Share on other sites

I saved to my Steam Apps KotOR Override folder and I set my KotOR Tool Path to the Steam version. It will not compile my script. Is there a way for another person to compile my source script?

Share this post


Link to post
Share on other sites

You need to use RegEdit.

This is potentially dangerous, as your registry is the root file system, but if you follow the instructions that someone keeps banging their head against a wall for you, you can do it safely.

RegEdit is a Windows program. You open it by right-clicking start, search for cmd.exe. This can also be accomplished by Windows Key + R, then entering

regedit

.

Then you will need to find the path specified. I felt like you weren't getting this, and so hopefully this is the clue you needed.

Share this post


Link to post
Share on other sites
11 hours ago, Qui-Gon Glenn said:

You need to use RegEdit.

This is potentially dangerous, as your registry is the root file system, but if you follow the instructions that someone keeps banging their head against a wall for you, you can do it safely.

RegEdit is a Windows program. You open it by right-clicking start, search for cmd.exe. This can also be accomplished by Windows Key + R, then entering


regedit

.

Then you will need to find the path specified. I felt like you weren't getting this, and so hopefully this is the clue you needed.

How would RegEdit help when I have set KotOR Tool to the proper directory, yet its script editor keeps stating "Lookup path root set to C:\Program Files\LucasArts\SWKotOR" "Error: Couldn't initialize the NwnStdLoader" and there is no way to alter the path for KotOR Scripting Tool (https://deadlystream.com/files/file/191-kotor-scripting-tool/),  which gives the same message? The problem is changing directory.

Share this post


Link to post
Share on other sites

The thing is, most modding tools were made before the Steam version.
The old disc versions created registry entries such as the path to where the game was installed to. Those old modding tools still try to look up that registry entry to know where the game is located. The Steam version doesn't create that entry so you need to recreate the entry and have it point to where your Steam version is located.
My Steam guide may provide some more context: https://steamcommunity.com/sharedfiles/filedetails/?id=779622644

That said, I also ran into problems with the compiler from one day to the next, I think I reinstalled something and then it worked again. Weirdness... if you're sure the registry entry is good then at least you can rule that out.

Anyway, I don't mind compiling things for you, but I got errors on both scripts so it's best if you can experiment on your own.
I'm not an expert but I think these were the issues:

add_sarna.nss:

ShowPartySelectionGUI(0)

...gives me an error, it works without the zero parameter and I see it without the 0 here: https://bioshazard.proboards.com/thread/18/recruit-npc.
You're using DestroyObject to remove the NPC in both scripts, I think that's only needed once (in the "bye" script).
B.t.w. you're replacing Bastila's slot if you use slot 0 (a row from npc.2da), just so you know, not sure if you intended to do that.

bye_sarna.nss:
Here you made an object:

object oNpc = GetObjectByTag("tar02_sarna022");

But you didn't use it in the rest of the script, so I changed...

DelayCommand(1.0, DestroyObject("n_sarna"));

to...

DelayCommand(1.0, DestroyObject(oNpc));

bye_sarna.nss bye_sarna.ncs

add_sarna.ncs add_sarna.nss

Share this post


Link to post
Share on other sites
5 hours ago, Effix said:

The thing is, most modding tools were made before the Steam version.
The old disc versions created registry entries such as the path to where the game was installed to. Those old modding tools still try to look up that registry entry to know where the game is located. The Steam version doesn't create that entry so you need to recreate the entry and have it point to where your Steam version is located.
My Steam guide may provide some more context: https://steamcommunity.com/sharedfiles/filedetails/?id=779622644

Anyway, I don't mind compiling things for you, but I got errors on both scripts so it's best if you can experiment on your own.
I'm not an expert but I think these were the issues:

add_sarna.nss:


ShowPartySelectionGUI(0)

...gives me an error, it works without the zero parameter and I see it without the 0 here: https://bioshazard.proboards.com/thread/18/recruit-npc.
You're using DestroyObject to remove the NPC in both scripts, I think that's only needed once (in the "bye" script).
B.t.w. you're replacing Bastila's slot if you use slot 0 (a row from npc.2da), just so you know, not sure if you intended to do that.

bye_sarna.nss:
Here you made an object:


object oNpc = GetObjectByTag("tar02_sarna022");

But you didn't use it in the rest of the script, so I changed...


DelayCommand(1.0, DestroyObject("n_sarna"));

to...


DelayCommand(1.0, DestroyObject(oNpc));

add_sarna.ncs 212 B · 0 downloads add_sarna.nss 217 B · 0 downloads bye_sarna.nss 252 B · 0 downloads bye_sarna.ncs 243 B · 0 downloads

It is my intent to create a character that will replace Bastila after she is captured aboard the Leviathan. I had a line in the script to create "0, "p_sarna"" Thank you for your help in making this possible. Sarna has the template n_sarna, but her Template ResRef is tar02_sarna021. That was an error. I still do not understand why the .utc file will not save with the portrait "po_psarna".

  • Like 1

Share this post


Link to post
Share on other sites

I think I attached the wrong version of add_sarna (nss & ncs), I've updated them in my post above (not in your quote of my post).

Share this post


Link to post
Share on other sites
10 hours ago, Effix said:

I think I attached the wrong version of add_sarna (nss & ncs), I've updated them in my post above (not in your quote of my post).

I checked the updated files. You included RemoveAvailableNPC(0). That removes Bastila. This is intended to create a replacement for her after her capture, and that line will create bugs.  I was actually trying to remove the NPC version of Sarna and add the party version. The NPC template .utc is n_sarna, tag Sarna021, Template ResRef tar02_sarna021. The party template .utc is p_sarna. Would two commands to destroy the pre-recruit NPC cause problems? 

20210528142646_1.jpg

20210531170144_1.jpg

Share this post


Link to post
Share on other sites
1 hour ago, Neville said:

I checked the updated files. You included RemoveAvailableNPC(0). That removes Bastila. This is intended to create a replacement for her after her capture, and that line will create bugs.  I was actually trying to remove the NPC version of Sarna and add the party version. The NPC template .utc is n_sarna, tag Sarna021, Template ResRef tar02_sarna021. The party template .utc is p_sarna. Would two commands to destroy the pre-recruit NPC cause problems?

 

"and that line will create bugs"
What do you mean? The only way to add a party member is to replace one. Feel free to pick another.
I understand you want to remove the NPC Sarna, but that fact still remains. There's a set amount of party members, not very dynamic, but that's what it is.

Not sure if two scripts trying to remove the NPC would cause a problem, probably not, but why would you? One script action will fail, do nothing.

Share this post


Link to post
Share on other sites
10 minutes ago, Effix said:

"and that line will create bugs"
What do you mean? The only way to add a party member is to replace one. Feel free to pick another.
I understand you want to remove the NPC Sarna, but that fact still remains. There's a set amount of party members, not very dynamic, but that's what it is.

Not sure if two scripts trying to remove the NPC would cause a problem, probably not, but why would you? One script action will fail, do nothing.

Bastila is removed from the party on the Leviathan, similar to Trask being removed from the party on the Endar Spire. Sarna is intended to become a character available to join your party after Bastila is removed. If you set a command to remove a party member that has already been removed, the tools I was using state it can screw up the game.

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.