That's the same problem I ran into on the first page. I'll quote to save you the trouble of going back:
Quote:
Originally Posted by JCarter426
My problem was that one NPC seemed to be excluded 95% of the time, which I resolved by using GetNearestObjectByTag rather than GetObjectByTag, which is screwy... clearly why GetNearestObjectByTag exists. However, GetObjectByTag does recognize 0, and inputting 0 doesn't immediately crash the game. So there's that.
|
And the essential code:
Quote:
Originally Posted by JCarter426
Code:
int i = 1;
for(;;) {
i++;
object oCreature1 = GetNearestObjectByTag(sTag, OBJECT_SELF, i);
if( GetIsObjectValid(oCreature1) ){
ChangeToStandardFaction(oCreature1, iFaction);
DelayCommand(1.0, AssignCommand(oCreature1, ActionAttack(GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, oCreature1, 1, -1, -1, -1, -1 ), 0)));
}
else break;
}
|
So something like this should work:
Code:
sTag = "d50ab_sitter";
int i = 1;
for(;;) {
i++;
object oPlaceable = GetNearestObjectByTag(sTag, OBJECT_SELF, i);
if( GetIsObjectValid(oPlaceable) ){
AssignCommand(oPlaceable,ActionPlayAnimation(ANIMATION_PLACEABLE_ANIMLOOP01));
}
else break;
}
You might have to fiddle with it a bit. I can't remember all of the details.