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,341
Reaction score
8,762
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,979
Reaction score
2,303
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,115
Reaction score
5,969
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 Posts

Latest Profile Posts

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:
Me, designing it a long time ago: Having an optional boss fight as a random chance to trigger when you fish in a certain spot with a certain type of bait is fun! Cool idea!
Me, trying to playtest everything again: oh god just let me see the boss, my bag is so full of fish!
both love and pain have no boundaries
Happy Saint Nicholas Day! May there nice stuff in your shoes when you wake up!

Forum statistics

Threads
117,218
Messages
1,105,576
Members
153,365
Latest member
jundoe
Top