じ☆ve冰风 发表于 2026-7-7 18:06:32

8-Actor Party

8-Actor-Party

This is a very simple edit I have made so the RMXP engine allows 8 heroes and show them in all the instances necessary. It consists mostly of firstly allowing the party to have 8 heroes, then tweaking the MenuStatus, the Shop, Item Usage, the default Battle System, the Save window, and so on, so the heroes always appear.

It does look crowded sometimes with 8 heroes in the party, that's why I made it kind of "adaptative", so it only makes it look this way when there are in fact 8 heroes. Default battle with 8 heroes is a disaster. Heheh.

Screenshots

Spoiler













An implementation using other battle system, compatible with more than 4 heroes (GTBS in this case):

Spoiler



How to Use

Insert the Script below above Main, and below others. Then all you need to do is adding heroes normally via events.

 


Demo

8-Actor-Party.zip


Script

Spoiler                 Code:        
#==============================================================================# ** 8_Hero_Party - by cockroach#------------------------------------------------------------------------------#This script is meant to permit 8 heroes in the party.#The heroes will appear in every instance of the game and show up properly,#but in many cases it may look crowded. (Specially in the default Battle System)#This is why this goes best with another type of battle system.#If anyone wants to use even more than 8 heroes, all necessary changes are in#this script, and it is a very easy thing to alter.##All you need to do is adding heroes to the party normally, no custom script#call is necessary.##(This very simple script is free for usage and edition, in any type of game.)#==============================================================================#==============================================================================# Alterations in Game_Actor#==============================================================================class Game_Actor    def screen_x    p_size = $game_party.actors.size    if p_size < 4      p_size = 4    end    # Return after calculating x-coordinate by order of members in party    if self.index != nil      return self.index * (640/p_size) + (320/p_size)    else      return 0    endendend#==============================================================================# Alterations in Game_Party#==============================================================================class Game_Party#--------------------------------------------------------------------------# * Add an Actor#   actor_id : actor ID#--------------------------------------------------------------------------def add_actor(actor_id)    # Get actor    actor = $game_actors    # If the party has less than 8 members and this actor is not in the party    if @actors.size < 8 and not @actors.include?(actor)      # Add actor      @actors.push(actor)      # Refresh player      $game_player.refresh    endend    #--------------------------------------------------------------------------# * Random Selection of Target Actor#   hp0 : limited to actors with 0 HP#--------------------------------------------------------------------------def random_target_actor(hp0 = false)    # Initialize roulette    roulette = []    # Loop    for actor in @actors      # If it fits the conditions      if (not hp0 and actor.exist?) or (hp0 and actor.hp0?)      # Get actor class       position = ($data_classes.position)/2      # Front guard: n = 4; Mid guard: n = 3; Rear guard: n = 2      n = 4 - position      if n == 0          n = 1      end      # Add actor to roulette n times      n.times do          roulette.push(actor)      end      end    end    # If roulette size is 0    if roulette.size == 0      return nil    end    # Spin the roulette, choose an actor    return rouletteendend#==============================================================================# Alterations in Window_MenuStatus#==============================================================================class Window_MenuStatus < Window_Selectable#--------------------------------------------------------------------------# * Refresh#--------------------------------------------------------------------------def refresh    self.contents.clear    @item_max = $game_party.actors.size    for i in 0...$game_party.actors.size      x = 64      if @item_max > 5      y = i * (455 / @item_max)      else      y = i * 76.5      end      actor = $game_party.actors      draw_actor_graphic(actor, x - 40, y + 47)      draw_actor_name(actor, x, y - 9)      draw_actor_class(actor, x + 144, y - 9)      draw_actor_level(actor, x, y + 7)      draw_actor_state(actor, x + 90, y + 7)      draw_actor_exp(actor, x, y + 23)      draw_actor_hp(actor, x + 236, y + 7)      draw_actor_sp(actor, x + 236, y + 23)    endend#--------------------------------------------------------------------------# * Cursor Rectangle Update#--------------------------------------------------------------------------def update_cursor_rect    if @index < 0      self.cursor_rect.empty    else      if @item_max > 5      y = @index * (455 / @item_max) - 3      else      y = @index * 76.5 - 3      end      self.cursor_rect.set(0, y, self.width - 32, 52)    endendend#==============================================================================# Alterations in Window_Target#==============================================================================class Window_Target < Window_Selectable#--------------------------------------------------------------------------# * Refresh#--------------------------------------------------------------------------def refresh    self.contents.clear    for i in 0...$game_party.actors.size      x = 4      y = i * 55      actor = $game_party.actors      draw_actor_name(actor, x, y)      draw_actor_class(actor, x + 144, y)      draw_actor_level(actor, x + 8, y + 16)      draw_actor_state(actor, x + 8, y + 32)      draw_actor_hp(actor, x + 152, y + 16)      draw_actor_sp(actor, x + 152, y + 32)    endend#--------------------------------------------------------------------------# * Cursor Rectangle Update#--------------------------------------------------------------------------def update_cursor_rect    # Cursor position -1 = all choices, -2 or lower = independent choice    # (meaning the user's own choice)    if @index <= -2      self.cursor_rect.set(0, (@index + 10) * 55 + 6, self.width - 32, 48)    elsif @index == -1      self.cursor_rect.set(0, 0, self.width - 32 + 6, @item_max * 58 - 20)    else      self.cursor_rect.set(0, @index * 55 + 6, self.width - 32, 52)    endendend#==============================================================================# Alterations in Window_SaveFile#==============================================================================class Window_SaveFile < Window_Base#--------------------------------------------------------------------------# * Refresh#--------------------------------------------------------------------------def refresh    self.contents.clear    # Draw file number    self.contents.font.color = normal_color    name = "File#{@file_index + 1}"    self.contents.draw_text(4, 0, 600, 32, name)    @name_width = contents.text_size(name).width    # If save file exists    if @file_exist      # Draw character      for i in 0...@characters.size      bitmap = RPG::Cache.character(@characters, @characters)      cw = bitmap.rect.width / 4      ch = bitmap.rect.height / 4      src_rect = Rect.new(0, 0, cw, ch)      x = 275 - @characters.size * 24 + i * 48 - cw / 2      self.contents.blt(x, 68 - ch, bitmap, src_rect)      end      # Draw play time      hour = @total_sec / 60 / 60      min = @total_sec / 60 % 60      sec = @total_sec % 60      time_string = sprintf("%02d:%02d:%02d", hour, min, sec)      self.contents.font.color = normal_color      self.contents.draw_text(4, 8, 600, 32, time_string, 2)      # Draw timestamp      self.contents.font.color = normal_color      time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")      self.contents.draw_text(4, 40, 600, 32, time_string, 2)    endendend#==============================================================================# Alterations in Window_ShopStatus#==============================================================================class Window_ShopStatus < Window_Base#--------------------------------------------------------------------------# * Refresh#--------------------------------------------------------------------------def refresh    self.contents.clear    if @item == nil      return    end    case @item    when RPG::Item      number = $game_party.item_number(@item.id)    when RPG::Weapon      number = $game_party.weapon_number(@item.id)    when RPG::Armor      number = $game_party.armor_number(@item.id)    end    self.contents.font.color = system_color    self.contents.draw_text(4, 0, 200, 24, "number in possession")    self.contents.font.color = normal_color    self.contents.draw_text(204, 0, 32, 24, number.to_s, 2)    if @item.is_a?(RPG::Item)      return    end    # Equipment adding information    for i in 0...$game_party.actors.size      # Get actor      actor = $game_party.actors      p_size = $game_party.actors.size      # If equippable, then set to normal text color. If not, set to      # invalid text color.      if actor.equippable?(@item)      self.contents.font.color = normal_color      else      self.contents.font.color = disabled_color      end      # Draw actor's name      if p_size > 5      y1 = i * (288 / p_size)      else      y1 = i * 48      end      self.contents.draw_text(4, 24 + y1, 120, 24, actor.name)      # Get current equipment      if @item.is_a?(RPG::Weapon)      item1 = $data_weapons      elsif @item.kind == 0      item1 = $data_armors      elsif @item.kind == 1      item1 = $data_armors      elsif @item.kind == 2      item1 = $data_armors      else      item1 = $data_armors      end      # If equippable      if actor.equippable?(@item)      # If weapon      if @item.is_a?(RPG::Weapon)          atk1 = item1 != nil ? item1.atk : 0          atk2 = @item != nil ? @item.atk : 0          change = atk2 - atk1      end      # If armor      if @item.is_a?(RPG::Armor)          pdef1 = item1 != nil ? item1.pdef : 0          mdef1 = item1 != nil ? item1.mdef : 0          pdef2 = @item != nil ? @item.pdef : 0          mdef2 = @item != nil ? @item.mdef : 0          change = pdef2 - pdef1 + mdef2 - mdef1      end      # Draw parameter change values      self.contents.draw_text(124, 24 + y1, 112, 24,          sprintf("%+d", change), 2)      end      # Draw item      if item1 != nil      x = 4      y = 8 + y1 + 32      bitmap = RPG::Cache.icon(item1.icon_name)      opacity = self.contents.font.color == normal_color ? 255 : 128      self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)      self.contents.draw_text(x + 28, y, 212, 24, item1.name)      end    endendendclass Spriteset_Battle#--------------------------------------------------------------------------# * Object Initialization#--------------------------------------------------------------------------def initialize    # Make viewports    @viewport1 = Viewport.new(0, 0, 640, 320)    @viewport2 = Viewport.new(0, 0, 640, 480)    @viewport3 = Viewport.new(0, 0, 640, 480)    @viewport4 = Viewport.new(0, 0, 640, 480)    @viewport2.z = 101    @viewport3.z = 200    @viewport4.z = 5000    # Make battleback sprite    @battleback_sprite = Sprite.new(@viewport1)    # Make enemy sprites    @enemy_sprites = []    for enemy in $game_troop.enemies.reverse      @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))    end    # Make actor sprites    @actor_sprites = []    @actor_sprites.push(Sprite_Battler.new(@viewport2))    @actor_sprites.push(Sprite_Battler.new(@viewport2))    @actor_sprites.push(Sprite_Battler.new(@viewport2))    @actor_sprites.push(Sprite_Battler.new(@viewport2))    @actor_sprites.push(Sprite_Battler.new(@viewport2))    @actor_sprites.push(Sprite_Battler.new(@viewport2))    @actor_sprites.push(Sprite_Battler.new(@viewport2))    @actor_sprites.push(Sprite_Battler.new(@viewport2))    # Make weather    @weather = RPG::Weather.new(@viewport1)    # Make picture sprites    @picture_sprites = []    for i in 51..100      @picture_sprites.push(Sprite_Picture.new(@viewport3,      $game_screen.pictures))    end    # Make timer sprite    @timer_sprite = Sprite_Timer.new    # Frame update    updateend    def update    # Update actor sprite contents (corresponds with actor switching)    @actor_sprites.battler = $game_party.actors    @actor_sprites.battler = $game_party.actors    @actor_sprites.battler = $game_party.actors    @actor_sprites.battler = $game_party.actors    @actor_sprites.battler = $game_party.actors    @actor_sprites.battler = $game_party.actors    @actor_sprites.battler = $game_party.actors    @actor_sprites.battler = $game_party.actors    # If battleback file name is different from current one    if @battleback_name != $game_temp.battleback_name      @battleback_name = $game_temp.battleback_name      if @battleback_sprite.bitmap != nil      @battleback_sprite.bitmap.dispose      end      @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)      @battleback_sprite.src_rect.set(0, 0, 640, 320)    end    # Update battler sprites    for sprite in @enemy_sprites + @actor_sprites      sprite.update    end    # Update weather graphic    @weather.type = $game_screen.weather_type    @weather.max = $game_screen.weather_max    @weather.update    # Update picture sprites    for sprite in @picture_sprites      sprite.update    end    # Update timer sprite    @timer_sprite.update    # Set screen color tone and shake position    @viewport1.tone = $game_screen.tone    @viewport1.ox = $game_screen.shake    # Set screen flash color    @viewport4.color = $game_screen.flash_color    # Update viewports    @viewport1.update    @viewport2.update    @viewport4.updateendend#==============================================================================# ** Window_BattleStatus#------------------------------------------------------------------------------#This window displays the status of all party members on the battle screen.#==============================================================================class Window_Base < Windowdef shadow_color    return Color.new(0, 0, 0)end#--------------------------------------------------------------------------# * Draw Name#   actor : actor#   x   : draw spot x-coordinate#   y   : draw spot y-coordinate#--------------------------------------------------------------------------def draw_actor_name(actor, x, y, shadow = false)    self.contents.font.color = normal_color    if shadow      self.contents.font.color = shadow_color    end    self.contents.draw_text(x, y, 120, 32, actor.name)end#--------------------------------------------------------------------------# * Draw State#   actor : actor#   x   : draw spot x-coordinate#   y   : draw spot y-coordinate#   width : draw spot width#--------------------------------------------------------------------------def draw_actor_state(actor, x, y, width = 120, shadow = false)    text = make_battler_state_text(actor, width, true)    self.contents.font.color = actor.hp == 0 ? knockout_color : normal_color    if shadow      self.contents.font.color = shadow_color    end    self.contents.draw_text(x, y, width, 32, text)end#--------------------------------------------------------------------------# * Draw HP#   actor : actor#   x   : draw spot x-coordinate#   y   : draw spot y-coordinate#   width : draw spot width#--------------------------------------------------------------------------def draw_actor_hp(actor, x, y, width = 144, height = 32, shadow = false)    # Draw "HP" text string    self.contents.font.color = system_color    if shadow      self.contents.font.color = shadow_color    end    self.contents.draw_text(x, y, 32, height, $data_system.words.hp)    # Calculate if there is draw space for MaxHP    if width - 32 >= 108      hp_x = x + width - 108      flag = true    elsif width - 32 >= 28      hp_x = x + width - 48      flag = false    end    # Draw HP    self.contents.font.color = actor.hp == 0 ? knockout_color :      actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color    if shadow      self.contents.font.color = shadow_color    end    self.contents.draw_text(hp_x, y, 48, height, actor.hp.to_s, 2)    # Draw MaxHP    if flag      self.contents.font.color = normal_color      if shadow      self.contents.font.color = shadow_color      end      self.contents.draw_text(hp_x + 48, y, 12, height, "/", 1)      self.contents.draw_text(hp_x + 60, y, 48, height, actor.maxhp.to_s)    endend#--------------------------------------------------------------------------# * Draw SP#   actor : actor#   x   : draw spot x-coordinate#   y   : draw spot y-coordinate#   width : draw spot width#--------------------------------------------------------------------------def draw_actor_sp(actor, x, y, width = 144, height = 32, shadow = false)    # Draw "SP" text string    self.contents.font.color = system_color    if shadow      self.contents.font.color = shadow_color    end    self.contents.draw_text(x, y, 32, height, $data_system.words.sp)    # Calculate if there is draw space for MaxHP    if width - 32 >= 108      sp_x = x + width - 108      flag = true    elsif width - 32 >= 28      sp_x = x + width - 48      flag = false    end    # Draw SP    self.contents.font.color = actor.sp == 0 ? knockout_color :      actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color    if shadow      self.contents.font.color = shadow_color    end    self.contents.draw_text(sp_x, y, 48, height, actor.sp.to_s, 2)    # Draw MaxSP    if flag      self.contents.font.color = normal_color      if shadow      self.contents.font.color = shadow_color      end      self.contents.draw_text(sp_x + 48, y, 12, height, "/", 1)      self.contents.draw_text(sp_x + 60, y, 48, height, actor.maxsp.to_s)    endendendclass Window_BattleStatus < Window_Base#--------------------------------------------------------------------------# * Refresh#--------------------------------------------------------------------------def refresh    self.contents.clear    @item_max = $game_party.actors.size    if @item_max > 7      self.contents.font.size = 16      self.contents.font.bold = true    elsif @item_max > 6      self.contents.font.size = 18      self.contents.font.bold = true    elsif @item_max > 4      self.contents.font.size = 20      self.contents.font.bold = true    else      self.contents.font.size = 22    end    for i in 0...$game_party.actors.size      actor = $game_party.actors      if @item_max > 6      actor_x = i * 610/@item_max + 0      text_x = 75      t_height = 32      elsif @item_max > 4      actor_x = i * 612/@item_max + 4      text_x = 95      t_height = 32      else      actor_x = i * 160 + 4      text_x = 120      t_height = 32      end            # Draw shade            actor_x -= 2      draw_actor_name(actor, actor_x, 2, true)      draw_actor_hp(actor, actor_x, 34, text_x, t_height, true)      draw_actor_sp(actor, actor_x, 66, text_x, t_height, true)      if @level_up_flags      self.contents.font.color = Color.new(0, 0, 0)      self.contents.draw_text(actor_x, 98, 120, t_height, "LEVEL UP!")      else      draw_actor_state(actor, actor_x, 98, 120, true)      end            actor_x += 2      draw_actor_name(actor, actor_x, 0)      draw_actor_hp(actor, actor_x, 32, text_x, t_height)      draw_actor_sp(actor, actor_x, 64, text_x, t_height)      if @level_up_flags      self.contents.font.color = normal_color      self.contents.draw_text(actor_x, 96, 120, t_height, "LEVEL UP!")      else      draw_actor_state(actor, actor_x, 96)      end          endendendclass Scene_Battle    def phase3_setup_command_window    # Disable party command window    @party_command_window.active = false    @party_command_window.visible = false    # Enable actor command window    @actor_command_window.active = true    @actor_command_window.visible = true      p_size = $game_party.actors.size - 1    step_x = 480/p_size    if step_x > 160      step_x = 160    end    window_x = @actor_index * step_x    if @actor_index == $game_party.actors.size - 1      window_x = 480    end    # Set actor command window position    @actor_command_window.x = window_x    # Set index to 0    @actor_command_window.index = 0endend






 


本贴来自国际rpgmaker官方论坛作者:cockroach处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/8-actor-party.42232/
页: [1]
查看完整版本: 8-Actor Party