PDA

View Full Version : [TSL]check if all party members are Jedi


Masaru93
08-04-2007, 03:25 AM
I have an idea for TSL that, pending that Mira, Atton, Brianna/Mical, and Bao-Dur have all gained their Jedi classes at the same time, you get an item from a certain place/thing. However, conditional scripts aren't exactly my strong point, and I was wondering what the script would be. If I knew what I needed, I could probably take it from there.

stoffe
08-04-2007, 05:10 AM
I have an idea for TSL that, pending that Mira, Atton, Brianna/Mical, and Bao-Dur have all gained their Jedi classes at the same time, you get an item from a certain place/thing. However, conditional scripts aren't exactly my strong point, and I was wondering what the script would be. If I knew what I needed, I could probably take it from there.

If I understand what you want correctly then you want to check if all party members who are capable of doing so to have gained Jedi classes, and not just all of those two characters you have with you at the time, correct?

Since you can only check the class of the party members you have with you at the time, not the others unless you spawn them in from the party table, it's probably easier to add a new global variable to keep track of this which you can then check for. It could be done like this:
Add a new line to the globalcat.2da file. Set the (Row Label) column to the next number in sequence, the name column to MadeJediCount and the type column to Number.


Then you need to modify the script that is run to turn your party members into Jedi to modify this Global Variable when it does so. The script is a_makejedi.nss, change it like below, recompile it and put the NCS file in the override folder:

// a_makejedi.nss

void main() {
// Grab the Parameter.
int nScriptNumber = GetScriptParameter( 1 );

if ( nScriptNumber == 0 ) {
SetGlobalNumber("MadeJediCount", GetGlobalNumber("MadeJediCount") + 1);
AddMultiClass (CLASS_TYPE_JEDISENTINEL, GetObjectByTag ("Atton") );
}
else if ( nScriptNumber == 1 ) {
SetGlobalNumber("MadeJediCount", GetGlobalNumber("MadeJediCount") + 1);
AddMultiClass (CLASS_TYPE_JEDIGUARDIAN, GetObjectByTag ("BaoDur") );
}
else if ( nScriptNumber == 4 ) {
SetGlobalNumber("MadeJediCount", GetGlobalNumber("MadeJediCount") + 1);
AddMultiClass (CLASS_TYPE_JEDIGUARDIAN, GetObjectByTag ("Handmaiden") );
}
else if ( nScriptNumber == 7 ) {
SetGlobalNumber("MadeJediCount", GetGlobalNumber("MadeJediCount") + 1);
AddMultiClass (CLASS_TYPE_JEDISENTINEL, GetObjectByTag ("Mira") );
}
else if ( nScriptNumber == 11 ) {
SetGlobalNumber("MadeJediCount", GetGlobalNumber("MadeJediCount") + 1);
AddMultiClass (CLASS_TYPE_JEDICONSULAR, GetObjectByTag ("Disciple") );
}
}

This script will now increase the value of the counter global variable by 1 every time someone is given their Jedi multiclass.


Finally, the dialog conditional script that checks this variable to see if everyone has been made into Jedi:

int StartingConditional() {
return ( (((GetGlobalNumber("MadeJediCount") >= 4) && IsAvailableCreature(NPC_MIRA))
|| ((GetGlobalNumber("MadeJediCount") >= 3) && IsAvailableCreature(NPC_HANHARR)))
&& IsAvailableCreature(NPC_KREIA)
&& IsAvailableCreature(NPC_VISAS));
}

This conditional script is checking if at least four people have been turned into Jedi and Mira is a partymember, OR at least three people have been turned into jedi and Hanharr has joined instead, AND that Kreia and Visas have joined. I.e. checks if anyone who can be a force user in the party is so.


Edit: Oops, fixed a mistake in the conditional script :)