newbiemodder Posted September 12, 2011 Posted September 12, 2011 I want to have a script where a NPC will perform a certain animation if a specific creature gets close to them. Not sure how to do it or the proper syntax to use. Would I need to set up a radius around the npc and if the creature enters it, the animation is played or does this need to be OnNotice. I only want it done when the creature is practically on top or very close to him. Thanks for any help.
Qui-Gon Glenn Posted September 12, 2011 Posted September 12, 2011 OnNotice, OnPerception, OnSight... they all work the same way, at different radius size "bubbles". I would think that you could use a generic OnPerception script with an additional logic check to verify that which has been noticed is what you actually want noticed. void main() { int nEvent = GetUserDefinedEventNumber(); // OnPerception object oNoticer=GetObjectByTag(); object oNoticed=GetObjectByTag(); if (nEvent == 1002) && (GetObjectByTag(oNoticed) == yournoticedtag) { AssignCommand(OBJECT_SELF, ActionPlayAnimation(x,x,x)); } } This would work fine for K1, I would think it should work for TSL as well.
newbiemodder Posted September 13, 2011 Author Posted September 13, 2011 when compiling...it's giving me a syntax error at &&
Qui-Gon Glenn Posted September 14, 2011 Posted September 14, 2011 when compiling...it's giving me a syntax error at &&Copy that. The issue is probably with the parens. Try several different paren situations, such as: if ((nEvent == 1002) && (GetObjectByTag(oNoticed) == yournoticedtag)) or if (nEvent == 1002) && (GetObjectByTag(oNoticed) == (yournoticedtag)) or if (nEvent == 1002) && ((GetObjectByTag(oNoticed)) == (yournoticedtag)) or if ((nEvent == 1002) && ((GetObjectByTag(oNoticed)) == (yournoticedtag))) .... Probably the last one... sorry, not at a PC that can compile ATM EDIT: if ((nEvent == 1002) && (GetObjectByTag(oNoticed) == "yournoticedtag")) will compile. Sorry about that!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.