For the first part you could try something like this in your trigger's "OnEnter" event:
void main()
{
//Check int on the trigger named "ACTIVE" ...
int iActive = GetLocalInt(OBJECT_SELF, "ACTIVE");
//...if int is "TRUE" then end.
if (iActive) return;
//Set int on self named "ACTIVE" to TRUE.
SetLocalInt(OBJECT_SELF, "ACTIVE", TRUE);
object oNPC1 = GetNearestObjectByTag("Tag of NPC1", OBJECT_SELF);
object oNPC2 = GetNearestObjectByTag("Tag of NPC2", OBJECT_SELF);
int iRand = Random(4)+1;//Change 4 to amount of random conversations provided.
switch (iRand)
{
case 1:
AssignCommand(oNPC1, SetFacingPoint(GetPosition(oNPC2)));
AssignCommand(oNPC2, SetFacingPoint(GetPosition(oNPC1)));
//Start of conversation lines:
AssignCommand(oNPC1, DelayCommand(1.0, ActionSpeakString("Pleasant weather we're having today?")));
AssignCommand(oNPC2, DelayCommand(2.0, ActionSpeakString("Yes it is isn't it.")));
AssignCommand(oNPC1, DelayCommand(3.0, ActionSpeakString("Have any plans for the day?")));
AssignCommand(oNPC2, DelayCommand(4.0, ActionSpeakString("I'm going to visit my grandmother in the forest.")));
//End of conversation lines.
//Set the "ACTIVE" int back to FALSE now that the conversation is done.
//This delay should be as long as it takes to finish the above actions.
DelayCommand(4.0, SetLocalInt(OBJECT_SELF, "ACTIVE", FALSE));
break;
case 2:
AssignCommand(oNPC1, SetFacingPoint(GetPosition(oNPC2)));
AssignCommand(oNPC2, SetFacingPoint(GetPosition(oNPC1)));
//another conversation
//Set the "ACTIVE" int back to FALSE now that the conversation is done.
//This delay should be as long as it takes to finish the above actions.
DelayCommand(4.0, SetLocalInt(OBJECT_SELF, "ACTIVE", FALSE));
break;
case 3:
AssignCommand(oNPC1, SetFacingPoint(GetPosition(oNPC2)));
AssignCommand(oNPC2, SetFacingPoint(GetPosition(oNPC1)));
//another conversation
//Set the "ACTIVE" int back to FALSE now that the conversation is done.
//This delay should be as long as it takes to finish the above actions.
DelayCommand(4.0, SetLocalInt(OBJECT_SELF, "ACTIVE", FALSE));
break;
case 4:
AssignCommand(oNPC1, SetFacingPoint(GetPosition(oNPC2)));
AssignCommand(oNPC2, SetFacingPoint(GetPosition(oNPC1)));
//another conversation
//Set the "ACTIVE" int back to FALSE now that the conversation is done.
//This delay should be as long as it takes to finish the above actions.
DelayCommand(4.0, SetLocalInt(OBJECT_SELF, "ACTIVE", FALSE));
break;
}
}
Hopefully you can follow it with my lousy commenting skills. haha. Good luck.
Modifié par GhostOfGod, 02 novembre 2010 - 03:58 .