I have a question regarding GetFirstRef that I'm having trouble with.
I wrote a script that uses GetFirstRef/GetNextRef to loop through all of the Creates (type 43) in an exterior area. The code works great at identifying the two Brahman that I have in the cell, but when I kill the Brahman, it still comes back identifying them. If I disable them after killing them, FOSE still reports finding the creature (as a reference).
Is there an additional check that I need to do in addition to the reference check for Creatures to determine whether or not they are dead? I should think that GetFirstRef will return 0 or Null when I try to assign it in a cell with only dead NPC's, but I could be mistaken. Below is the code fragment:
set NPCcount to 0 set rCurrentRef to GetFirstRef 43 0 0; Creatures Label 100 if rCurrentRef if rCurrentRef.GetPlayerTeammate == 0 printc "Found NPCs" set NPCcount to NPCcount + 1 set rCurrentRef to GetNextRef endif Goto 100 endif
This code fragment always returns with NPCCount > 0 (even if the creatures in the cell are dead). I tried setting the cell depth to 1 ( GetFirstRef 43 1 0), but this seemed to have no effect.
Thoughts?
Miax