Jump to content

Home

Help with dialogue and scripting


dead1486

Recommended Posts

Basically I'm having a tough time figuring out how to put them together. What I'm trying to do is link 6 dialogue options to an item and a multiclass change. Also I want all 6 options to been inaccessable after one has been chosen. Anyone have any helpful tips?

 

PS: Is it hard to overide existing dialogue in the game?

Link to comment
Share on other sites

To make options inaccessable after you need to make a local variable (I'd look http://www.lucasforums.com/showthread.php?t=173587. If that's not helpful (since its for TSL I believe), you should look under something like 'make sure you haven't already spoken to an NPC', its the same principal.

 

As for the item, you could use this script:

 

object oItem=CreateItemOnObject( "item_template", GetFirstPC());

 

Compile it, stick it in your dialog as a 'script that fires when spoken'.

 

And with the multiclass change:

 

/*possible classes:
   CLASS_TYPE_SOLDIER
   CLASS_TYPE_SCOUT
   CLASS_TYPE_SCOUNDREL     
   CLASS_TYPE_JEDIGUARDIAN 
   CLASS_TYPE_JEDICONSULAR
   CLASS_TYPE_JEDISENTINEL 
   CLASS_TYPE_COMBATDROID
   CLASS_TYPE_EXPERTDROID
   CLASS_TYPE_MINION */

AddMultiClass( CLASS_TYPE_JEDIGUARDIAN, GetObjectByTag("Mission"));

 

Something like that.

 

If you've got more questions, don't hesitate to post.

Link to comment
Share on other sites

Also I want all 6 options to been inaccessable after one has been chosen.

If every choice that you want to be inaccessible eventually leads to multiclassing, you can use this something like this in your conditional script:

int StartingConditional() {
 object oPC=GetFirstPC();
 return (  GetLevelByPosition(2, oPC) == 0 );
}

The above script will return TRUE if the PC has not yet multi-classed.

Link to comment
Share on other sites

I'm actually modding TSL so it willl work for me thanks. So I guess what I'm having problems with is firing a script. Using that same multiclass code you just gave me how would I activate the script using dialogue for a specific character. I really appreciate the help (sorry for my lack of understanding lol)

 

If that doesn't make any sense what I mean is like how do I use this script after I have it compiled?

Link to comment
Share on other sites

Thanks alot tk102

 

Also regarding the multiclass checking code you gave me. If I require my dialog choices to return true then after the character multiclasses the rest of the node will no longer appear?

 

Oh and I guess my only other question: is there a code for checking multiclass level (I want to detect level 15)

Link to comment
Share on other sites

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

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

*/
//// CFA 10-5-04

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_JEDIGUARDIAN, GetObjectByTag ("Atton") );
   }
       CreateItemOnObject("g_w_lghtsbr01", GetFirstPC(), 1);
   }

   // 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") );
   }
       CreateItemOnObject("g_w_lghtsbr01", GetFirstPC(), 1);
   }

   // 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") );
   }
       CreateItemOnObject("g_w_lghtsbr01", GetFirstPC(), 1);
   }

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

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

 

How does this look?

Link to comment
Share on other sites

If I require my dialog choices to return true then after the character multiclasses the rest of the node will no longer appear?
:confused:

If you want the node not to appear, you need the conditional to return FALSE or you can flop the "NOT" checkbox for a conditional that would normally return TRUE.

is there a code for checking multiclass level (I want to detect level 15)
Here you go, pass the NPC number in P1, the class position (1st or 2nd class) in P2, the level to check in P3, and the operation in P4.

int StartingConditional() {
  int nWho = GetScriptParameter(1);  // 0 is atton, 1 is baodur, etc.
  int nClass = GetScriptParameter(2); // 1 is the first class, 2 is the 2nd class
  int nLevel = GetScriptParameter(3); // level to check against
  int nOp = GetScriptParameter(4); // Operation check for class compared to level 
                                   // 0 returns TRUE if class is less than level
                                   // 1 returns TRUE if class is equal to level
                                   // 2 returns TRUE if class is greater than level
  object oWho;
  switch (nWho) {
   case 0:
     oWho = GetObjectByTag ("Atton");
     break;
   case 1:
     oWho = GetObjectByTag ("BaoDur");
     break;
   case 2:
     oWho = GetObjectByTag ("Mand");
     break;
   case 3:
     oWho = GetObjectByTag ("G0T0");
     break;
   case 4:
    oWho = GetObjectByTag ("Handmaiden");
     break;
   case 5:
    oWho = GetObjectByTag ("HK47");
     break;
   case 6:
    oWho = GetObjectByTag ("Kreia");
     break;
   case 7:
     oWho = GetObjectByTag ("Mira");
     break;
   case 8:
     oWho = GetObjectByTag ("T3M4");
     break;
   case 9:
     oWho = GetObjectByTag ("VisasMarr");
     break;

   case 10:
     oWho = GetObjectByTag ("Hanharr");
     break;

   case 11:
     oWho = GetObjectByTag ("Disciple");
     break;
   default:
     return FALSE;
  }
  if ((nClass<1) || (nClass>2)) {
     return FALSE;
  }
  switch (nOp) {
  case 0:
    return GetLevelByPosition(nClass,oWho)<nLevel;
  case 1:
    return GetLevelByPosition(nClass,oWho)==nLevel;
  case 2:
    return GetLevelByPosition(nClass,oWho)>nLevel;
  }
  return FALSE;
}

How does this look?
Too many braces. I think you mean to create a lightsaber in the inventory of the person who is multiclassing don't you?

 

In your dialog, you'll have to indicate who you want to multiclass by setting the P1 parameter to one of the values listed in the script.

 

void main()
{
   int nScriptNumber = GetScriptParameter( 1 );
   object oWho;
   switch nScriptNumber {
   case 0:
     oWho = GetObjectByTag ("Atton");
     break;
   case 1:
     oWho = GetObjectByTag ("BaoDur");
     break;
   case 4:
     oWho = GetObjectByTag ("Handmaiden");
     break;
   case 7:
     oWho = GetObjectByTag ("Mira");
     break;
   case 11:
     oWho = GetObjectByTag ("Disciple");
     break;
   default:
     return;
   }
   AddMultiClass (CLASS_TYPE_JEDIGUARDIAN, oWho);
   CreateItemOnObject("g_w_lghtsbr01", oWho);  // on the char not the main PC
}

Link to comment
Share on other sites

Wow you helping me learn alot here. Ok so for example I would set the p1 next to my script (Script #1 in this case) to 0 for atton and to 1 for bao dure etc etc?

 

I guess I was overdoing it lol. Thanks alot for that tk. Much better then what I had. Regarding the mutliclass checking code you mentioned earlier, will that little code there suffice as the script or is there more to be done?

 

Edit: Does this one also perform a multiclass check?

 

 // This can't have happened before.
   int nVal = GetLocalBoolean( OBJECT_SELF, 35 );
   if( nVal ) {
       return 0;
   }

   return 1;
}

Link to comment
Share on other sites

Regarding the mutliclass checking code you mentioned earlier, will that little code there suffice as the script or is there more to be done?

Since I understand that you want to check other characters (not just the main PC) for multiclassing, the code from post 3 should be modified to:

int StartingConditional() {
  int nWho = GetScriptParameter(1);  // 0 is atton, 1 is baodur, etc.
  object oWho;
  switch (nWho) {
   case 0:
     oWho = GetObjectByTag ("Atton");
     break;
   case 1:
     oWho = GetObjectByTag ("BaoDur");
     break;
   case 2:
     oWho = GetObjectByTag ("Mand");
     break;
   case 3:
     oWho = GetObjectByTag ("G0T0");
     break;
   case 4:
    oWho = GetObjectByTag ("Handmaiden");
     break;
   case 5:
    oWho = GetObjectByTag ("HK47");
     break;
   case 6:
    oWho = GetObjectByTag ("Kreia");
     break;
   case 7:
     oWho = GetObjectByTag ("Mira");
     break;
   case 8:
     oWho = GetObjectByTag ("T3M4");
     break;
   case 9:
     oWho = GetObjectByTag ("VisasMarr");
     break;

   case 10:
     oWho = GetObjectByTag ("Hanharr");
     break;

   case 11:
     oWho = GetObjectByTag ("Disciple");
     break;
   default:
     return FALSE;
  }
  return (  GetLevelByPosition(2, oWho) == 0 );
}

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...