[Solved] Way to check if entire party is at full HP/MP, etc.

RCXGaming

Champion of Brightmoon Tor
Veteran
Joined
Jan 4, 2019
Messages
586
Reaction score
1,271
First Language
English
Primarily Uses
RMVXA
I've been curious about how you pull off a check to see if everyone in the party (active or reserve, it doesn't matter) has full HP or MP.
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,777
Reaction score
1,834
First Language
Spanish
Primarily Uses
RMVXA
Code:
$game_party.all_members.collect {|actor| actor.hp / actor.mhp}.all? {|ratio| ratio == 1.0}

returns true if everyone's HP matches their max HP.
 

RCXGaming

Champion of Brightmoon Tor
Veteran
Joined
Jan 4, 2019
Messages
586
Reaction score
1,271
First Language
English
Primarily Uses
RMVXA
Code:
$game_party.all_members.collect {|actor| actor.hp / actor.mhp}.all? {|ratio| ratio == 1.0}

returns true if everyone's HP matches their max HP.

Very nice. That was a pretty quick answer, too.
 

cremnophobia

Veteran
Veteran
Joined
Dec 10, 2013
Messages
233
Reaction score
102
Primarily Uses
That can be shortened and simplified to:
Ruby:
$game_party.all_members.all? { |actor| actor.hp == actor.mhp }
 

Latest Threads

Latest Posts

Latest Profile Posts

The main game of my trilo/saga 50%OFF on Steam..... its now or never more
I swap between Ace and MZ so I can stay fresh but - what do you mean you can use subfolders in the plugin's folder for easier organization!?
Did some new music again, praise be. To the next song!
Watch Studio Blue play Numina by starlit in our latest RPG Maker Games Critique stream starting NOW!

Forum statistics

Threads
123,139
Messages
1,154,242
Members
161,474
Latest member
nugogo555
Top