Reviving a sprite
I was wondering if there was a way to keep a sprite from dying in its die() procedure. Like, if I wanted a sprite to have a 50% to be restored to full health instead of dying. I've tried a simple sp_hitpoints(¤t_sprite, 50); but that doesn't seem to be enough, the sprite still dies.
I assume it has to do with the fact that the sprite is actually already dead internally when the die procedure is called, but I distincly remember dmods having the kind of functionality I'm thinking of, I just can't remember which ones to take a peek.
I assume it has to do with the fact that the sprite is actually already dead internally when the die procedure is called, but I distincly remember dmods having the kind of functionality I'm thinking of, I just can't remember which ones to take a peek.
I'll provide the full code, although I have tried just stripping it all down to the core which is refilling its HP and that doesn't work either as I said.
The loop is found in the main() procedure.
// Revive once if upgrade available int &stat; if (sp_custom("revived", ¤t_sprite, -1) == 0) { if (&dgupgrade >= 8) { sp_custom("revived", ¤t_sprite, 1) external("helper", "sparkles", ¤t_sprite); playsound(22, 22050, 0, 0, 0); if (&dgupgrade == 0) { &stat = &lifemax; &stat / 4; } if (&dgupgrade >= 1) { &stat = &lifemax; &stat / 3; } if (&dgupgrade >= 5) { &stat = &lifemax; &stat / 2; } sp_hitpoints(¤t_sprite, &stat); goto loop; } }
The loop is found in the main() procedure.