Aller au contenu

Photo

Help with a very simple script. (NPC floaty text)


  • Veuillez vous connecter pour répondre
2 réponses à ce sujet

#1
Lethal_Bottle

Lethal_Bottle
  • Members
  • 14 messages
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!

#2
Fester Pot

Fester Pot
  • Members
  • 1 393 messages
Above the following line,

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

add this line,

if (!GetIsPC(oPC)) return;

FP!

#3
Lethal_Bottle

Lethal_Bottle
  • Members
  • 14 messages
Thank you very much! I will test it out later.

Great to see how helpful the NWN1 community is still :D