get_sprite_with_this_brain
I create 11 sprites and kill them using hurt(); in a seperate script (not attached to them).
Then when I do this:
int &alldead = get_sprite_with_this_brain(9, 0);
if (&alldead == 0)
{
say_xy("`3test", 0, 200);
}
nothing happens, even though all sprites did die (at least they look dead, lots of blood and not moving
).
I checked in debug mode and when it gets to the if statement it counts 11 sprites still... so what's wrong? Do I need to set the brains to 0 myself? I thought that happened anyway when it died, at least I can't find any references to it in a normal enemy script.
Then when I do this:
int &alldead = get_sprite_with_this_brain(9, 0);
if (&alldead == 0)
{
say_xy("`3test", 0, 200);
}
nothing happens, even though all sprites did die (at least they look dead, lots of blood and not moving
I checked in debug mode and when it gets to the if statement it counts 11 sprites still... so what's wrong? Do I need to set the brains to 0 myself? I thought that happened anyway when it died, at least I can't find any references to it in a normal enemy script.
I tested that and it works ok. I've even tested it after killing off created brain 9 enemies using a hurt command.. I can't tell you whats wrong
Where is int &alldead = get_sprite_with_this_brain(9, 0); located? It needs to run after the enemies are dead, or the if check will give an old value.
Put a wait(100) before your lines.
I managed to get it working, it was in a loop but before the wait(); so I suppose was still counting the recently killed sprites. I did notice in debug.txt that it still counts 11 brains until all are dead, even if there are really only 2 or 3 on the screen. Odd.
Thanks all!
Thanks all!












