Checking how many alive enemies are left

lolshtar

Master of Magic thatknow nospell
Veteran
Joined
Apr 13, 2013
Messages
694
Reaction score
101
First Language
French
Primarily Uses
RMMV
I've been bashing my head on this problem for quite a while now, trying to do various solutions like -1 variable everytime an enemy dies, unfortunately due to Yanfly methods, the variable is not lowered whenever an enemy kill itself due to recoil from a state or skill used so i'm forced to use troop size.


I'm trying to remove a state if enemy size is at 1, here what l got so far:


<Custom React Effect>


if ($gameTroop.aliveMembers.length === 1) {


target.removeState(605); }


</Custom React Effect>


The effect work fine without the condition, as soon as the enemy with the state is hit, the state is removed. However it doesn't work with that condition no matter what l do.


The plugin is Yanfly's BuffsStates Core
 

lolshtar

Master of Magic thatknow nospell
Veteran
Joined
Apr 13, 2013
Messages
694
Reaction score
101
First Language
French
Primarily Uses
RMMV
Saving me once again


Thanks Trivel.
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,635
Reaction score
5,116
First Language
English
Primarily Uses
RMVXA
Yep.  aliveMembers is a method that returns an array, so to check the size you'd ask for $gameTroop.aliveMembers().length and to return the first enemy from that array you'd use $gameTroop.aliveMembers()[0]
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.

Forum statistics

Threads
106,040
Messages
1,018,470
Members
137,821
Latest member
Capterson
Top