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.

Visable Party Change

Status
Not open for further replies.
Currently, in my game, if you press a certain button on the map, the party order will rotate. Alternatively, you can select 'Party' in the menu and rearrange the party members. However, doing this will not change the actor on the map. I have no idea how to make it happen, so if someone does, please fix it. Thank you very much, in advanced.

Here's my CMS

Code:
# script made by squall from rmxp.net / squall@loeher.zzn.com

# don't really need to give me credit for this.

# please paste the script in a new section ABOVE "main"

# this allow to have an unlimited number of actor in party.

# to change the max actors that can be in the party look just below.

# the party is cut down to 4 actor in battles

# some windows are compacted or re-made to fit with some other ones. those are

# Window_Gold and Window_PlayTime. feel free to remove them if you don't like

# the way they are...

# Enjoy!===============================================
# ¦ Game_Party
#==============================================================================

class Game_Party
 #--------------------------------------------------------------------------
 # ? define instance variable
 #--------------------------------------------------------------------------
 attr_accessor :actors
 attr_accessor :menu_help
 #--------------------------------------------------------------------------
 # ? add an actor to the party the number (red) is
 #    the max actors to be in party
 #--------------------------------------------------------------------------
 def add_actor(actor_id)
   actor = $game_actors[actor_id]
   if @actors.size < 200 and not @actors.include?(actor)
     @actors.push(actor)
     $game_player.refresh
   end
 end
end

#==============================================================================
# ¦ Window_Base
#==============================================================================

class Window_Base < Window
 #--------------------------------------------------------------------------
 # ? draw character's HP meter
 #--------------------------------------------------------------------------
 def draw_actor_hp_meter(actor, x, y, width = 70, type = 0)
   if type == 1 and actor.hp == 0
     return
   end
   self.contents.font.color = system_color
   self.contents.fill_rect(x-1, y+27, width+2,5, Color.new(0, 0, 0, 255))
   w = width * actor.hp / actor.maxhp
   self.contents.fill_rect(x, y+28, w,1, Color.new(174, 68, 89, 255))
   self.contents.fill_rect(x, y+29, w,1, Color.new(156, 61, 80, 255))
   self.contents.fill_rect(x, y+30, w,1, Color.new(138, 53, 70, 255))
 end
 #--------------------------------------------------------------------------
 # ? draw character's SP meter
 #--------------------------------------------------------------------------
 def draw_actor_sp_meter(actor, x, y, width = 70, type = 0)
   if type == 1 and actor.sp == 0
     return
   end
   self.contents.font.color = system_color
   self.contents.fill_rect(x-1, y+27, width+2,5, Color.new(0, 0, 0, 255))
   w = width * actor.sp / actor.maxsp
   self.contents.fill_rect(x, y+28, w,1, Color.new(62, 72, 164, 255))
   self.contents.fill_rect(x, y+29, w,1, Color.new(55, 65, 149, 255))
   self.contents.fill_rect(x, y+30, w,1, Color.new(49, 57, 130, 255))
 end
 #--------------------------------------------------------------------------
 # ? define method to draw squares
 #--------------------------------------------------------------------------
 def draw_square(x, y, width, color)
   self.contents.fill_rect(x, y, width, 1, color)
   self.contents.fill_rect(x, y, 1, width, color)
   self.contents.fill_rect(x + width, y, 1, width + 1, color)
   self.contents.fill_rect(x, y + width, width + 1, 1, color)
 end
end

#==============================================================================
# ¦ Window_Gold
#------------------------------------------------------------------------------
#  in this one the text has been replaced by an icon. ^^
#==============================================================================

class Window_Gold < Window_Base
 #--------------------------------------------------------------------------
 # ? initialize
 #--------------------------------------------------------------------------
 def initialize
   super(0, 0, 160, 54)
   self.contents = Bitmap.new(width - 32, height - 32)
   refresh
 end
 #--------------------------------------------------------------------------
 # ? refresh
 #--------------------------------------------------------------------------
 def refresh
   self.contents.clear
   cx = 24
   self.contents.font.color = normal_color
   self.contents.draw_text(4, 0, 120-cx-2, 30, $game_party.gold.to_s, 2)
   self.contents.font.color = system_color
   bitmap = RPG::Cache.icon("032-Item011")
   rect = Rect.new(0, 0, 22, 22)
   self.contents.blt(124-cx, 0, bitmap, rect)
 end
end

#==============================================================================
# ¦ Window_PlayTime
#------------------------------------------------------------------------------
#  This window has been compacted a bit to show every command in the menu
#==============================================================================

class Window_PlayTime < Window_Base
 #--------------------------------------------------------------------------
 # ? initialize
 #--------------------------------------------------------------------------
 def initialize
   super(0, 0, 160, 54)
   self.contents = Bitmap.new(width - 32, height - 32)
   refresh
 end
 #--------------------------------------------------------------------------
 # ? refresh
 #--------------------------------------------------------------------------
 def refresh
   self.contents.clear
   @total_sec = Graphics.frame_count / Graphics.frame_rate
   hour = @total_sec / 60 / 60
   min = @total_sec / 60 % 60
   sec = @total_sec % 60
   text = sprintf("%02d:%02d:%02d", hour, min, sec)
   self.contents.font.color = normal_color
   self.contents.draw_text(4, -2, 120, 30, text, 2)
   self.contents.font.color = system_color
   self.contents.draw_text(4, 0, 40, 2, "Play Time",1)
 end
 #--------------------------------------------------------------------------
 # ? redefine update method
 #--------------------------------------------------------------------------
 def update
   super
   if Graphics.frame_count / Graphics.frame_rate != @total_sec
     refresh
   end
 end
end

#==============================================================================
# ¦ Window_MenuStatus
#==============================================================================

class Window_MenuStatus < Window_Selectable
 #--------------------------------------------------------------------------
 # ? initialize
 #--------------------------------------------------------------------------
 def initialize
   super(0, 220, 480, 260)
   @column_max = 4
   @item_max = $game_party.actors.size
   self.contents = Bitmap.new(width - 32, row_max * 112)
   refresh
   self.active = false
   self.index = -1
 end
 #--------------------------------------------------------------------------
 # ? refresh
 #--------------------------------------------------------------------------
 def refresh
   self.contents.clear
   for i in 0...$game_party.actors.size
     x = i % 4 * 112
     y = i / 4 * 112
     actor = $game_party.actors[i]
     #draw a square to seperate chars, change disabled color with whatever
     #color you want... (method to draw square is below...)
     draw_square(x, y, 111, disabled_color)
     draw_actor_graphic(actor, x + 95, y + 55)
  
     draw_actor_name(actor, x + 5, y + 20)
     draw_actor_hp(actor, x  + 2, y + 45)
    draw_actor_sp(actor, x + 2, y + 65)
     draw_actor_level(actor, x + 5, y + 85)
   end
 end
 #--------------------------------------------------------------------------
 # ? define the page's top row
 #--------------------------------------------------------------------------
 def top_row
   return self.oy / 112
 end
 #--------------------------------------------------------------------------
 # ? define the page maximum rows
 #--------------------------------------------------------------------------
 def page_row_max
   return (self.height - 32) / 112
 end
 #--------------------------------------------------------------------------
 # ? defines a method to change the page's top row
 #--------------------------------------------------------------------------
 def top_row=(row)
   if row < 0
     row = 0
   end
   if row > row_max - 1
     row = row_max - 1
   end
   self.oy = row * 112
 end
 #--------------------------------------------------------------------------
 # ? update the cursor movement
 #--------------------------------------------------------------------------
 def update_cursor_rect
   if @index < 0
     self.cursor_rect.empty
     return
   end
   row = @index / @column_max
   if row < self.top_row
     self.top_row = row
   end
   if row > self.top_row + (self.page_row_max - 1)
     self.top_row = row - (self.page_row_max - 1)
   end
   self.cursor_rect.set(@index % 4 * 112, @index / 4 * 112 - self.oy, 112, 112)
 end
end


#==============================================================================
# ** Window_Tarfg
#------------------------------------------------------------------------------
#  This window displays party member status on the menu screen.
#==============================================================================
class Window_Target < Window_Selectable
def initialize
super(0,0, 360,480)
self.contents = Bitmap.new(width - 32, $game_party.actors.size * 120)
    self.z += 10
    @item_max = $game_party.actors.size
    refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = 64
y = i * 120
actor = $game_party.actors[i]
draw_actor_graphic(actor, x - 58, y + 86)
draw_actor_name(actor, x + 20, y - 8)
draw_actor_level(actor, x + 22, y + 17)
draw_actor_state(actor, x + 21, y +50)
draw_actor_hp(actor, x + 100, y + - 8)
draw_actor_sp(actor, x + 100, y + 20)
end
end
#--------------------------------------------------------------------------
def top_row
return self.oy / 120
end
#--------------------------------------------------------------------------
def top_row=(row)
if row < 0
row = 0
end
if row > row_max - 1
row = row_max - 1
end
self.oy = row * 120
end
#--------------------------------------------------------------------------
# * Update Cursor Position
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
row = @index / @column_max
if row < self.top_row
self.top_row = row
end
if row > self.top_row + (self.page_row_max - 1)
self.top_row = row - (self.page_row_max - 1)
end
cursor_width = self.width / @column_max - 32
x = @index % @column_max * (cursor_width + 32)
y = @index / @column_max * 120 - self.oy
self.cursor_rect.set(x, y, cursor_width, 96)
end
#--------------------------------------------------------------------------
def page_row_max
return 4
end
end


#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
#  This class handles data surrounding the system. Backround music, etc.
#  is managed here as well. Refer to "$game_system" for the instance of 
#  this class.
#==============================================================================

class Game_System
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :menu_help
  #--------------------------------------------------------------------------
  # * Object Aliasing
  #--------------------------------------------------------------------------
  alias old_initialize initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    old_initialize
    s1 = 'Use alchemy'
    s2 = 'View the journal'
    s3 = 'View all items'
    s4 = 'View and use character skills'
    s5 = 'View and use character magick'
    s6 = 'Equip weapons and armor'
    s7 = 'View character status'
    s8 = 'View character data'
    s9 = 'View enemy data'
    s10 = 'View data on both skills and magick'
    s11 = 'Organize the party'
    s12 = 'Save the game'
    s13 = 'Load a save file'
    s14 = 'End the game'
    @menu_help = [s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14]
  end
end


#==============================================================================
# ¦ Scene_Menu
#==============================================================================

class Scene_Menu
 #--------------------------------------------------------------------------
 # ? initialize
 #--------------------------------------------------------------------------
 def initialize(menu_index = 0)
   @menu_index = menu_index
   @actor_change = false
 end
 #--------------------------------------------------------------------------
 # ? main
 #--------------------------------------------------------------------------
 def main
    $game_variables[4000] = 'Smalwoud'
    @sprite = Sprite.new
    @sprite.bitmap = RPG::Cache.picture($game_variables[4000])
    @sprite.x = 481
    @sprite.y = 428
   s1 = "Alchemy"
   s2 = "Journal"
   s3 = $data_system.words.item
   s4 = $data_system.words.skill
   s5 = "Magick"
   s6 = $data_system.words.equip
   s7 = "Status"
   s8 = "Actor Data"
   s9 = "Enemy Data"
   s10 = "Ability Data"
   s11 = "Party"
   s12 = "Save"
   s13 = "Load"
   s14 = "End Game"
   @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14])
   @command_window.index = @menu_index
   if $game_party.actors.size == 0
     @command_window.disable_item(4)
     @command_window.disable_item(1)
     @command_window.disable_item(5)
     @command_window.disable_item(3)
   end
    @command_window.x = 0
    @command_window.y = 0
   if $game_system.save_disabled
     @command_window.disable_item(11)
     @command_window.disable_item(12)
   end

   @status_window = Window_MenuStatus.new
   @status_window.x = 160
   @status_window.y = 64
   
   # Make play time window
    @playtime_window = Window_PlayTime.new
    @playtime_window.x = 160
    @playtime_window.y = 426
    # Make gold window
    @gold_window = Window_Gold.new
    @gold_window.x = 320
    @gold_window.y = 426
   
   @help_window = Window_Help2.new
    update_help
   
   Graphics.transition

   loop do
     Graphics.update
     Input.update
     update
     if $scene != self
       break
     end
   end
   Graphics.freeze

   @command_window.dispose
   @status_window.dispose
   @help_window.dispose
   @gold_window.dispose
   @playtime_window.dispose
   @sprite.dispose
 end
 #--------------------------------------------------------------------------
 # ? update the windows
 #--------------------------------------------------------------------------
 def update
   @command_window.update
   @status_window.update
   @help_window.update
   @gold_window.update
   @playtime_window.update
   @sprite.update
   

   if @command_window.active
     update_command
     update_help
     return
   end
   if @status_window.active
     update_status
     return
   end
 end
 #--------------------------------------------------------------------------
 # ? update the command window
 #--------------------------------------------------------------------------
 def update_command
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     $scene = Scene_Map.new
     return
   end
   if Input.trigger?(Input::C)
     if $game_party.actors.size == 0 and @command_window.index < 4
       $game_system.se_play($data_system.buzzer_se)
       return
     end
     case @command_window.index
     when 1  # Journal
       $game_system.windowskin_name = 'asd'
       $data_system.cursor_se = nil
       $game_system.se_play($data_system.decision_se)
       $scene = Scene_Journal.new
       when 3  # Tecg
       $game_system.se_play($data_system.decision_se)
       @command_window.active = false
       @status_window.active = true
       @status_window.index = 0
       when 4  # Tecg
       $game_system.se_play($data_system.decision_se)
       @command_window.active = false
       @status_window.active = true
       @status_window.index = 0
       when 9 # Ability
          $game_system.se_play($data_system.decision_se)
          $scene = Scene_SkillBook.new
     when 2  # Item
       $game_system.se_play($data_system.decision_se)
       $scene = Scene_Item.new
     when 0  # Alchemy
       $game_system.se_play($data_system.decision_se)
       $scene = Scene_Craft.new
     when 5  # Equip
       $game_system.se_play($data_system.decision_se)
       @command_window.active = false
       @status_window.active = true
       @status_window.index = 0
     when 6  # Status
       $game_system.se_play($data_system.decision_se)
       @command_window.active = false
       @status_window.active = true
       @status_window.index = 0
     when 11  # Save
       if $game_system.save_disabled
         $game_system.se_play($data_system.buzzer_se)
         return
       end
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Save.new
     when 13  # End
       $game_system.se_play($data_system.decision_se)
       $scene = Scene_End.new
     when 12  # Load
       if $game_system.save_disabled
         $game_system.se_play($data_system.buzzer_se)
         return
       end
       $game_system.se_play($data_system.decision_se)
       $scene = Scene_Load2.new
     when 8  # Beastiary
       $game_system.se_play($data_system.decision_se)
       $scene = PXMod::Scene_Beastiary.new   
     when 10 # party actors switch
       $game_system.se_play($data_system.decision_se)
       @command_window.active = false
       @status_window.active = true
       @status_window.index = 0
     when 7 #Actor Bio
       $game_system.se_play($data_system.decision_se)
       @command_window.active = false
       @status_window.active = true
       @status_window.index = 0
     end
     return
   end
 end
 #--------------------------------------------------------------------------
 # ? update the status window
 #--------------------------------------------------------------------------
 def update_status
   if Input.trigger?(Input::B) 
     $game_system.se_play($data_system.cancel_se)
     @status_window.index = 0
     @status_window.index = -1
     @command_window.active = true
     @status_window.active = false
     @actor_change = false
     return
   end
   if Input.trigger?(Input::C)
     case @command_window.index
     when 3  # Skill
       $game_system.se_play($data_system.decision_se)
       $scene = Scene_Skill.new(@status_window.index)
       when 4  # Magick
       $game_system.se_play($data_system.decision_se)
       $scene = Scene_Magic.new(@status_window.index)
     when 5  # Equip
       $game_system.se_play($data_system.decision_se)
       $scene = Scene_Equip.new(@status_window.index)
     when 7  # Equip
       $game_system.se_play($data_system.decision_se)
       $scene = Scene_Charactor.new(@status_window.index)
       when 3  # Item
       $game_system.se_play($data_system.decision_se)
       $scene = Scene_Skill.new
     when 6  # Status
       $game_system.se_play($data_system.decision_se)
       $scene = Scene_Status.new(@status_window.index)
     when 10 # party actors switch
       $game_system.se_play($data_system.decision_se)
       if @actor_change == true
         $game_system.se_play($data_system.decision_se)
         $game_party.actors[@old_index] = $game_party.actors[@status_window.index]
         $game_party.actors[@status_window.index] = @new_actor
         @status_window.index = 0
         @actor_change = false
         @status_window.refresh
         @status_window.index = 0
         return
       end
       @old_index = @status_window.index
       @new_actor = $game_party.actors[@status_window.index]
       @actor_change = true
       @status_window.index = 0
     end
     return
   end
 end
 def update_help
    @help_window.set_text($game_system.menu_help[@command_window.index])
  end
end
 #--------------------------------------------------------------------------
 # ? battle end
 #--------------------------------------------------------------------------
 def battle_end(result)
   $game_temp.in_battle = false
   $game_party.clear_actions
   for actor in $game_party.actors
     actor.remove_states_battle
   end
   $game_troop.enemies.clear
   if $game_temp.battle_proc != nil
     $game_temp.battle_proc.call(result)
     $game_temp.battle_proc = nil
   end
   $game_party.actors = @party_mem
   $scene = Scene_Map.new
 end
 
This topic has been resolved. If kaze950 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