(KOTOR 1)
I'm trying to write a script that will execute several actions whenever any of three dialog choices are made. My problem is that the script needs to perform slightly different tasks depending on which of the three dialog items was spoken. I've been trying to use GetLastConversation(), but the script crashes whenever that is used. Is there any way to signal to the script what dialog choice was just made? Maybe something similar to TSL's script parameters?
The script:
//This method is called from Main()
int GetKillType()
{
if (FindSubString(GetLastConversation(), "friend") > -1) { return 0; }
if (FindSubString(GetLastConversation(), "neutral") > -1) { return 1; }
if (FindSubString(GetLastConversation(), "enemy") > -1) { return 2; }
return -1;
}
You might be able to use local variables that set themself at one point in the dialogue depending on what dialogue option is chosen and then the scripts get what local variable has been set and executes a set of commands based on which local variable has been set.
http://www.lucasforums.com/showthread.php?t=173587)
that might help. It says its for TSL but it works with the first one as well.
Not sure whether this is what your after.
TB12
If it's in a dialog you can use the script a_local_set that comes with the game for this. Assign it to a Script slot of a dialog node and set the first parameter (P1) to the index of the LocalBoolean slot you wish to set.
Are you sure this is compatible with kotor 1? There's no "a_local_set.nss" in "Kotor 1/Bifs/scripts.bif/scripts, source".
Also, do you know how to set parameters in DLGEditor?
Ah didn't see that bit. It uses the Parameters to set the appropriate variables. There are local variables for kotor cos ive used them.
You can use the commands
GetLocalBoolean
SetLocalBoolean
GetLocalNumber
SetLocalNumber
Not sure if there is a tutorial on this though.
Parameters can only be set in TSL mode as it is only TSL that supports them.
Okay. Will those values persist over multiple script calls from different dialog nodes? If so, then I can have three different scripts that set the killtype value on the clone object, and then just one that actually does the grunt work. It wasn't having several scripts that bothered me, it was the idea of having to keep three copies of the main script up-to-date and bug free. :)
those values will persist yes.