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,151
Reaction score
2,535
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

ScreenShot_5_26_2022_11_36_32.png
added a Panic gauge to battle. it fills up according to your actions. each character has a different passive that activates once the gauge is full. also once full, a countdown starts and after each action taken, the gauges decreases. with each character, the decrease is different.
Genuinely considering making a thread informing people how to Google.
It's time for Da Update...

Prototyping some overworld abilities. Some of the characters you'll meet on your journey can use special overworld skills to travel around. This can be something like digging holes in the ground or getting hints towards your next objective.

Even more things I made.
Equipping Abilities is very important.
fLhHhZjh.gif

Forum statistics

Threads
122,157
Messages
1,146,887
Members
160,423
Latest member
THORR1
Top