How can I check if the all party members are dead?

● ARCHIVED · READ-ONLY
Started by Magusalfador 8 posts View original ↗
  1. Hi all!!

    So, in my project, Party might be of 2, 3, 4 etc.

    I want something to occur when the whole party is dead, and I dont want to check for any number of party members just check if ALL are dead, I found the .isAllDead() method but Im not that good at programming.

    How can I check for this? (Or the correct syntax)

    Thanks!!
  2. Couldn't you just run a conditional branch that checks for each party member and if they're inflicted with knock out?
  3. It would be $gameParty.isAllDead() if the method is the correct one.
  4. Yes, but it is exactly what I want to avoid, so the work is cleaner. I just check the gameover scene and it IS $gameParty.isAllDead() but is not working for me. Like if I check for each chacrater, works, but not if I use $gameParty.isAllDead().
    Hmm....
  5. After checking it isAllDead is a battle only method. So
    Code:
    var deadMembers = 0;
    for (var i in $gameParty.members()) {
    if (!$gameParty.members()[i].isStateAffected(1)) break;
    else deadMembers++;
    }
    if (deadMembers == $gameParty.members().length) perform whatever
  6. Yeah, I was checking it on battle.
    But that should work, thanks @Poryg !!
  7. All wortking now. Thanks!

    RESOLVED.
  8. This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.