Strange script problem.

Post » Sat Dec 08, 2012 1:22 am

Hi,

The script below is supposed to loop through a cell's list of NPCs. For each NPC that isn't the player, a second loop is executed. The problem is that the loop is also executed when the NPC is the player.

Anyone have any ideas as to why this is happening?

event OnLocationChange(Location akOldLoc, Location akNewLoc)area=Game.GetPlayer().GetParentCell()player=Game.GetPlayer() as Actorbla=area.GetNumRefs(42)loopy=0while loopy < blanpc = area.GetNthRef(loopy, 42) as Actorif (npc!=Game.GetPlayer())loopx=0while loopx < 3Utility.Wait(1)if (npc==Game.GetPlayer())Debug.Notification("1234567890")endifloopx+=1endwhileendifloopy+=1endwhileendevent
User avatar
Killah Bee
 
Posts: 3484
Joined: Sat Oct 06, 2007 12:23 pm

Return to V - Skyrim