The object is actually an NPC, I dont know why I said object.
OnSpawn
void main()
{
SetListening(OBJECT_SELF, TRUE);
SetListenPattern(OBJECT_SELF, "**", 69);
}
OnConversation
// Get the string that was typed...
string GetString();
string GetString()
{
string sString;
int iN = 0;
int iMax = GetMatchedSubstringsCount();
while(iN<iMax)
{
sString = sString+GetMatchedSubstring(iN);
iN++;
}
return sString;
}
void main()
{
int nMatch = GetListenPatternNumber();
if (nMatch != 69) {return;} //Also tried commenting this line out, didnt work
object oPC = GetPCSpeaker();
string sHeard = GetString();;
if (sHeard == "asdf") {GiveGoldToCreature(oPC, 555);}
else {GiveGoldToCreature(oPC, 1);}
}
It seems the OnConv. script wont fire at all..
And I read the lexicon about GetMatchedSubstring and man, it doesn't make the least bit of sense to me. <><>
Modifié par Xardex, 18 avril 2011 - 11:28 .