Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

Making NPCs Hostile? (TSL)

Page: 1 of 1
 rnaj525
06-17-2011, 8:25 PM
#1
Hey all. What I'm trying to do is trigger an NPC to become hostile via dialog for the second Knights of the Old Republic game. For an example, being able to kill Jana Lorso by first clicking on her to talk to her, then selecting a dialog option that triggers her to become hostile, allowing you to kill her. Pretty much just like the Kill Yuka Laka and Kill Gorton mods for the first game, only for TSL. I know it's done through scripting, but I can't figure out exactly how to do it. I have Kotor Tool, so just walking me through it will be much appreciated.

Also, if there is already a thread that explains how to do this, please post the link and lock this one. Thanks.
 Ferc Kast
06-17-2011, 10:56 PM
#2
Well, this should the trick; You'll just need to attach it to the dialog, after changing the npc tag to Jana Lorso's. (I checked nwscript.nss & this script is compatible with both KotOR I & II.)

void main() {
object oNPC = GetObjectByTag("npc_tag");
int iFaction = STANDARD_FACTION_HOSTILE_1;
ChangeToStandardFaction(oNPC, iFaction);
}
 rnaj525
06-18-2011, 12:49 AM
#3
Thanks, but if you don't mind me asking, what dialog do I attach it to? I assume the dialog file with the said NPC, in this case Jana Lorso. However, I looked all over Kotor Tool for the past hour or so with no luck in finding her .dlg file. Is there something I'm missing?
 JebusJM
06-18-2011, 12:58 AM
#4
Script that fires at end of the conversation.
 Istorian
06-18-2011, 3:50 AM
#5
Well, Jana Lorso's dlg is 203lorso.dlg which is located in the 209tel_dlg.erf file. And Jana Lorso's utc file is somewhat hidden, as it's resref is n_czerkaoff001. It's Tag though is 203_Lorso. Also, if you want to gibe the NPC a "kick" so they attack you, the script should look something like this:



void main()
{

object oNPC = GetObjectByTag("203_Lorso");
int iFaction = STANDARD_FACTION_HOSTILE_1;

ChangeToStandardFaction(oNPC, iFaction);

ExecuteScript("k_ai_master", oNPC, 1005);

}



EDIT: Sorry, I had forgot to put the "k_ai_master" string! :P
 harark1
06-18-2011, 10:45 AM
#6
Finally there is a question I can anwser but you beat me to it. Just my luck, :lol:.
 rnaj525
06-18-2011, 10:49 AM
#7
Thanks, that helps ALOT. Now that I know the code and the .dlg and .utc files, I just need to know where I attach the code onto either file. Now, what I'm trying to do is more or less make it so that if you help the Ithorians and bring the droid intelligence to them, and Jana says something along the lines of:

"I simply do not have time for you. My hands are full with managing the restoration project without a droid intelligence, which you so kindly handed to the Ithorians"

I want to make a dialog option I can select which will trigger her to become hostile, allowing me to kill her. I know where her .dlg and .utc files are now, and the code to make her hostile, I just need to know exactly where I put the code, and my custom dialog which will trigger it.
 Istorian
06-18-2011, 1:55 PM
#8
Well, first of all, change the script because I haven't posted it correctly at first. Now it's edited and should work fine! ;)

Now, you won't need to touch poor Jana's utc file, the only thing you need to be able to slice her is to tweak a bit her dialogue. Just go in the entry (red lines) of Jana that says:

"I simply do not have time for you. My hands are full with managing the restoration project without a droid intelligence, which you so kindly handed to the Ithorians"

right click and select Add New Reply. A blue line will appear below Jana's Entry. In the wide white box on the right you can write what you want the Exile to say, and in the left, in the box that says Script #1 just put the name of the script you've compiled, the script above (without the .ncs extension). Then save you .dlg file (do not change its name), and put both this and the .ncs compiled script in the override folder of your game. Done correctly, it should work like a charm! o_Q
 rnaj525
06-18-2011, 8:25 PM
#9
I noticed that there isn't a tab on the Conversation Editor that says "Script #1"

There is however, "Node Scripts" "This File 1" "This File 2" "This File 3"

Is it one of those? And if so, what box do I place the script name in? e.i. "End Conv Normal Script" "Script to run for this node" etc.

And lastly, does it matter what I name the custom script with the code to make the NPC hostile?

Sorry for all the nooby questions, but this is the first time I've done modding outside editing .2da files and .utc files.
 Qui-Don Jorn
06-18-2011, 9:19 PM
#10
First off, I would download DlgEditor by tk102 from here...
http://www.lucasforums.com/showthread.php?s=&threadid=135639)

I find it better than trying to use KotORTool for dialog stuff..no offense to Fred.

All you really have to do is open the Jana dialog with it, find the node you want to have her go hostile on, and then type "a_hostile" (without the quotes) in one of the two script boxes. Then put her tag in the box on the right side of where you put the script...but do what Istorian said about the "adding new reply" first, if you want multiple options. It might be a good idea to find the end of that conversation if its applicable too.
It might loook like this..
http://www.lucasforums.com/picture.php?albumid=716&pictureid=8283)

Also turn the "view scripts" and conditionals on before you get started editing..I do that first thing.
 rnaj525
06-19-2011, 12:30 AM
#11
 Istorian
06-19-2011, 3:42 AM
#12
Yes, that is correct! The "a_hostile" is a script of the game that does exactly the same as my previous script, but is tremendously better, as it takes the Tag of the NPC you want to fight from the Script Param (Parameter) box. Therefore, it is a standarized script and saves you the need to create many scripts if you want more NPC's with other Tags to become hostile later on. As your scripting experiences grow, you'll find that the power of the script parameters is enormous. This (http://www.lucasforums.com/showthread.php?t=195438) tutorial by glovemaster will help you quite a bit. ;)
 rnaj525
06-19-2011, 10:26 AM
#13
It worked, thanks everyone for your time :thmbup1: Also, thanks Istorian for the link, it should help me out lots.
 Qui-Don Jorn
06-20-2011, 8:33 PM
#14
right on..:)
Page: 1 of 1