Enemy Death Animation
Started by
Cukeman
, Jan 09 2012 05:19 AM
10 replies to this topic
#1
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?
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
Posted 12 January 2012 - 04:21 AM
Yes. This one's easy. Just put this somewhere in your Global2 mainframe.
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. I don't normally do requests and I don't want to be responsible for anything, or yelled at.
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. I don't normally do requests and I don't want to be responsible for anything, or yelled at.
#3
Posted 12 January 2012 - 04:30 AM
Wow, I completely misinterpreted what you were doing there...
Don't forget to set CollDetection for that lweapon to false, though.
Edited by Pokemonmaster64, 12 January 2012 - 04:32 AM.
#6
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
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. 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.
Yes! Very observant!
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,
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. 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
And I can't test it myself in my own .QST because it... already uses it. 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!
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. 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
#8
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!
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
Posted 13 January 2012 - 10:07 AM
I tested your first script and it works perfectly. Thanks!
#10
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.
still trying to get everything together to test it.
#11
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