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

RCXGaming

Champion of Brightmoon Tor
Veteran
Joined
Jan 4, 2019
Messages
602
Reaction score
1,332
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,833
Reaction score
1,891
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
602
Reaction score
1,332
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
103
Primarily Uses
That can be shortened and simplified to:
Ruby:
$game_party.all_members.all? { |actor| actor.hp == actor.mhp }
 

Latest Threads

Latest Profile Posts

Game Making Every Day #20:kaohi:

ScreenShot_8_14_2022_11_55_51.png
FINALLY added the comic bubble to the Title Screen...
I know I'll put one of my game's sprites here to give the illusion that I am a productive member of game society.
handelspriteanim.gif

Forum statistics

Threads
124,506
Messages
1,164,102
Members
163,330
Latest member
Darkmorve
Top