Party Size in Formula

Hello,


I am trying to make a party-wide healing spell where amount healed depends on the size of the party. I cannot figure out how to refer to party size in formula bar. Here is an example of what I want:


Spell: Cure (heals approx. 20% of max hp dependant on magic power and level difference)


Scope: 1 Ally


Type: HP Recover


( b.mhp * .2 ) * ( a.mdef / ( b.level * 10 ) )


Skill: Cure All (twice the potency of Cure, divided between all party members)


Scope: All Allies


Type: HP Recover


( b.mhp * ( .4 / <number of party members> ) * ( a.mdef / (b.level * 10 ) )


Ideally the Cure All spell should heal 40% to one person, 20% to two, or 10% to four party members. Alive party members only of course, don't want to waste healing on dead members.


Any help would be appreciated!


-The New Guy
add this


$gameParty.members().length
add this


$gameParty.members().length

This was a big help, thank you! 


Only problem now is, it counts dead party members in that count when casting the spell. Is there a way to count only members who are alive and active members in the fight? I tried $gameParty.Alivemembers().length but returned 0 damage. I found that value by google search of the value you gave me but didn't seem to work.

$gameParty.members().length


You can get many lengths:



$gameParty.aliveMembers().length // amount of alive members on the party

Code:
$gameParty.deadMembers().length // amout of dead members on the party

Code:
$gameParty.members().length // total amount of members on the party

Code:
$gameParty.maxBattleMembers() // amout of max characters in battle (use it for compatibility reasons)


$gameParty.aliveMembers() $gameParty.members() and $gameParty.deadMembers() are all adjusted to work in battle properly.


Then you had to change, the atk/defense/etc formula to accomplish those numbers...


That's on Game_BattlerBase...
strange, this one working great with me


$gameParty.aliveMembers().length


maybe the way you put the script in formula wrong


can you show us your formula?!
strange, this one working great with me


$gameParty.aliveMembers().length


maybe the way you put the script in formula wrong


can you show us your formula?!

( b.mhp * .4 / $gameParty.members().length ) * ( a.mdf / ( b.level * 10 ) ) 


Works properly, but if a member is did it still counts them in the damage calculation.


( b.mhp * .4 / $gameParty.alivemembers().length ) * ( a.mdf / ( b.level * 10 ) )


Returns 0 damage on all party members. Require a specific plugin perhaps?
( b.mhp * .4 / $gameParty.members().length ) * ( a.mdf / ( b.level * 10 ) ) 


Works properly, but if a member is did it still counts them in the damage calculation.


( b.mhp * .4 / $gameParty.alivemembers().length ) * ( a.mdf / ( b.level * 10 ) )


Returns 0 damage on all party members. Require a specific plugin perhaps?

I am not sure if you write it right or not but


alivemembers()    // m is capital not small


aliveMembers()
I am not sure if you write it right or not but


alivemembers()    // m is capital not small


aliveMembers()

And that was it, works now! Thank you so much!

Original thread: https://forums.rpgmakerweb.com/threads/party-size-in-formula.66423/