Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Dargor's Large Party script and shop menu
#2
A little bit of exercise... Winking

Code:
#==============================================================================
# ** Large Party Scene Shop & Window Expansion
#------------------------------------------------------------------------------
#    by DerVVulfman
#    version 1.0
#    08-28-2013
#    RGSS / RPGMaker XP
#------------------------------------------------------------------------------
#
#    Requested by:  Simon Greedwell
#
#    Just a quick rewrite of the Shop Status window and Scene_Shop script to
#    allow Dargor's Large Party system work.  It should also work with other
#    similar large party systems for RPGMaker XP, but untried.  However, the
#    highlighting feature works even without the use of a large party system.
#
#    When in the Shop Buy window, hitting the L & R member cycling keys ( or
#    the Q & W on the keyboard ), you exit the Buy window & enter the status
#    window.  During this time,  all the members within the  window  will be
#    highlighted.  Use Up/Down keys to scroll through them.  ESC returns you
#    to the Buy window.
#
#==============================================================================



#==============================================================================
# ** Window_ShopStatus
#------------------------------------------------------------------------------
#  This window displays number of items in possession and the actor's equipment
#  on the shop screen.
#==============================================================================

class Window_ShopStatus < Window_Base
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :index                    # Window Index
  attr_accessor :item_max                 # Window Max Items
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias large_party_shop_status_initialize initialize  
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    # Original method
    large_party_shop_status_initialize
    # Set Contents index
    @index = 0
    # Set Contents size
    @item_max = $game_party.actors.size
    # Refresh
    refresh    
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    return if @item.nil?
    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, 32, "number in possession")
    self.contents.font.color = normal_color
    self.contents.draw_text(204, 0, 32, 32, number.to_s, 2)
    return if @item.is_a?(RPG::Item)
    # Create Start and End points for actor sorting
    start_count = 0 + @index
    end_count = start_count + 3
    end_count = $game_party.actors.size if end_count > $game_party.actors.size
    # Reset Line Count for Text Display
    line_count = 0
    # Equipment adding information
    for i in start_count..end_count
      # Get actor
      actor = $game_party.actors[i]
      # If equippable, use normal text color, otherwise use invalid text color
      self.contents.font.color = (actor.equippable?(@item)) ?
                                  normal_color : disabled_color
      # Draw actor's name
      self.contents.draw_text(4, 48 + 64 * line_count, 120, 32, actor.name)
      # Get current equipment
      if @item.is_a?(RPG::Weapon)
        # For Weapon
        item1 = $data_weapons[actor.weapon_id]
      else
        # For armor, branched on Armor kind
        case @item.kind
        when 0 ; item1 = $data_armors[actor.armor1_id]
        when 1 ; item1 = $data_armors[actor.armor2_id]
        when 2 ; item1 = $data_armors[actor.armor3_id]
        else ;   item1 = $data_armors[actor.armor4_id]
        end
      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, 48 + 64 * line_count, 112, 32,
          sprintf("%+d", change), 2)
      end
      # Draw item
      unless item1.nil?
        x = 4
        y = 80 + 64 * line_count
        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, 32, item1.name)
      end
      # Advance Line by 1
      line_count += 1
    end
    # Update Cursor Rectangle
    update_cursor_rect
  end
  #--------------------------------------------------------------------------
  # * Update Cursor Rectangle
  #--------------------------------------------------------------------------
  def update_cursor_rect
    # Remove if window is inactive
    return self.cursor_rect.empty unless self.active
    # Update cursor rectangle
    self.cursor_rect.set(0, 48, 240, 256)
  end  
end



#==============================================================================
# ** Scene_Shop
#------------------------------------------------------------------------------
#  This class performs shop screen processing.
#==============================================================================

class Scene_Shop
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias large_party_scene_shop_update update
  alias large_party_scene_shop_update_buy update_buy
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    large_party_scene_shop_update
    # If status window is active: call update_status
    if @status_window.active
      update_status
      return
    end
  end  
  #--------------------------------------------------------------------------
  # * Frame Update (when buy window is active)
  #--------------------------------------------------------------------------
  def update_buy
    large_party_scene_shop_update_buy
    @status_window.active = false
    # If C button was pressed
    if Input.trigger?(Input::L) or Input.trigger?(Input::R)
      # Play decision SE
      $game_system.se_play($data_system.cursor_se)
      @status_window.active = true
      @buy_window.active = false
      @status_window.refresh
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when buy window is active)
  #--------------------------------------------------------------------------
  def update_status
    if Input.repeat?(Input::DOWN)
      $game_system.se_play($data_system.cursor_se)
      max = @status_window.item_max - 4
      val = @status_window.index += 1
      val = max if val > max
      @status_window.index = val
      @status_window.refresh
    end
    if Input.repeat?(Input::UP)
      $game_system.se_play($data_system.cursor_se)
      val = @status_window.index -= 1
      val = 0 if val < 0
      @status_window.index = val
      @status_window.refresh
    end    
    # If C button was pressed
    if Input.trigger?(Input::B)
      # Play decision SE
      $game_system.se_play($data_system.cancel_se)
      @status_window.active = false
      @buy_window.active = true
      @status_window.refresh
      return
    end
  end  
end
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png] [Image: liM4ikn.png] [Image: fdzKgZA.png] [Image: sj0H81z.png]
[Image: QL7oRau.png] [Image: uSqjY09.png] [Image: GAA3qE9.png] [Image: 2Hmnx1G.png] [Image: BwtNdKw.png%5B]
Above are clickable links

Reply }


Messages In This Thread
RE: Dargor's Large Party script and shop menu - by DerVVulfman - 08-28-2013, 09:43 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
   Script compatibility help Lord Vectra 3 3,670 07-25-2021, 11:42 PM
Last Post: DerVVulfman
   Adding face script on Cogwheel's RTAB Battle Status rekkatsu 15 13,249 08-25-2020, 03:09 AM
Last Post: DerVVulfman
   "Wait" in the script Whisper 13 13,980 04-28-2020, 04:06 PM
Last Post: Whisper
   Skill Cooldown script Fenriswolf 11 14,405 12-10-2019, 11:10 AM
Last Post: Fenriswolf
   Need help with my menu - Current issue is item grid layout LilyFrog 41 34,078 09-24-2018, 02:03 AM
Last Post: LilyFrog
   Special Items Separate Menu Diorm 41 37,320 02-10-2018, 06:06 PM
Last Post: Diorm
   Sorting Items in Shop Window Melana 13 15,807 01-18-2018, 05:49 AM
Last Post: DerVVulfman
   Help iwth script (RGSS Player crash) Whisper 3 7,736 06-17-2017, 05:03 PM
Last Post: Whisper
   Help modifying a script Keeroh 7 9,131 06-11-2017, 04:43 PM
Last Post: DerVVulfman
Question  Mog Menu script: help me stop the crazy picture movement during transitions Zachariad 4 8,790 05-31-2017, 05:10 AM
Last Post: Zachariad



Users browsing this thread: