Jump to content

Home

Script help OnNotice - TSL


newbiemodder

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...