View Single Post
Old 09-05-2012, 05:24 PM   #216
JCarter426
Senior Member
 
JCarter426's Avatar
 
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,636
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 View Post
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 View Post
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.



Last edited by JCarter426; 09-05-2012 at 05:31 PM.
JCarter426 is offline   you may: quote & reply,