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.

Limiting amount of people in battle

Vash

Member

Alright I know how to change the limit of how many people are in the party but I want to know how to limit the amount of people going into battle.

Lets say you have 8 characters in the party but only 4 can enter battle.
 
Yes it would be easier to just save the members, remove them, and then readd them after battle, the other (long) way would be to

modify Window_BattleStatus#refresh to only draw actors 1-4 of the party, a few of the methods in Game_Party to only test the first four actors, Scene_Battle#phase3_next_actor needs to be edited, Arrow Actor needs to be modified, Scene_Battle methods make_action_orders and set_target_battlers would also need to be edited.

here use this untested, but it may work

Code:
class Scene_Battle
  MAX_ACTORS = 4
  alias remove_main main
  def main
    @saved_actors = []
    if $game_party.actors.size > MAX_ACTORS
      for i in MAX_ACTORS...$game_party.actors.size
        @saved_actors << $game_party.actors[i].id
        $game_party.remove_actor($game_party.actors[i].id)
      end
    end
  end

  alias add_battle_end battle_end
  def battle_end(result)
    for actor_id in @saved_actors
      $game_party.add_actor(actor_id)
    end
    add_battle_end(result)
  end
end


set MAX_ACTORS to the maximum number of actors participating
 

Vash

Member

I get a scripting is hang...message.

Well if you know a better way of having 8 party members and remvoing them during battle then could you please show me that?
 
here this version should work
(forgot the new method name)

Code:
class Scene_Battle
  MAX_ACTORS = 4
  alias remove_main main
  def main
    @saved_actors = []
    if $game_party.actors.size > MAX_ACTORS
      for i in MAX_ACTORS...$game_party.actors.size
        @saved_actors << $game_party.actors[i].id
        $game_party.remove_actor($game_party.actors[i].id)
      end
    end
    remove_main
  end

  alias add_battle_end battle_end
  def battle_end(result)
    for actor_id in @saved_actors
      $game_party.add_actor(actor_id)
    end
    add_battle_end(result)
  end
end
 

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