Author Topic: Help with a Text Appears When... Please...  (Read 684 times)

Legacy_Shiek2005

  • Full Member
  • ***
  • Posts: 179
  • Karma: +0/-0
Help with a Text Appears When... Please...
« on: August 20, 2011, 10:30:32 pm »


               Before i pull my hair out in frustration:crying:

I have a conversation setup this way.

NPC: etc, etc, etc.
   PC: More etc, etc, etc.
      NPC: <Text i want to trigger for ANY non-Halflings.>
      NPC: <Text i want to trigger for Halflings that are of the BIG PHENOTYPE.>
      NPC: <Text i want to trigger for Halflings that are of the NORMAL PHENOTYPE.>

I've tried messing around with the TAW scripts i have, but i can never get ALL 3 to show up when the respective conditions are met (i.e i can get the first and second one to show up, but the third one won't show up, even when the respective conditions are met).

Here's the scripts i have, they are in the same order as the conversation above.

I would appreciate some insight into what i'm doing wrong here.

Thanks '<img'>


 


/*
*  Script generated by LS Script Generator, v.TK.0
*
*  For download info, please visit:
*  http://nwvault.ign.c....Detail&id=1502
*/
// Put this under "Text Appears When" in the conversation editor.


int StartingConditional()
{
   // Get the PC who is involved in this conversation
   object oPC = GetPCSpeaker();

   // The PC must not be any of the listed races.
   if ( GetRacialType(oPC) == RACIAL_TYPE_HALFLING )
       return FALSE;

   // If we make it this far, we have passed all tests.
   return TRUE;
}

-----------------------------------------------------------------------------


/*
*  Script generated by LS Script Generator, v.TK.0
*
*  For download info, please visit:
*  http://nwvault.ign.c....Detail&id=1502
*/
// Put this under "Text Appears When" in the conversation editor.


int StartingConditional()
{
   // Get the PC who is involved in this conversation
   object oPC = GetPCSpeaker();

   // The PC must be one of the listed races.
   if (GetPhenoType(oPC) == PHENOTYPE_BIG)
       return TRUE;

   // The PC must be one of the listed races.
   if ( GetRacialType(oPC) != RACIAL_TYPE_HALFLING )
       return TRUE;

   // If we make it this far, we have passed all tests.
   return TRUE;
}

-----------------------------------------------------------------------------


/*
*  Script generated by LS Script Generator, v.TK.0
*
*  For download info, please visit:
*  http://nwvault.ign.c....Detail&id=1502
*/
// Put this under "Text Appears When" in the conversation editor.


int StartingConditional()
{
   // Get the PC who is involved in this conversation
   object oPC = GetPCSpeaker();

   // The PC must be one of the listed races.
   if (GetPhenoType(oPC) == PHENOTYPE_NORMAL)
       return TRUE;

   // The PC must be one of the listed races.
   if ( GetRacialType(oPC) != RACIAL_TYPE_HALFLING )
       return TRUE;

   // If we make it this far, we have passed all tests.
   return TRUE;
}


-----------------------------------------------------------------------------
               
               

               


                     Modifié par Shiek2005, 20 août 2011 - 09:31 .
                     
                  


            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Help with a Text Appears When... Please...
« Reply #1 on: August 20, 2011, 10:58:28 pm »


                I noticed a few errors in the code. Corrections follow:

This first one is fine.


/*
* Script generated by LS Script Generator, v.TK.0
*
* For download info, please visit:
* http://nwvault.ign.c....Detail&id=1502
*/
// Put this under "Text Appears When" in the conversation editor.


int StartingConditional()
{
// Get the PC who is involved in this conversation
object oPC = GetPCSpeaker();

// The PC must not be any of the listed races.
if ( GetRacialType(oPC) == RACIAL_TYPE_HALFLING )
return FALSE;

// If we make it this far, we have passed all tests.
return TRUE;
}

-----------------------------------------------------------------------------

This second one needs changes as follows:


/*
* Script generated by LS Script Generator, v.TK.0
*
* For download info, please visit:
* http://nwvault.ign.c....Detail&id=1502
*/
// Put this under "Text Appears When" in the conversation editor.


int StartingConditional()
{
// Get the PC who is involved in this conversation
object oPC = GetPCSpeaker();

// The PC must be one of the listed races and of the big phenotype.
if (GetPhenoType(oPC) == PHENOTYPE_BIG && GetRacialType(oPC) == RACIAL_TYPE_HALFLING )
return TRUE;

}

-----------------------------------------------------------------------------
This third one needs the same kind of change:

/*
* Script generated by LS Script Generator, v.TK.0
*
* For download info, please visit:
* http://nwvault.ign.c....Detail&id=1502
*/
// Put this under "Text Appears When" in the conversation editor.


int StartingConditional()
{
// Get the PC who is involved in this conversation
object oPC = GetPCSpeaker();

// The PC must be one of the listed races and of the normal phenotype
if (GetPhenoType(oPC) == PHENOTYPE_NORMAL && GetRacialType(oPC) == RACIAL_TYPE_HALFLING)
return TRUE;

}


-----------------------------------------------------------------------------
               
               

               


                     Modifié par henesua, 20 août 2011 - 09:59 .
                     
                  


            

Legacy_Shiek2005

  • Full Member
  • ***
  • Posts: 179
  • Karma: +0/-0
Help with a Text Appears When... Please...
« Reply #2 on: August 20, 2011, 11:02:45 pm »


               When i try compiling the modified scripts, i get an error on line 10 "int StartingConditional()".
It's: ERROR: NOT ALL CONTROL PATHS RETURN A VALUE
               
               

               
            

Legacy_Shiek2005

  • Full Member
  • ***
  • Posts: 179
  • Karma: +0/-0
Help with a Text Appears When... Please...
« Reply #3 on: August 20, 2011, 11:08:19 pm »


               I fixed them so they could compile by adding another "return TRUE;". However, it still does the same thing. In this case, the very last line never triggers.
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Help with a Text Appears When... Please...
« Reply #4 on: August 20, 2011, 11:10:06 pm »


               <girds his loins...>

Shiek2005 wrote...
Before i pull my hair out in frustration:crying:

I have a conversation setup this way.

NPC: etc, etc, etc.
   PC: More etc, etc, etc.
      NPC: <Text i want to trigger for ANY non-Halflings.>
      NPC: <Text i want to trigger for Halflings that are of the BIG PHENOTYPE.>
      NPC: <Text i want to trigger for Halflings that are of the NORMAL PHENOTYPE.>

...


int StartingConditional()
{
   // Get the PC who is involved in this conversation
   object oPC = GetPCSpeaker();

   // The PC must not be any of the listed races.
   if ( GetRacialType(oPC) == RACIAL_TYPE_HALFLING )
       return FALSE;

   // If we make it this far, we have passed all tests.
   return TRUE;
}


Looks good to me. False if Halfling, true if anything else.

int StartingConditional()
{
   // Get the PC who is involved in this conversation
   object oPC = GetPCSpeaker();

   // The PC must be one of the listed races.
   if (GetPhenoType(oPC) == PHENOTYPE_BIG)
       return TRUE;

   // The PC must be one of the listed races.
   if ( GetRacialType(oPC) != RACIAL_TYPE_HALFLING )
       return TRUE;

   // If we make it this far, we have passed all tests.
   return TRUE;
}


The second line of text appears when PHENOTYPE_BIG or racial type is *not* RACIAL_TYPE_HALFLING or *anything*.

Since you have already checked racial type on line 1, you should just check phenotype here (I'd do != PHENOTYPE_NORMAL to stay consistent). I.e. if it's not normal return false, else it must be big, return true.

int StartingConditional()
{
   // Get the PC who is involved in this conversation
   object oPC = GetPCSpeaker();

   // The PC must be one of the listed races.
   if (GetPhenoType(oPC) == PHENOTYPE_NORMAL)
       return TRUE;

   // The PC must be one of the listed races.
   if ( GetRacialType(oPC) != RACIAL_TYPE_HALFLING )
       return TRUE;

   // If we make it this far, we have passed all tests.
   return TRUE;
}


Actually, if you dropped through the first two lines, you must be a normal-phenotype halfling.  No conditional needed.

Okay. Now let's see how the savants will solve it :-)  And what I screwed up... :-(  

I learn this way =)

<...and wields his pen>
               
               

               
            

Legacy_Shiek2005

  • Full Member
  • ***
  • Posts: 179
  • Karma: +0/-0
Help with a Text Appears When... Please...
« Reply #5 on: August 20, 2011, 11:16:09 pm »


               

Rolo Kipp wrote...

int StartingConditional()
{
   // Get the PC who is involved in this conversation
   object oPC = GetPCSpeaker();

   // The PC must be one of the listed races.
   if (GetPhenoType(oPC) == PHENOTYPE_BIG)
       return TRUE;

   // The PC must be one of the listed races.
   if ( GetRacialType(oPC) != RACIAL_TYPE_HALFLING )
       return TRUE;

   // If we make it this far, we have passed all tests.
   return TRUE;
}


The second line of text appears when PHENOTYPE_BIG or racial type is *not* RACIAL_TYPE_HALFLING or *anything*.

Since you have already checked racial type on line 1, you should just check phenotype here (I'd do != PHENOTYPE_NORMAL to stay consistent). I.e. if it's not normal return false, else it must be big, return true.


Wouldn't that then trigger the second line for anyone who's of the big phenotype?
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Help with a Text Appears When... Please...
« Reply #6 on: August 20, 2011, 11:16:53 pm »


               <raises his eyebrows...>

henesua wrote...

...(good stuff)...


Do you need conditionals on each line?  
Shouldn't the dependent lines never fire if the top line does?
And if it drops through the first two, shouldn't the last line fire without conditional?

<and waggles them>
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Help with a Text Appears When... Please...
« Reply #7 on: August 20, 2011, 11:19:57 pm »


               <backpedals rapidly...>

Shiek2005 wrote...

Rolo-
Since you have already checked racial type on line 1, you should just check phenotype here (I'd do != PHENOTYPE_NORMAL to stay consistent). I.e. if it's not normal return false, else it must be big, return true.


Wouldn't that then trigger the second line for anyone who's of the big phenotype?


But only halflings get through the first line, right? ... Am I missing something?

<...and trips over his big, ugly scarf>
               
               

               


                     Modifié par Rolo Kipp, 20 août 2011 - 10:20 .
                     
                  


            

Legacy_Shiek2005

  • Full Member
  • ***
  • Posts: 179
  • Karma: +0/-0
Help with a Text Appears When... Please...
« Reply #8 on: August 20, 2011, 11:23:34 pm »


               

Rolo Kipp wrote...

<backpedals rapidly...>

Shiek2005 wrote...

Rolo-
Since you have already checked racial type on line 1, you should just check phenotype here (I'd do != PHENOTYPE_NORMAL to stay consistent). I.e. if it's not normal return false, else it must be big, return true.


Wouldn't that then trigger the second line for anyone who's of the big phenotype?


But only halflings get through the first line, right? ... Am I missing something?

<...and trips over his big, ugly scarf>


I see where this is going. I'm checking if the PC is a halfing on the first line, if he is he won't trigger that line instead he will trigger the second one, so therefore i can just check the phenotype on the third line. If it works like i think it does, then only halfings can get past the first line, so it's obsolete to check if the PC is a halfling on the third line, because even if his not, he can never reach the third line.

I'll be back once i test that theory in a minute '<img'>
               
               

               


                     Modifié par Shiek2005, 20 août 2011 - 10:24 .
                     
                  


            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Help with a Text Appears When... Please...
« Reply #9 on: August 20, 2011, 11:29:49 pm »


               <hanging on...>

Actually, you only need (if I'm correct) to check phenotype on line 2. If he's big he'll never get to line 3... it's all good :-)

If my laptop wasn't so slow (and I wasn't working geometry on a module) I'd be following along with you :-P

<...tenterhooks>
               
               

               
            

Legacy_Shiek2005

  • Full Member
  • ***
  • Posts: 179
  • Karma: +0/-0
Help with a Text Appears When... Please...
« Reply #10 on: August 20, 2011, 11:40:50 pm »


               Nope, doesn't work, either by checking phenotype on line 3 and by not checking for anything at all.

The culprit has to be the second script, maybe GetPhenoType is broken? '<img'>
Seriously speaking though, it seems as if it's only checking whether the PC is a halfling or not and ignoring the phenotype alltogether...
               
               

               


                     Modifié par Shiek2005, 20 août 2011 - 10:41 .
                     
                  


            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Help with a Text Appears When... Please...
« Reply #11 on: August 20, 2011, 11:51:18 pm »


               <scratches...>

Try something like:


// Get the PC who is involved in this conversation
object oPC = GetPCSpeaker();

// True if PhenoType is big
if (GetPhenoType(oPC) != PHENOTYPE_BIG) return FALSE;

return TRUE;

on the 2nd line conditional. Just for giggles :-P

<...a persistent itch>
               
               

               


                     Modifié par Rolo Kipp, 20 août 2011 - 10:54 .
                     
                  


            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Help with a Text Appears When... Please...
« Reply #12 on: August 20, 2011, 11:56:58 pm »


               I forgot to add return FALSE in the last line of each of the scripts I gave to you. Try that for the scripts I gave you, and recompile
               
               

               
            

Legacy_Shiek2005

  • Full Member
  • ***
  • Posts: 179
  • Karma: +0/-0
Help with a Text Appears When... Please...
« Reply #13 on: August 21, 2011, 12:10:28 am »


               

Rolo Kipp wrote...

<scratches...>

Try something like:


// Get the PC who is involved in this conversation
object oPC = GetPCSpeaker();

// True if PhenoType is big
if (GetPhenoType(oPC) != PHENOTYPE_BIG) return FALSE;

return TRUE;

on the 2nd line conditional. Just for giggles :-P

<...a persistent itch>


Ok, i replaced the third script with the one henesua gave me (adding a second "return TRUE" so that it compiles) and then replaced the second script with this one and it works.

HOW that works exactly, i'm afraid, will take me a good long while to comprehend...If we're checking first if the PC is a race other then a Halfing and then checking whether his Phenotype is big or not...how is that not triggering for players that are NOT halflings but of a big phenotype...?':huh:'

Regardless, thanks a lot for the help, it's working now and i guess thats what counts:)
               
               

               


                     Modifié par Shiek2005, 20 août 2011 - 11:13 .
                     
                  


            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Help with a Text Appears When... Please...
« Reply #14 on: August 21, 2011, 12:21:08 am »


               <sucking up...>

Because the first line sucks them in if they are *not* halflings, and only spits them out to the second line if they *are* halflings... so they never get to line 2. You need a false return on line 1 to get to line 2.

Likewise, you need a false return on line 2 to get to line 3, so I don't know why a conditional is required.  It's like the default of a case statement... I would think.

<...his Starbucks potion of endurance>