PDA

View Full Version : Make players choose jedi classes of companions?


Andrei Gijgorev
05-26-2009, 06:43 AM
I want to make players being able to choose the jedi class each companion evolves into by themselves, is that even possible? If so, what would have to be done for that?

Demongo
05-26-2009, 06:56 AM
I want to make players being able to choose the jedi class each companion evolves into by themselves, is that even possible? If so, what would have to be done for that?

Do you mean if the player speaks to the party member, he can choose the class for him/her? If so, then here's a script:
void main()
{
AddMultiClass( CLASS_TYPE_JEDIGUARDIAN, GetObjectByTag("Mission"));

}

You can change the "CLASS_TYPE_JEDIGUARDIAN" line to these:
CLASS_TYPE_JEDIGUARDIAN
CLASS_TYPE_JEDICONSULAR
CLASS_TYPE_JEDISENTINEL
CLASS_TYPE_SOLDIER
CLASS_TYPE_SCOUT
CLASS_TYPE_SCOUNDREL
CLASS_TYPE_MINION
CLASS_TYPE_EXPERTDROID
CLASS_TYPE_COMBATDROID

And you can change Mission to the name of the party member.

Andrei Gijgorev
05-26-2009, 07:00 AM
I mean that the one time a character becomes a jedi, the player get's to choose which class, like you could choose your own jedi class in K1. I'm not sure if your script does that, it seems way too short for me. Also, where would I add it?

Demongo
05-26-2009, 08:55 AM
I mean that the one time a character becomes a jedi, the player get's to choose which class, like you could choose your own jedi class in K1. I'm not sure if your script does that, it seems way too short for me. Also, where would I add it?

The script I wrote adds another class to a party member, so if you only want to give your party member a new jedi class, this wroks.

To activate it in a converstaion, write the name of the compiled script in the "script fires when spoken" box in the dlg editor. For further information about dialogs, see this thread:
http://lucasforums.com/showthread.php?t=180845

Andrei Gijgorev
05-26-2009, 01:13 PM
I think I get it now. Could someone please mail me a save where you can turn the Handmaiden into a jedi right away? My e-mail address is gijgorev{at}googlemail{dot}com.
Thanks in advance!

Edit: The conditionals in .dlg files, do they have to be declared somewhere or can I just add my own ones without further ado?

arthurconandoyle12
05-26-2009, 03:06 PM
you dont need to go trough that trouble... just dont level her when she joins and when you make her a jedi later all those levels she didnt get go into the jedi class


and yeah if someone made a mini mod like this itd be cool. i mean choosing your party members jedi class

Andrei Gijgorev
05-26-2009, 03:09 PM
Making a mod out of this is exactly what I'm going to do. If I just wanted to change one NPC class for one game, I wouldn't even bother with scripting.

dholm
05-26-2009, 03:18 PM
I imagine you'd have to find the script that gives them the classes in question in the first place to see what it does.

If I understand you correctly, you want to choose which class your party members get when you turn them into a Jedi in TSL? So instead of Atton always getting Jedi Sentinel, you could choose.

Andrei Gijgorev
05-26-2009, 03:32 PM
Yes, exactly. Derived from the script DathDac posted, I came up with this:

// This global script is intended to be used for making each CNPC a Jedi.
/* Parameter Count: 2 (Which CNPC you intend to make a Jedi. / Which Jedi class to apply.)

NPC numbers, as specified in NPC.2da
0 Atton
1 BaoDur
2 Mand
3 g0t0
4 Handmaiden
5 hk47
6 Kreia
7 Mira
8 T3m4
9 VisasMarr
10 Hanharr
11 Disciple

Class Numbers, as specified in classes.2da
3 CLASS_TYPE_JEDIGUARDIAN
4 CLASS_TYPE_JEDICONSULAR
5 CLASS_TYPE_JEDISENTINEL

*/

//// Andrei Gijgorev 26-05-09

void main()
{
// Grab the Parameters.
int nNPCNumber = GetScriptParameter(1);
int nClassNumber = GetScriptParameter(2);

// If Param = 0, then it's Atton. (Trying to make it consistent with the CNPC integers.)
if(nNPCNumber == 0)
{
// Params as defined above (Trying to make it consistent with the classes integers.)
if(nClassNumber == 3) AddMultiClass(CLASS_TYPE_JEDIGUARDIAN, GetObjectByTag("Atton"));
else if(nClassNumber == 4) AddMultiClass(CLASS_TYPE_JEDICONSULAR, GetObjectByTag("Atton"));
// Default class in case something went wrong.
// else if(nClassNumber == 5) AddMultiClass(CLASS_TYPE_JEDISENTINEL, GetObjectByTag ("Atton"));
else AddMultiClass(CLASS_TYPE_JEDISENTINEL, GetObjectByTag("Atton"));
}

// If Param = 1, then it's Bao-Dur. (Trying to make it consistent with the CNPC integers.)
if(nNPCNumber == 1)
{
// Params as defined above (Trying to make it consistent with the classes integers.)
if(nClassNumber == 4) AddMultiClass(CLASS_TYPE_JEDICONSULAR, GetObjectByTag("BaoDur"));
else if(nClassNumber == 5) AddMultiClass(CLASS_TYPE_JEDISENTINEL, GetObjectByTag("BaoDur"));
// Default class in case something went wrong.
// else if(nClassNumber == 3) AddMultiClass(CLASS_TYPE_JEDIGUARDIAN, GetObjectByTag("BaoDur"));
else AddMultiClass(CLASS_TYPE_JEDIGUARDIAN, GetObjectByTag("BaoDur"));
}

// If Param = 4, then it's the Handmaiden. (Trying to make it consistent with the CNPC integers.)
if(nNPCNumber == 4)
{
// Params as defined above (Trying to make it consistent with the classes integers.)
if(nClassNumber == 4) AddMultiClass(CLASS_TYPE_JEDICONSULAR, GetObjectByTag("Handmaiden"));
else if(nClassNumber == 5) AddMultiClass(CLASS_TYPE_JEDISENTINEL, GetObjectByTag("Handmaiden"));
// Default class in case something went wrong.
// else if(nClassNumber == 3) AddMultiClass(CLASS_TYPE_JEDIGUARDIAN, GetObjectByTag("Handmaiden"));
else AddMultiClass(CLASS_TYPE_JEDIGUARDIAN, GetObjectByTag("Handmaiden"));
}

// If Param = 7, then it's Mira. (Trying to make it consistent with the CNPC integers.)
if(nNPCNumber == 7)
{
// Params as defined above (Trying to make it consistent with the classes integers.)
if(nClassNumber == 3) AddMultiClass(CLASS_TYPE_JEDIGUARDIAN, GetObjectByTag("Mira"));
else if(nClassNumber == 4) AddMultiClass(CLASS_TYPE_JEDICONSULAR, GetObjectByTag("Mira"));
// Default class in case something went wrong.
// else if(nClassNumber == 5) AddMultiClass(CLASS_TYPE_JEDISENTINEL, GetObjectByTag ("Mira"));
else AddMultiClass(CLASS_TYPE_JEDISENTINEL, GetObjectByTag("Mira"));
}

// If Param = 11, then it's the Disciple. (Trying to make it consistent with the CNPC integers.)
if(nNPCNumber == 11)
{
// Params as defined above (Trying to make it consistent with the classes integers.)
if(nClassNumber == 3) AddMultiClass(CLASS_TYPE_JEDIGUARDIAN, GetObjectByTag("Disciple"));
else if(nClassNumber == 5) AddMultiClass(CLASS_TYPE_JEDISENTINEL, GetObjectByTag("Disciple"));
// Default class in case something went wrong.
// else if(nClassNumber == 4) AddMultiClass(CLASS_TYPE_JEDICONSULAR, GetObjectByTag("Disciple"));
else AddMultiClass(CLASS_TYPE_JEDICONSULAR, GetObjectByTag("Disciple"));
}
}

//EOF

This script does work as planned, but the choice between the Jedi classes has to be implemented somewhere in the .dlg files. Now not only do I have to add dialogue nodes, I also have to add entries in the dialog.tlk, which is a bit much for such a little mod. Also, most dialogues where NPCs become Jedi already include the name of the class ("blah has taken his first step to become a Jedi Consular blah") or lack a place where the choice would fit in. Regarding the Disciple, the best place for the choice would be right after "I want you to teach me the ways of the Force. To become a Jedi Knight, what I meant to be", since from that point on it's only "the Force this" and "the Force that" without room for anything else. So I have to set up some booleans and check them later, but I don't know what the lines should look like in the game. Should it be something like "I shall now train you in the ways of a Jedi Consular" or just "[Jedi Consular]"?

Demongo
05-26-2009, 03:41 PM
Now not only do I have to add dialogue nodes, I also have to add entries in the dialog.tlk, which is a bit much for such a little mod.

You have to? I did a mod with this script and I didn't do anything with dialog.tlk. It was for K1 though. I don't know if TSL requires .tlk editing but K1 doesn't:)

Should it be something like "I shall now train you in the ways of a Jedi Consular" or just "[Jedi Consular]"?

It is better and more realistic if the player actually says something. So I think you should make something like what you mentioned:
"I shall now train you in the ways of a Jedi Consular"

Andrei Gijgorev
05-26-2009, 03:49 PM
Well, since this line isn't anywhere in dialog.tlk (at least I think it isn't), I'll have to add it, unless of course you know a method that allows me to add dialogue lines in TSL without adding them to dialog.tlk.

BTW, I can't find Mira's dialogue to turn her into a jedi. Is it in another .dlg file?

Demongo
05-26-2009, 04:00 PM
BTW, I can't find Mira's dialogue to turn her into a jedi. Is it in another .dlg file?

Well it should be in Mira's basic .dlg file but if it isn't there, try searching it in Nar Shadaa .dlg files.

Well, since this line isn't anywhere in dialog.tlk (at least I think it isn't), I'll have to add it, unless of course you know a method that allows me to add dialogue lines in TSL without adding them to dialog.tlk.

As I said I don't know if TSL requires this, but I could do it in K1 without touching dialog.tlk

stoffe
05-26-2009, 06:07 PM
Well, since this line isn't anywhere in dialog.tlk (at least I think it isn't), I'll have to add it, unless of course you know a method that allows me to add dialogue lines in TSL without adding them to dialog.tlk.

You can store the text of the dialog nodes directly in the DLG file without having to place them in the TLK file.

If you use tk102's DLG Editor it will do this for you automatically, which I'd recommend using unless you have a compelling reason not to, since it makes things a lot quicker and easier. :) If you're using a GFF editor you set the StrRef to -1 in the ExoLocString field and then add language specific substrings to that struct or list, if I remember correctly (been a while since I was last looking at that.)

Andrei Gijgorev
05-28-2009, 02:17 PM
It works, thanks a lot. You probably also happen to know how I can set up and check booleans in a .dlg without specifying them in some global array, right?

EDIT: Actually, scrap the last part. I just found out that those "conditionals" aren't booleans at all, but scripts / functions that return booleans. Oh well...

EDIT2: How can I check whether a character belongs to a certain class? My first thought was something along the lines of "return GetLevelByClass(CLASS, NPC);", but since any convertable npc starts off without jedi class levels this can't work. Any ideas?

EDIT3: Nevermind, GetClassByPosition() did the trick.

If anyone happens to have vanilla (or nearly-vanilla) savegames where you can turn party members into jedi right away, please mail them to gijgorev{at}googlemail{dot}com. So far, only the disciple has been tested:

http://www.abload.de/img/adjec0zxaa.jpg

Andrei Gijgorev
06-03-2009, 03:36 PM
Alright, the mod has been finished, tested, submitted, and receiving approval, so you can now download it at KotORFiles (http://knightsoftheoldrepublic.filefront.com/file/Andreis_Dynamic_Jedi_Classes_ADJEC;100051) if you're interested.