Hello,
I'm having some problems with the following script parts (given variables: 'short counterbase', 'short counter'and 'ref NPCref'):
-----------------------------------------------------------------------------------------------------------------
set NPCref to GetFirstRef 200 3 0
label 1
If NPCref != 0
___if NPCref.GetDisabled == 0 && NPCref.GetDead == 0
______NPCref.kill ; kill NPCs around
___endif
___if NPCref.GetDead == 1
______NPCref.disable ; disable dead corpses
___endif
___set NPCref to Pencil01
___set NPCref to GetNextRef
___Goto 1
endif
set counterbase to 0
set NPCref to GetFirstRef 200 3 0
label 2
If NPCref != 0
___if NPCref.GetDisabled == 0 && NPCref.GetDead == 0
______set counterbase to counterbase + 1 ; count enemies still around
___endif
___set NPCref to Pencil01
___set NPCref to GetNextRef
___Goto 2
endif
---------------- [some code, including spawning enemies] ----------------
set counter to 0
set NPCref to GetFirstRef 200 3 0
label 3
If NPCref != 0
___if NPCref.GetDisabled == 0 && NPCref.GetDead == 0
______set counter to counter + 1 ; count NPCs around
___endif
___set NPCref to Pencil01
___set NPCref to GetNextRef
___Goto 3
endif
if counter == counterbase ; check if every NPC exept companions are dead
___ ; do stuff
endif
-----------------------------------------------------------------------------------------------------------------
In the beginning of the script i want to kill every NPC around (exept companions because I don't play hardcore), and after that I want to store the amount of NPCs still around (-> companions) to 'counterbase'.
Later in my script i use the condition 'if counter == counterbase'; so some code should only be running if nothing else than companions is near the player.
Unfortunately this last part doesn't work and I just can't find ount why, so it seems like there are enemies close by when there aren't.
I also tried stuff like 'GetPlayerTeammateCount' which didn't help at all, so I'm pretty stuck right now.
I don't expect somebody do to find the problem because it seems like a bug to me, but this is my last hope.
Crying,
Patzifist
Edited by Patzifist, 20 July 2014 - 12:41 PM.