Setting HP to a Variable

LeoEmpire

Villager
Member
Joined
Jun 4, 2016
Messages
6
Reaction score
0
First Language
English
Primarily Uses
Hi, I'm working on a somewhat customized battle system where all battlers influence 1 master HP bar of sorts.


Right now I have a common event that averages each side's members' HP and sets those to a variable. Those variables will be added to until they add to 1,000.


My question is, is there a way to set all battlers on each side's current HP to their respective variables? I tried to use $gameParty.members().setHp($gameVariables.value(n)) but that is returning an error for me. I think the "setHp" part is wrong, but I can't find a proper tag anywhere else. Am I on the right track?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,787
Reaction score
12,217
First Language
English
Primarily Uses
RMMV
$gameParty.members() gives you an array of ALL members.  So you can't use setHp on an array.  You need to iterate over each element of that array and call the setHp function for each one.
 

LeoEmpire

Villager
Member
Joined
Jun 4, 2016
Messages
6
Reaction score
0
First Language
English
Primarily Uses
That worked out perfectly, thank you!
 

Pine Towers

Knight Hospitaller
Veteran
Joined
Nov 11, 2015
Messages
466
Reaction score
223
First Language
Portuguese
Primarily Uses
RMMV
@Shaz, please don't double post. If necessary use the Edit button.

I'm just joking, please don't take this seriously.  ;)



Going alongside the topic's intention, is there a way to assign a Parameter to another? Like if I want HP to be 3x Def, is that possible?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,787
Reaction score
12,217
First Language
English
Primarily Uses
RMMV
Please don't hijack someone else's topic to ask your own questions.  Start your own thread.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Yay! One of my Youtube videos got to 100 views (in 2 days)! This Youtube thing is great, it's like the profile posts except I get to annoy entertain more people at once! Now I just have to practice my "Leave a like and hit that Subscribe button" shilling technique. :LZSexcite:
Just found out there is an about me page. I updated it and happy the way its looking!
Ladies and Gentlemen, I can't act like things will be ok anymore. It needs to be said: We have a Pandemic...
Release version of Pillow Hero is out on windows now! --> https://bit.ly/2USHKLv
Stream will be live shortly! Feeling like doing some Minecraft instead of DK64 since it has been a bit! Feel free to drop by!

Forum statistics

Threads
95,555
Messages
930,063
Members
125,841
Latest member
Firewolves
Top