Jump to content

Photo

Enemy Death Animation


  • Please log in to reply
10 replies to this topic

#1 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 09 January 2012 - 05:19 AM

I was trying to recreate the skull-like cloud of smoke from SS when an enemy dies,
but the death animation will not stay on screen for more than an instant no matter
what I set the frame number and animation speed to. Also, there is no option
to make it transparent.

Can this be done?

#2 Schwa

Schwa

    Enjoy the Moment more. This strengthens Imagination.

  • Members
  • Real Name:Hunter S.
  • Location:Redmond Subspace (I had a Potion)

Posted 12 January 2012 - 04:21 AM

Yes. This one's easy. icon_smile.gif Just put this somewhere in your Global2 mainframe.

CODE

int PoofSprite = 0;  // Change "0" to the Weapons/Misc. ID# of the death animation sprite you want.
npc Killed;
lweapon Poof;
for(int Instance = Screen->NumNPCs(); Instance > 0; Instance --)
{
  Killed = Screen->LoadNPC(Instance);
  if(Killed->HP <= 0 && Killed->HP > -999)
  {
    Poof = CreateLWeaponAt(23, CenterX(Killed), CenterY(Killed));
    Poof->UseSprite(PoofSprite);
    Poof->DrawXOffset = -8;
    Poof->DrawYOffset = -8;
    Poof->DeadState = Poof->ASpeed * Poof->NumFrames;

    Killed->HP = -999;
  }
}


Untested, and I took a bit of a creative liberty using the enemy's HP as a one-time-trigger marker, so if it wonks up, let me know. I'm not sure if I got the drawing coordinates right either; I was trying to account for more than just 16x16 enemies with one algorithm. It ought to show up in the center of the killed enemy sprite when it appears, the way I wrote it.

What you'll want to do is, in this script, set the "0" by "PoofSprite" to a Weapons/Misc ID value you want as your death animation, treated as a Sparkle (it disappears at the end of its animation), and change the graphics of the original death animation to blank tiles (otherwise both will show up). And please back up your .QST before you try this. icon_dead.gif I don't normally do requests and I don't want to be responsible for anything, or yelled at.

#3 Moosh

Moosh

    Tiny Little Questmaker

  • ZC Developers

Posted 12 January 2012 - 04:30 AM

Wouldn't it be better to use the Misc[] array since technically you can bring an enemy's health below 999 if you have a super overpowered item?
Wow, I completely misinterpreted what you were doing there...icon_confused.gif

Don't forget to set CollDetection for that lweapon to false, though.

Edited by Pokemonmaster64, 12 January 2012 - 04:32 AM.


#4 Schwa

Schwa

    Enjoy the Moment more. This strengthens Imagination.

  • Members
  • Real Name:Hunter S.
  • Location:Redmond Subspace (I had a Potion)

Posted 12 January 2012 - 04:36 AM

QUOTE(Pokemonmaster64 @ Jan 12 2012, 01:30 AM) View Post
Don't forget to set CollDetection for that lweapon to false, though.

It's a Sparkle LWeapon. They don't have any working collision detection because they DON'T HAVE SOULS

#5 Moosh

Moosh

    Tiny Little Questmaker

  • ZC Developers

Posted 12 January 2012 - 04:39 AM

QUOTE(Schwa @ Jan 12 2012, 04:36 AM) View Post

It's a Sparkle LWeapon. They don't have any working collision detection because they DON'T HAVE SOULS

I had no idea those were lweapons before...THE MOOORE YOOOU KNOOOW...

Doesn't an enemy die when it has less than 1 hp though?

#6 Radien

Radien

    Courage

  • Members
  • Real Name:Steve
  • Location:Oregon

Posted 12 January 2012 - 07:36 AM

Hmmmm.... the "enemy death poof" animation from The Minish Cap uses at least two more frames than ZC actually normally renders. So apparently, if someone scripted it, the full animation could be used instead, right? If that's the case, I might have a reason to upload the extra frames.... (I THINK I only included three of the frames, since ZC doesn't seem like it will show any more than that without scripting.)

#7 Schwa

Schwa

    Enjoy the Moment more. This strengthens Imagination.

  • Members
  • Real Name:Hunter S.
  • Location:Redmond Subspace (I had a Potion)

Posted 13 January 2012 - 07:56 AM

Hey, will someone like, actually test this for me? Because I think it's decent enough to add to the database if it works.

And I can't test it myself in my own .QST because it... already uses it. icon_neutral.gif No, it uses a modified version, and I hacked this one up roughly based on the concept behind mine, minus a couple (vital) things mine used and worked around instead.

QUOTE(Poke)
Doesn't an enemy die when it has less than 1 hp though?

Yes! Very observant! icon_biggrin.gif

But they still linger on the screen during their death until their death animation finishes. You know when you kill all the enemies in a dungeon room and the shutters only open after the last enemy's death animation finishes playing? That's why.

Hey, you could use this loop for the sake of Great Justice,
CODE

while(true)
{
  npc Killed;
  for(int Instance = Screen->NumNPCs(); Instance > 0; Instance --)
  {
    Killed = Screen->LoadNPC(Instance);
    if(Killed->HP <= 0)
    {
      Remove(Killed);  // BAM it's gone
    }
  }
}

and the moment you kill any enemy in your game it just... bink! Vanishes. icon_eek.gif And I habeeb that would instantaneously open the shutters. But even if it didn't it would be kind of hilarious to watch. I know you eat that kind of stuff up Poke so here, you keep it icon_love.gif

#8 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 13 January 2012 - 08:13 AM

I think i have requested the same already..
here it is

Could this script be modified somehow, so that every enemy uses another animation? I would love to draw death sprites for all of my enemies!

#9 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 13 January 2012 - 10:07 AM

I tested your first script and it works perfectly. Thanks!

#10 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 13 January 2012 - 04:05 PM

I hope I don't seem unappreciative. I didn't expect a response so quickly and am
still trying to get everything together to test it.

#11 Xenix

Xenix

    Well excuse me princess.

  • Members
  • Real Name:Chris
  • Location:Newport News, VA

Posted 13 January 2012 - 04:35 PM

This would be great if it wouldn't show both death animations. I was setting this up in my quest because I wanted link to die like he does in the gb games instead of him just vanishing with a poof like in Z1. Is there a mod for this?


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users