Author Topic: Help with a very simple script. (NPC floaty text)  (Read 322 times)

Legacy_Lethal_Bottle

  • Newbie
  • *
  • Posts: 28
  • Karma: +0/-0
Help with a very simple script. (NPC floaty text)
« on: November 18, 2013, 03:53:22 am »


               Hello everyone. This is a very simple script that I need fixing.

Here is the script.


void main()

{

   object oPC = GetEnteringObject();

   object oDisplay = GetObjectByTag("Henchman");

   if (GetLocalInt(oPC, "henchspeak1") == FALSE)

   {

       AssignCommand(oDisplay, SpeakString("Who goes there?"));

       SetLocalInt(oPC, "henchspeak1", TRUE);
     }
   }

The script is so when the PC enters a trigger. The Henchman has a floaty text appear above him. I have them scattered through the module so that he can drop little nuggets of wisdom from time to time.

The problem is the script fires when the PC enters and AGAIN when the Henchman enters. Meaning he says everything twice.

Can anyone help me fix it?

Thanks!
               
               

               
            

Legacy_Fester Pot

  • Hero Member
  • *****
  • Posts: 1698
  • Karma: +0/-0
Help with a very simple script. (NPC floaty text)
« Reply #1 on: November 18, 2013, 04:28:29 am »


               Above the following line,

if (GetLocalInt(oPC, "henchspeak1") == FALSE)

add this line,

if (!GetIsPC(oPC)) return;

FP!
               
               

               
            

Legacy_Lethal_Bottle

  • Newbie
  • *
  • Posts: 28
  • Karma: +0/-0
Help with a very simple script. (NPC floaty text)
« Reply #2 on: November 18, 2013, 04:46:11 am »


               Thank you very much! I will test it out later.

Great to see how helpful the NWN1 community is still '<img'>