Party Size as a variable?

Hi everyone,

I ran into a problem - as I cannot predict how many party members the player will control at any given time, balancing combat is a real pain, as encounters will be too hard or too easy...

Is there a way to monitor some sort of ''party size'' variable at any given time? 

I suppose that I could run a parallel process that checks for every actor if that actor is in the party and then add 1 for everyone that's there, but that is both cumbersome and impractical...

Any hints?
Here's a hint

 

To check the total hp of the currently alive enemy troop members...

Put something like this as the script call option of a conditional branch check (or whatever)

$game_troop.members.compact.select{|i| i.alive? }.inject(0) { |r,i| r += i.hp }
I know it's not exactly what your looking for, but I think the knowledge of how to do what you want to do (or where to look) can be taken from this script call
This stores the current party size (up to the max number of actors in battle, default is 4) in variable 1

Code:
$game_variables[1] = $game_party.battle_members.size
This stores the current party size (up to the max number of actors in battle, default is 4) in variable 1

$game_variables[1] = $game_party.battle_members.size
Perfect, thanks ^^ 

I guess that running it as parallel process shouldn't cause any problems.
Or as an alternative:

8MBlK2z2pm.jpg
Oops, didn't know there was an event for that 😀

Does this give you the battle party or general party size? General party is uncapped, but only the first X (usually 4) can be in combat.

If your game doesn't give you more than 4 members, then the difference doesn't matter, of course.

/edit: Just tested it, the command gives you the total party size, regardless of battle or not:

Code:
def game_data_operand(type, param1, param2)    case type   (...)    when 7  # Other      (...)      when 1  # number of party members        return $game_party.members.size
/edit: Just tested it, the command gives you the total party size, regardless of battle or not:
Not quite, $game_party.members should be equivalent to $game_party.battle_members during battle:

Code:
class Game_Party  # [...]  #--------------------------------------------------------------------------  # * Get Members  #--------------------------------------------------------------------------  def members    in_battle ? battle_members : all_members  end
Why would you want to run it as a parallel process? Does your party randomly get new members and lose members? That is the ONLY reason you would want to run it as a parallel process.


You KNOW when your party size is changing - it is when you call the Change Party Members command in any event. Why not just update the variable immediately afterwards?
Why would you want to run it as a parallel process? Does your party randomly get new members and lose members? That is the ONLY reason you would want to run it as a parallel process.

You KNOW when your party size is changing - it is when you call the Change Party Members command in any event. Why not just update the variable immediately afterwards?
I'm afraid that with permadeath and random things that can kill party members ''out of nowhere'' (aka poison etc.) parallel is probably the safer bet. I just have no clue when and who can die and be removed from the party... ^^'

That said yes, everyone else should not use it as parallel process 🙂
"Killing" party members does not remove them from the party. The party size includes dead party members.

Original thread: https://forums.rpgmakerweb.com/threads/party-size-as-a-variable.39030/