As I recently discovered, you'll need to put something at the start of your script that gets called OnConversation, else any speech anywhere near the NPC that it hears (ie two PCs speaking, or even just one PC talking to themselves) will fire the OnConversation event, and the NPC will attack. Which is perhaps not what you want.
Lightfoot's suggested way around this, which should help:
Lightfoot8 wrote...
You neeed to filter what runs in the script using Function - GetListenPatternNumber .
If the event is ran by clicking on the npc the function will return a
value of -1. If it is ran by hearing someone speak it will return a
valid listening pattern number.
So, this at the start of your script would allow only a click on an NPC to initiate the rest of your script:
// if the conversation is not via a Click to start a conversation (ie it's just overheard), exit script
int nMatch = GetListenPatternNumber();
if(nMatch != -1)
{ return; }
Modifié par aradankir, 01 septembre 2011 - 08:11 .