Jump to content

Home

There's got to be a better way of doing this...


mrdefender

Recommended Posts

Ok, this is somewhat rediculous, I've got 72 scripts here, 9 per party member with 8 party members.. All of them add a jedi/sith multiclass from consular to master.

 

Is there a way that I only need one file per party member, taking it down from 72 to 8 scripts?

 

In the file:

void main() { AddMultiClass( CLASS_TYPE_JEDICONSULAR, GetObjectByTag("Atton")); }

 

Can I use this somehow?

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

 

I was thinking perhaps adding this line to a script field in a dialogue editor:

 

a_makemyjedi 5 , which would make them a jedi master or something..

 

Perhaps something like this?

 

    if ( nScriptNumber == 5 ) { AddMultiClass( CLASS_TYPE_JEDICONSULAR, GetObjectByTag("Atton")); }

??

 

I've got 23 scripts in my mod so far, and now there's another 72 comming...

 

Does anyone know if this could work? Or if they have a better idea? Please give alot of details, I'm still new at this whole scripting thing :(

Link to comment
Share on other sites

Originally posted by mrdefender

Can I use this somehow?

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

 

yes and this is what the game uses. It makes things simple and keeps the override folder clean. :

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

   // If Param = 0, then it's Atton. (Trying to make it consistent with the CNPC integers.)
   if ( nScriptNumber == 0 ) {
       AddMultiClass (CLASS_TYPE_JEDISENTINEL, GetObjectByTag ("Atton") );
   }

   // If Param = 1, then it's Bao-Dur. (Trying to make it consistent with the CNPC integers.)
   if ( nScriptNumber == 1 ) {
       AddMultiClass (CLASS_TYPE_JEDIGUARDIAN, GetObjectByTag ("BaoDur") );
   }

   // If Param = 4, then it's the Handmaiden. (Trying to make it consistent with the CNPC integers.)
   if ( nScriptNumber == 4 ) {
       AddMultiClass (CLASS_TYPE_JEDIGUARDIAN, GetObjectByTag ("Handmaiden") );
   }

   // If Param = 7, then it's Mira. (Trying to make it consistent with the CNPC integers.)
   if ( nScriptNumber == 7 ) {
       AddMultiClass (CLASS_TYPE_JEDISENTINEL, GetObjectByTag ("Mira") );
   }

   // If Param = 11, then it's the Disciple. (Trying to make it consistent with the CNPC integers.)
   if ( nScriptNumber == 11 ) {
       AddMultiClass (CLASS_TYPE_JEDICONSULAR, GetObjectByTag ("Disciple") );
   }
}

 

However, if you are trying to give the player the choice of any class, including the weird stuff, verify if there are scripts that check what class is the pc as you could get stuck somewhere (it happened with similar mods in Kotor 1). You can use tk102's findrefs to check this easily.

Link to comment
Share on other sites

That's what I'm basing it on, but I never saw a parameter in the kotor tool's dialogue editor... no "a_makejedi 5" , just "a_makejedi" ...

 

This is what I have so far, in one file.

( train_atton.nss )

void main()
{

int nValue = GetScriptParameter( 1 );
if ( nValue == 1 ) { AddMultiClass (CLASS_TYPE_JEDIGUARDIAN, 	GetObjectByTag ("Atton") ); }
if ( nValue == 2 ) { AddMultiClass (CLASS_TYPE_JEDISENTINEL, 	GetObjectByTag ("Atton") ); }
if ( nValue == 3 ) { AddMultiClass (CLASS_TYPE_JEDICONSULAR, 	GetObjectByTag ("Atton") ); }
if ( nValue == 4 ) { AddMultiClass (CLASS_TYPE_JEDIWEAPONMASTER, GetObjectByTag ("Atton") ); }
if ( nValue == 5 ) { AddMultiClass (CLASS_TYPE_JEDIWATCHMAN, 	GetObjectByTag ("Atton") ); }
if ( nValue == 6 ) { AddMultiClass (CLASS_TYPE_JEDIMASTER, 	GetObjectByTag ("Atton") ); }
if ( nValue == 7 ) { AddMultiClass (CLASS_TYPE_SITHMARAUDER, 	GetObjectByTag ("Atton") ); }
if ( nValue == 8 ) { AddMultiClass (CLASS_TYPE_SITHASSASSIN, 	GetObjectByTag ("Atton") ); }
if ( nValue == 9 ) { AddMultiClass (CLASS_TYPE_SITHLORD, 	GetObjectByTag ("Atton") ); }

}

 

Let's pretend this is a dialogue line:

 

"Train Atton to be a Sith Assassin" runs script "train_atton 8"

 

? Would that work? :confused::(

Link to comment
Share on other sites

Originally posted by mrdefender

So with TK's that would work? :eek:

Yes" open a kotor 2 .dlg with tk's editor and you'll understand... but it has to be a "fresh".dlg directly extracted from the game (make sure it never got saved with Kotor tool).

Link to comment
Share on other sites

Hmmm. something odd is happening.

 

I use 'copy' and 'paste as new' to copy the whole "train options" thing to save time (all 9 classes, plus 3 links)

 

for some reason, Editing the copies changes the "source" of the copy.... errr..

 

Tree 1:

- Make me Jedi

- Make me Sith

- another 10 options

 

Tree 2:

- Make me Jedi

- Make me Sith

- another 10 options.

 

When I copy 'tree 1' and paste it as 'tree 2', what I edit in 'tree 2' also changes 'tree 1'

 

If I were to change "Make Me Jedi" in tree 2 to "Make me a bombad Jedi", "Make me jedi" in tree #1 will also be renamed....

 

Err... Bonk me on the head with a lightsaber and call me binks, does this make any sense to you? :confused::o

Link to comment
Share on other sites

Ah I see the issue -- you are Pasting as New the parent branch. That does not Paste as New all the children... they are just symbolic links. So if you wanted to change "Tree1" to "MyNewTree" you could do that without affecting "Tree2" but the two branches will still share the same children nodes.

 

You'll have to Copy and Paste as New the nodes that you want to affect changes upon.

Link to comment
Share on other sites

Originally posted by mrdefender

Ok, this is somewhat rediculous, I've got 72 scripts here, 9 per party member with 8 party members.. All of them add a jedi/sith multiclass from consular to master.

 

Is there a way that I only need one file per party member, taking it down from 72 to 8 scripts?

(snip)

I was thinking perhaps adding this line to a script field in a dialogue editor:

 

a_makemyjedi 5 , which would make them a jedi master or something..

(snip)

Does anyone know if this could work? Or if they have a better idea? Please give alot of details, I'm still new at this whole scripting thing :(

 

You could also do it this way, with a single reusable script, which is fairly short and flexible:

void main() {
   object oNPC = GetObjectByTag(GetScriptStringParameter());

   if (GetIsObjectValid(oNPC))
       AddMultiClass(GetScriptParameter(1), oNPC);
   else
       SendMessageToPC(GetPartyLeader(), "Meep! No one with that tag found in the area!");
}

 

You could attach that script to the dialog node where you wish to multiclass the character. Then you'd set the first parameter (P1 in tk102's editor) on the dialog node for that script to the class id for the class to multiclass to. This is essentially the line number in the classes.2da file. The standard classes are:

 

0 = Soldier

1 = Scout

2 = Scoundrel

3 = Jedi Guardian

4 = Jedi Consular

5 = Jedi Sentinel

6 = Combat Droid

7 = Expert Droid

8 = Minion (nonpartymember class)

9 = Tech Specialist

11 = Jedi Weapon Master

12 = Jedi Master

13 = Jedi Watchman

14 = Sith Marauder

15 = Sith Assassin

16 = Sith Lord

 

Then you set the String Parameter (labeled String Param in tk102's editor) to the Tag of the creature you want to multiclass. The tags for your standard party members are:

 

atton

baodur

mand

disciple

g0t0

handmaiden

hanharr

hk47

kreia

mira

t3m4

visasmarr

 

I think it's fairly obvious who those tags belong to. :)

Link to comment
Share on other sites

great minds think alike :)

 

Going very well now that I'm using TK's editor lol.

 

Even though there's less scripts, It still comes out to 72 lines in a dialogue file, plus 3 per 8 party members for "return to" stuff, which makes 24. making a total of 96 lines, plus 8 for the fancy menu info for the section, plus 2 to return to "additional options" and "workbench options", bringing the final result to 106 :eek::o

 

Sometimes I wonder how game modders that don't have this great community ever get their mods done lol

Link to comment
Share on other sites

Use something like:

 int nValuea = GetScriptParameter( 1 );
 int nValueb = GetScriptParameter( 2 );
 int nValuec = GetScriptParameter( 3 );

 

you certainly noticed that there were 5 little boxes for each .dlg branch: P1, P2, P3, P4, P5

 

int nValuea = GetScriptParameter( 1 ) would check P1, etc...

 

 

You also have the possibility to fire 2 scripts and 2 conditional scripts from a .dlg file if you ever need to.

Link to comment
Share on other sites

Originally posted by mrdefender

Cool. thx :)

 

do u know what the conditional fields are for? :confused:

USe them if you want to make a dialogue branch available at certain conditions

 

example:

int StartingConditional()
{
   int nCompareLowAmt = GetScriptParameter( 1 );
   int nCompareHighAmt = GetScriptParameter( 2 );
   if( ( GetAbilityScore( GetPCSpeaker(), ABILITY_WISDOM ) >= nCompareLowAmt ) &&
       ( GetAbilityScore( GetPCSpeaker(), ABILITY_WISDOM ) <= nCompareHighAmt ) ) {
       return TRUE;
   }
   return FALSE;
}

will make dlg branch available only if the PC has a wisdom of more than a certain value and less than another value.

 

Originally posted by mrdefender

do u know why tk never thought of releasing a help file? :o

http://www.lucasforums.com/showthread.php?s=&threadid=143356 it's based on what you see when you open a .dlg file with a gff editor and it was made before the release of K2.

Link to comment
Share on other sites

it came with a readme file?!?!?!?!?! :eek:

 

That's the last time I download a tool on a non-swknights.com site :(

 

Dear god!?! CAN IT BE!!?!?!?!?!

 

I went down from 106 files to 6!!!!!! :eek: :eek: :eek: :eek:

 

This dialogue editor of yours kicks as...sith!! <insert :wub: emoticon here>

 

Heck, If I wanted to I could make it with 2 scripts and use all those 5 P# boxes :o

 

but I don't want people to look at the source and think its to complicated and discourage them from trying to mod kotor 2 :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...