Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

how to end battle when the first 4 actors die

Status
Not open for further replies.

A J

Member

I've been working for the last 3 hour on a script to allow changing members during battle by using the of Party Control script that was wrote by Fomar0153 what I did was this

I add an option in the Window_PartyCommand "Change" to change members what is happing is the Window_MenuStatus show up and by the help of Fomar0153 script I can change the actors
every thing is working perfect but it's turn out that when the first 4 actor die the game over scene don't work's it's turns out that it only happen when all the actors die
Code:
 if $game_party.all_dead? or $game_party.actors.size == 0

Is there is a way to call the game over scene when the first 4 actors are all dead?
 

A J

Member

I know that but what I meant was how to change this
Code:
if $game_party.all_dead? or $game_party.actors.size == 0
to
Code:
if [B][COLOR=Red]all the frist members die[/COLOR][/B] or $game_party.actors.size == 0
 
The default party is 4 members. I guess fomar's script includes the non-active members as well in the @actors array. Use this:

Code:
class Game_Party
  def all_dead?
    for i in 0..3
      return false unless @actors[i].dead?
    end
    return true
  end
end

No promises. You might want to check in with Fomar on this one.
 
Odd I remember picking this up when I tested the script, maybe I forgot to fix it. Thanks for the help seph.
Hmm...
Code:
  def all_dead?
    if $game_party.actors.size == 0
      return false
    end
    for actor in @actors
      if actor.hp > 0
        return false
      end
      if actor.index >= 4
        return true
      end
    end
    return true
  end
Is already in the script so it should work.
 

A J

Member

thanks but it's not working it's already there

edit: it worked
all what I did is putting them both together
Code:
  def all_dead?
    if $game_party.actors.size == 0
      return false
    end
    for actor in @actors
      if actor.hp > 0
        return false
      end
      if actor.index >= 4
        return true
      end
    end
    return true
  end
    def all_dead?
    for i in 0..3
      return false unless @actors[i].dead?
    end
    return true
  end
end

Thanks for both of your help
 
Haha. Putting both of them means only one of them worked... that last one you put in there. :p But you should change it with this:

Code:
class Game_Party
  def all_dead?
    return true if @actors.size == 0
    for i in 0..3
      return false unless @actors[i].dead?
    end
    return true
  end
end
This topic has been resolved. If A J or any other users have any questions or further problems regarding this topic, please create a new thread about them.

Thank you!
 
Status
Not open for further replies.

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top