When I kill an enemy with "die()", it dies, but it won't disappear from the screen!

schulliya

Veteran
Veteran
Joined
May 13, 2020
Messages
36
Reaction score
14
First Language
portuguese
Primarily Uses
RMMV
Hi.

It actually doesn't matter how I kill the enemy, even if I make some math and it makes it's HP go to 0, or add the dead state, its graphics still remain on the screen, but I can't target it anymore.
This only happens when I try to kill another thing, that's not the initial target of the skill.

My Damage Formula is like this:
$gameTroop.members()[0].die(); 20;

And what happens is this:
1643421333287.png
I targeted Crow D
I am using VisuStella's free plugins for MZ.
As I said, the graphic remains on the screen.

How can I kill another battler, without targeting it directly? Or how do I fix this?
Thanks!
 
Last edited:

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
4,160
Reaction score
2,542
First Language
English
Primarily Uses
RMMV
You can try adding:
if ($gameTroop.members()[0].isDead()) $gameTroop.members()[0].performCollapse()

But also be careful, because once that happens once (or the first enemy gets killed by any other means), you're going to be calling functions on an already-dead enemy, which won't have any effect - I don't know if that's what you want.

You may want to use aliveMembers() instead.
 

schulliya

Veteran
Veteran
Joined
May 13, 2020
Messages
36
Reaction score
14
First Language
portuguese
Primarily Uses
RMMV
You can try adding:
if ($gameTroop.members()[0].isDead()) $gameTroop.members()[0].performCollapse()

But also be careful, because once that happens once (or the first enemy gets killed by any other means), you're going to be calling functions on an already-dead enemy, which won't have any effect - I don't know if that's what you want.

You may want to use aliveMembers() instead.
thank you ♥
 

NaosoX

Veteran
Veteran
Joined
Feb 28, 2013
Messages
490
Reaction score
263
First Language
English
Primarily Uses
RMMZ
What exactly are you looking to achieve. This is a magic spell which instantly kills the party leader?
 

schulliya

Veteran
Veteran
Joined
May 13, 2020
Messages
36
Reaction score
14
First Language
portuguese
Primarily Uses
RMMV
What exactly are you looking to achieve. This is a magic spell which instantly kills the party leader?
No, that was just an exemple.
I made a skill that deals damage to other enemies when the target dies from it. But when the other enemies die by this, they wouldn't disappear from the screen.
I ended up making a kinda big formula, but it works now, with the help of ATT_Turan.

JavaScript:
var dmg = 100000; var splitDmg = (dmg - target.hp) - ($gameTroop.members().length - 1); $gameVariables.setValue(9, splitDmg); if(dmg >= target.hp){ for(var i = 0; i < $gameTroop.members().length; i++){ $gameTroop.members()[i].setHp($gameTroop.members()[i].hp - splitDmg); }; }; for(var j = 0; j < $gameTroop.deadMembers().length; j++){ $gameTroop.deadMembers()[j].performCollapse(); }; dmg;
 

NaosoX

Veteran
Veteran
Joined
Feb 28, 2013
Messages
490
Reaction score
263
First Language
English
Primarily Uses
RMMZ
Nice.. glad you got it working.
 

Latest Threads

Latest Profile Posts

grief... finding a font that works with the engine has been a bigger process than I thought it'd be. doesn't help MV loves to scrunch letters next to each other like a football huddle.
The new Phoenix plugin. I drew icons and an interface into it
R3-M1 can now leave footprints :kaojoy: Thanks Dsiver144 for another amazing plugin!!

1653686110642.png

Hey guys, do you wanna see who dominated the competition in our last game jam?! Stop by while we play Pinky by @Wumbohek Starting at 4:20pm EST.

Forum statistics

Threads
122,178
Messages
1,147,041
Members
160,438
Latest member
zodismegalame
Top