The Dink Network

Reviving a sprite

March 15th 2010, 12:22 PM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
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(&current_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.
March 15th 2010, 12:27 PM
goblinh.gif
mkbul
Peasant He/Him Greece
TPA~ 
You can try an if statement...but im not sure still
March 15th 2010, 12:33 PM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
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.

  // Revive once if upgrade available
  int &stat;
  if (sp_custom("revived", &current_sprite, -1) == 0)
  {
	if (&dgupgrade >= 8)
	{
		sp_custom("revived", &current_sprite, 1)
		external("helper", "sparkles", &current_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(&current_sprite, &stat);
		goto loop;
	}
  }


The loop is found in the main() procedure.
March 15th 2010, 12:45 PM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
Never mind, I suck at searching Did another more thourough search on the forum and found a thread that held the solution

For those interested, setting the brain to 0 stops the sprite from dying. You earned yourself a spot in the credits Scratcher