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,568
Reaction score
2,918
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
512
Reaction score
296
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
512
Reaction score
296
First Language
English
Primarily Uses
RMMZ
Nice.. glad you got it working.
 

Latest Threads

Latest Profile Posts

ScreenShot_7_1_2022_11_41_55.png
When the Panic gauge is full, Mike will turn into Omar in a state of actual panic. his move list changes and until the meter depletes completely, he'll be able make use of this alter ego.
So unbelievably excited for IGMC this year! First public game was for the original one and I'm just so pumped!!
Sometimes I am amazed at how relentless spam bots are. I would clear the que and then see 800~5k more depending on their mood.
Work on UD is already so delayed but I gotta drop everything so that I have something ready for IGMC!
Messed up the chains... :kaoback:
Sw7U8dA.jpg

Character: Jeanne D'Arc from Fate/Apocrypha.

Forum statistics

Threads
123,255
Messages
1,155,244
Members
161,636
Latest member
qixxi
Top