PDA

View Full Version : tsl- animation script question


newbiemodder
10-07-2009, 03:47 PM
I have multiple npc's in an area..they all have the same tag..I want them to perform the same animation( use computer) when a door is opened..can I alter this script to make it happen or is there a another script to do this:

void main() {

AssignCommand(GetObjectByTag("ABC"), ActionPlayAnimation(10044, 1.0, -1.0));
}

glovemaster
10-08-2009, 12:34 PM
I think you'd need to loop through all the individual NPC's, since GetObjectByTag() only returns the first NPC with that tag, so you could try this:

void main() {
string sTag = "Tag_Of_NPCs";
int i = 0;
object oChar = GetObjectByTag(sTag, 0);
while(oChar != OBJECT_INVALID) {
AssignCommand(oChar, ActionPlayAnimation(10044, 1.0, -1.0));

i++;
oChar = GetObjectByTag(sTag, i);
}
}

I'd scanned through for syntax errors, but I generally let a few one's slip by me :p If for any reason it doesn't work, just post back ;)

Hope that helps!

newbiemodder
10-08-2009, 01:49 PM
It works...thx glovemaster, you're the best.