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

RCXGaming

Champion of Brightmoon Tor
Veteran
Joined
Jan 4, 2019
Messages
583
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,767
Reaction score
1,826
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
583
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

ScreenShot_6_24_2022_9_20_7.png
Here's Mike when you get a preemptive strike in battle. There's another one for when an enemy sneaks up on you too.
Suddenly, games mean nothing. The money spent was worth it to bring souls towards the light of life. May God bless my path forever. I pray that all are shaken for truth and poured out flat on the table of true understanding, knowledge, and wisdom. Bless you.
Finally I bought OMORI...cant wait to get traumatised!!!
Finished making this pretty ambitious forest map. Was wondering what y'all think of it! :kaopride:
1656136876015.png
All this anger everywhere,Who's happy but me?
Seems to be all the people that don't follow Jesus wholeheartedly. My smile might burn you ahhhhhhhhhhh!

Forum statistics

Threads
123,021
Messages
1,153,446
Members
161,363
Latest member
jereDev
Top