RMMV Check if enemy is dead or has zero HP via script call

Status
Not open for further replies.

KotoYama

Veteran
Veteran
Joined
Apr 20, 2019
Messages
447
Reaction score
80
First Language
Spanish
Primarily Uses
RMMV
I guess it would be smth like $gameTroop.member().isAlive but I'm not sure
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
34,346
Reaction score
8,769
First Language
German
Primarily Uses
RMMV
it depends on where and when you want to use that script call.
in a troop event it's usually easier to use the game data section of control variable (not the script section) or the event conditions.
In a plugin it depends on when and where you call the function.
outside a battlescreen that won't work at all because outside the battlescreen no enemies exist.
 

KotoYama

Veteran
Veteran
Joined
Apr 20, 2019
Messages
447
Reaction score
80
First Language
Spanish
Primarily Uses
RMMV
Inside battle screen. My battle system works on parallel events.
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
2,984
Reaction score
2,304
First Language
EN
Primarily Uses
RMMZ
"Is enemy #1 (index 0) alive?"
JavaScript:
$gameTroop.members()[0].isAlive()

"Is the current HP of enemy #1 equal to 0?"
JavaScript:
$gameTroop.members()[0].hp === 0

The parts for these script calls (and much more) can be found here, in case you're interested:
 

KotoYama

Veteran
Veteran
Joined
Apr 20, 2019
Messages
447
Reaction score
80
First Language
Spanish
Primarily Uses
RMMV
"Is enemy #1 (index 0) alive?"
JavaScript:
$gameTroop.members()[0].isAlive()

"Is the current HP of enemy #1 equal to 0?"
JavaScript:
$gameTroop.members()[0].hp === 0

The parts for these script calls (and much more) can be found here, in case you're interested:
This works, thank u
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
9,116
Reaction score
5,970
First Language
Dutch
Primarily Uses
RMXP

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Latest Threads

Latest Profile Posts


It's a Spanish devlog don't get scared!. (please)
Q:"Why don't you get a job?"
A: Posting statuses IS my job. It just so happens to not pay and happen periodically over the course of three months.
My new 49" monitor has been dispatched from the warehouse. Will it arrive tomorrow? The day after? I love that we can track packages now, even if it does only tell me when it's left that end and when it's arrived at the local centre. As long as it doesn't end up in Melbourne again, which has happened before ...
My friend's doing a surprise stream of my game Origin Hunt on Twitch here ! Feel free to stop by :yhappy:

Forum statistics

Threads
117,236
Messages
1,105,751
Members
153,396
Latest member
twofacegibby
Top