//Name: Improved Sight Speak
//
//Description: Improvement on my old script Sight Speak, which had an NPC was up
to the PC and begin converstation. There was a bug that would //cause the NPC to
run this script continuously. The bug was fixed, and I was dealing with the
problem personally (people who pmed me). I always was //meaning to put this up.
//
//Notes: Put this on the OnPerceive event of the NPC that will be speaking (this
is the most simple way to do it). The used NPC's tag is Pathal. The //"PutSomethingHere"
string doesn't matter what is between the quotation marks, it just creates
whatever is there (it doesn't do anything, but you can't //remove it from the
script and have it compile right).
//
//Finally, the script:
void main()
{
object oNPC = GetObjectByTag("Pathal");
object oPC = GetLastPerceived();
int iRunOnce = 0;
if (iRunOnce)
{
AssignCommand(oPC, ClearAllActions());
AssignCommand(oNPC, ClearAllActions());
AssignCommand(oNPC, ActionMoveToObject(oPC));
AssignCommand(oNPC, ActionStartConversation(oPC));
SetLocalInt(oNPC, "PutSomethingHere", iRunOnce + 1);
}
}