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.

Simple Party Script

Hi there,
I was wondering if i could get some help on a script,

what I want is a script that allows you to choose which of the four party member slots they are added to.

if that doesnt make sense then here is an example.
I want to have the main character in the first slot, then he has a pet, and i want the pet to be added to the fourth member slot.
Normally, when you add a character to the party it atomatically adds them to the second slot and you can't change them. and when you already had three and then you add the pet the pet would be where i want it, in the fourth slot, but then when you remove a character it goes down to the next slot so then the pet would atomatically switch to slot 3 and then you can add another character in the forth slot.
http://img208.imageshack.us/img208/6738/memberslotsrx9.png[/img]

if you need more info, or dont get what i'm saying please let me know and i'll help you get it.

thanks. hope you guys can help me. shouldn't be too hard.
 
nope, i dont want a way to arrange the member i just want to be able to add a character to the fourth slot instead of having to have 2 other characters added before the fourth one, and i dont want the character in the fourth slot to move when a character before it leaves.

i dont want a new menu either, just something simple, a call script code, something like "$add_character[character id(member slot 1-4)]" 
if i put 4 in the parenthesis it would add the character of the id to that slot.

thanks, hope that makes sense.
 
You can lock the ones you want to stay in place and have several 'pets' to exchange in the switcher. If that's not what you wanted, then I'm sorry I misread your post.
 

khmp

Sponsor

Just feed in the Actor ID's of the pets into the Array constant at the top. If you have more than one pet the later one in the party will be the one that is shown. Hopefully through clever eventing and planning you will only ever have one pet at a time. The first 3 slots are party members that aren't pets only. The 4th is reserved for a pet. Selection skips empty slots.

Script Installation:
Insert an empty section above Main and below Scene_Debug. Paste the code below in the empty section.

Code:
#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
#  This window displays party member status on the menu screen.
#==============================================================================

class Window_MenuStatus < Window_Selectable
  #--------------------------------------------------------------------------
  # * Constant Variables
  #--------------------------------------------------------------------------
  PET_IDS = [6, 7, 8]
  #--------------------------------------------------------------------------
  # * Refresh                                                      !OVERRIDE!
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    
    @available_slots = Array.new(4, true)
    @item_max = 4
    
    for i in 0...4
      next if $game_party.actors[i].nil?

      # If the id is included within the constant array. We have found a pet.
      if PET_IDS.include?($game_party.actors[i].id)
        x = 64
        y = 3 * 116
        actor = $game_party.actors[i]
        draw_actor_graphic(actor, x - 40, y + 80)
        draw_actor_name(actor, x, y)
        draw_actor_class(actor, x + 144, y)
        draw_actor_level(actor, x, y + 32)
        draw_actor_state(actor, x + 90, y + 32)
        draw_actor_exp(actor, x, y + 64)
        draw_actor_hp(actor, x + 236, y + 32)
        draw_actor_sp(actor, x + 236, y + 64)
        @available_slots[3] = false
        next
      end
      
      x = 64
      y = @available_slots.index(true) * 116
      @available_slots[@available_slots.index(true)] = false
      actor = $game_party.actors[i]
      draw_actor_graphic(actor, x - 40, y + 80)
      draw_actor_name(actor, x, y)
      draw_actor_class(actor, x + 144, y)
      draw_actor_level(actor, x, y + 32)
      draw_actor_state(actor, x + 90, y + 32)
      draw_actor_exp(actor, x, y + 64)
      draw_actor_hp(actor, x + 236, y + 32)
      draw_actor_sp(actor, x + 236, y + 64)
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update                                                 !OVERRIDE!
  #--------------------------------------------------------------------------
  def update
    super
    first_run = true
    # If cursor is movable
    if self.active and @item_max > 0 and @index >= 0
      # If pressing down on the directional buttons
      if Input.repeat?(Input::DOWN)
        # If column count is 1 and directional button was pressed down with no
        # repeat, or if cursor position is more to the front than
        # (item count - column count)
        loop do
          break unless @available_slots[@index]
          if (@column_max == 1 and Input.trigger?(Input::DOWN)) or
             @index < @item_max - @column_max
            # Move cursor down
            $game_system.se_play($data_system.cursor_se) if first_run
            first_run = false
            @index = (@index + @column_max) % @item_max
          end
        end
      end
      # If the up directional button was pressed
      if Input.repeat?(Input::UP)
        # If column count is 1 and directional button was pressed up with no
        # repeat, or if cursor position is more to the back than column count
        loop do
          break unless @available_slots[@index]
          if (@column_max == 1 and Input.trigger?(Input::UP)) or
             @index >= @column_max
            # Move cursor up
            $game_system.se_play($data_system.cursor_se) if first_run
            first_run = false
            @index = (@index - @column_max + @item_max) % @item_max
          end
        end
      end
      # If the right directional button was pressed
      if Input.repeat?(Input::RIGHT)
        # If column count is 2 or more, and cursor position is closer to front
        # than (item count -1)
        if @column_max >= 2 and @index < @item_max - 1
          # Move cursor right
          $game_system.se_play($data_system.cursor_se)
          @index += 1
        end
      end
      # If the left directional button was pressed
      if Input.repeat?(Input::LEFT)
        # If column count is 2 or more, and cursor position is more back than 0
        if @column_max >= 2 and @index > 0
          # Move cursor left
          $game_system.se_play($data_system.cursor_se) if first_run
          first_run = false
          @index -= 1
        end
      end
      # If R button was pressed
      if Input.repeat?(Input::R)
        # If bottom row being displayed is more to front than bottom data row
        if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
          # Move cursor 1 page back
          $game_system.se_play($data_system.cursor_se)
          @index = [@index + self.page_item_max, @item_max - 1].min
          self.top_row += self.page_row_max
        end
      end
      # If L button was pressed
      if Input.repeat?(Input::L)
        # If top row being displayed is more to back than 0
        if self.top_row > 0
          # Move cursor 1 page forward
          $game_system.se_play($data_system.cursor_se)
          @index = [@index - self.page_item_max, 0].max
          self.top_row -= self.page_row_max
        end
      end
    end
    # Update help text (update_help is defined by the subclasses)
    if self.active and @help_window != nil
      update_help
    end
    # Update cursor rectangle
    update_cursor_rect
  end
end

Good luck with it Lost_in_Exsistance! :thumb:

Your name is still wrong btw.  :lol:
 

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