Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Bag Pockets V1.2, from the infamous PSP!
SowS
post Jun 14 2010, 05:09 AM
Post #1


The Lazy Guy
Group Icon

Group: Revolutionary
Posts: 292
Type: Scripter
RM Skill: Undisclosed




Bag Pockets V1.2
by SowS


Introduction
I'm not active here anymore but I decided to share this with you guys. biggrin.gif
This script tries to emulate the BAG in the POKéMON games. If you haven't played any POKéMON game, this script is just like KCG_CategorizeItem, and if you still don't know KCG_CategorizeItem, this script categorizes your items. *sigh*

Features
- Categorize your items.
- POKéMON game-like item scene.

Change Log
V1.2
- Fixed the bug where the pocket name doesn't get disposed.
- Rewritten the classes and methods I edited in the equip scene.
- Repositioned the windows in equip scene and battle scene.
V1.1
- Fixed Scene_Equip glitch
- Fixed Scene_Battle glitch
V1
- Initial release

Screenshots


How to Use
CODE
# Instructions:
#   Put the script under Materials section of your script editor.
#   Put this tag in the notes field of all your items/weapons/armors.
#     <pocket n>    where n is the pocket number


Script
CODE
#==============================================================================
# Bag Pockets V1.2
#   by SowS - 06/11/10
#------------------------------------------------------------------------------
# Instructions:
#   Put the script under Materials section of your script editor.
#   Put this tag in the notes field of all your items/weapons/armors.
#     <pocket n>    where n is the pocket number
#   >>>>>>>>REMINDER: You need to put the tags in all of your items!<<<<<<<<<
#   It's possible to make an item be on multiple pockets, just put multiple tags
#     on that particular item.
#==============================================================================

module SOWS
  #----------------------------------------------------------------------------
  # start of config
  #----------------------------------------------------------------------------
  MAX_POCKETS = 7 # maximum number of pockets
  # these are the names of the pockets and their corresponding pocket numbers
  POCKETS = {  # id => "Pocket Name"
  1 => "Items",
  2 => "Weapon",
  3 => "Shield",
  4 => "Headgear",
  5 => "Armor",
  6 => "Accessory",
  7 => "Key Items"
  }
  # these are the pockets in the equip scene. They're based on your current
  # max number of equip types.
  EQUIP_POCKETS = {
  1 => "Weapon",
  2 => "Shield",
  3 => "Headgear",
  4 => "Armor",
  5 => "Accessory"
  }
   # The message in the help window while Cancel/Remove is selected.
  CANCEL_HELP = "Return to the menu."          # in Scene_Item
  REMOVE_HELP = "Remove current equipment."     # in Scene_Equip
  #----------------------------------------------------------------------------
  # end of config
  #----------------------------------------------------------------------------
  def self.split_tags(obj, tag)
    obj.note.split(/[\r\n]+/).each { |notetag|
    case notetag
    when tag
      @result = $1.to_i
    end }
    return @result
  end
end

#==============================================================================
# ** Window_Item
#------------------------------------------------------------------------------
#  This window displays a list of inventory items for the item screen, etc.
#==============================================================================

class Window_Item < Window_Selectable
  include SOWS
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :page
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     x      : window x-coordinate
  #     y      : window y-coordinate
  #     width  : window width
  #     height : window height
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height)
    super(x, y, width, height)
    @column_max = 1
    self.index = 0
    self.page = 1
    refresh
  end
  #--------------------------------------------------------------------------
  # * Whether or not to include in item list
  #     item : item
  #--------------------------------------------------------------------------
  def include?(item)
    return false if item == nil
    return false if self.page != item.pocket
    if $game_temp.in_battle
      return false unless item.is_a?(RPG::Item)
    end
    return true
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    @data = []
    for item in $game_party.items
      next unless include?(item)
      @data.push(item)
      if item.id == $game_party.last_item_id
        self.index = @data.size - 1
      end
    end
    @data.push(nil) if include?(nil)
    @item_max = @data.size + 1
    create_contents
    for i in 0...@item_max - 1
      draw_item(i)
    end
    draw_cancel
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    if Input.trigger?(Input::RIGHT)
      if self.page == MAX_POCKETS
        self.page = 1
      else
        self.page += 1
      end
    elsif Input.trigger?(Input::LEFT)
      if self.page == 1
        self.page = MAX_POCKETS
      else
        self.page -= 1
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Cancel
  #--------------------------------------------------------------------------
  def draw_cancel
    rect = item_rect(@item_max - 1)
    self.contents.clear_rect(rect)
    rect.width -= 4
    self.contents.draw_text(rect, "Cancel")
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    item = @data[index]
    if item != nil
      number = $game_party.item_number(item)
      rect.width -= 4
      draw_item_name(item, rect.x, rect.y)
      self.contents.draw_text(rect, sprintf("x%2d", number), 2)
    end
  end
  #--------------------------------------------------------------------------
  # * Update Help Text
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(item == nil ? CANCEL_HELP : item.description)
  end
end

#==============================================================================
# ** Window_Pocket
#------------------------------------------------------------------------------
#  This window displays the current pocket name.
#==============================================================================

class Window_Pocket < Window_Base
  include SOWS
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :pocket
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(equip = false, x = 0, y = 0, width = 544 / 2, height = WLH + 32)
    super(x, y, width, height)
    self.pocket = 1
    @equip = equip
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    if @equip
      self.contents.draw_text(0, 0, contents.width, WLH, EQUIP_POCKETS[self.pocket], 1)
    else
      self.contents.draw_text(0, 0, contents.width, WLH, POCKETS[self.pocket], 1)
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    if Input.trigger?(Input::RIGHT)
      if self.pocket == MAX_POCKETS
        self.pocket = 1
      else
        self.pocket += 1
      end
    elsif Input.trigger?(Input::LEFT)
      if self.pocket == 1
        self.pocket = MAX_POCKETS
      else
        self.pocket -= 1
      end
    end
  end
end

#==============================================================================
# ** Window_Help
#------------------------------------------------------------------------------
#  This window shows skill and item explanations along with actor status.
#==============================================================================

class Window_Help < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(x = 0, y = 0, width = 544, height = WLH + 32)
    super(x, y, width, height)
  end
end

#==============================================================================
# ** Window_EquipItem
#------------------------------------------------------------------------------
#  This window displays choices when opting to change equipment on the
# equipment screen.
#==============================================================================

class Window_EquipItem < Window_Item
  include SOWS
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    @data = []
    for item in $game_party.items
      next unless include?(item)
      @data.push(item)
      if item.id == $game_party.last_item_id
        self.index = @data.size - 1
      end
    end
    @data.push(nil) if include?(nil)
    @item_max = @data.size
    create_contents
    for i in 0...@item_max
      draw_item(i)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    item = @data[index]
    if item != nil
      number = $game_party.item_number(item)
      rect.width -= 4
      draw_item_name(item, rect.x, rect.y)
      self.contents.draw_text(rect, sprintf("x%2d", number), 2)
    else
      self.contents.draw_text(rect, "Remove")
    end
  end
  #--------------------------------------------------------------------------
  # * Update Help Text
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(item == nil ? REMOVE_HELP : item.description)
  end
end

#==============================================================================
# ** Scene_Item
#------------------------------------------------------------------------------
#  This class performs the item screen processing.
#==============================================================================

class Scene_Item < Scene_Base
  #--------------------------------------------------------------------------
  # * Method Aliasing
  #--------------------------------------------------------------------------
  alias sows_pocket_update update unless $@
  alias sows_pocket_terminate terminate unless $@
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background
    @viewport = Viewport.new(0, 0, 544, 416)
    @help_window = Window_Help.new(0, 416 - 56)
    @help_window.viewport = @viewport
    @item_window = Window_Item.new(544 / 2, 0, 544 / 2, 360)
    @item_window.viewport = @viewport
    @item_window.help_window = @help_window
    @item_window.active = false
    @title_window = Window_Pocket.new
    @title_window.viewport = @viewport
    @target_window = Window_MenuStatus.new(0, 0)
    hide_target_window
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    sows_pocket_terminate
    @title_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Update Frame
  #--------------------------------------------------------------------------
  def update
    sows_pocket_update
    @title_window.update
    @item_window.refresh if (Input.repeat?(Input::RIGHT) or Input.repeat?(
      Input::LEFT))
    @title_window.refresh if (Input.repeat?(Input::RIGHT) or Input.repeat?(
      Input::LEFT))
  end
  #--------------------------------------------------------------------------
  # * Update Item Selection
  #--------------------------------------------------------------------------
  def update_item_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    elsif Input.trigger?(Input::C)
      if @item_window.index == @item_window.item_max - 1
        return_scene
      else
        @item = @item_window.item
        $game_party.last_item_id = @item.id
        if $game_party.item_can_use?(@item)
          Sound.play_decision
          determine_item
        else
          Sound.play_buzzer
        end
      end
    end
  end
end

#==============================================================================
# ** Scene_Equip
#------------------------------------------------------------------------------
#  This class performs the equipment screen processing.
#==============================================================================

class Scene_Equip < Scene_Base
  #--------------------------------------------------------------------------
  # * Method Aliasing
  #--------------------------------------------------------------------------
  alias sows_pocket_terminate terminate unless $@
  alias sows_pocket_update update unless $@
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background
    @actor = $game_party.members[@actor_index]
    @help_window = Window_Help.new(0, 416 - 56)
    create_item_windows
    @equip_window = Window_Equip.new(208, 0, @actor)
    @equip_window.help_window = @help_window
    @equip_window.index = @equip_index
    @status_window = Window_EquipStatus.new(0, 0, @actor)
    @title_window = Window_Pocket.new(true, 0, 152)
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    sows_pocket_terminate
    @title_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Update Frame
  #--------------------------------------------------------------------------
  def update
    sows_pocket_update
    @title_window.update
    if @equip_window.active
      if Input.trigger?(Input::DOWN)
        if @title_window.pocket == EQUIP_TYPE_MAX
          @title_window.pocket = 1
        else
          @title_window.pocket += 1
        end
        @title_window.refresh
      elsif Input.trigger?(Input::UP)
        if @title_window.pocket == 1
          @title_window.pocket = EQUIP_TYPE_MAX
        else
          @title_window.pocket -= 1
        end
        @title_window.refresh
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Create Item Window
  #--------------------------------------------------------------------------
  def create_item_windows
    @item_windows = []
    for i in 0...EQUIP_TYPE_MAX
      @item_windows[i] = Window_EquipItem.new(544 / 2, 152, 544 / 2, 208, @actor, i)
      @item_windows[i].help_window = @help_window
      @item_windows[i].visible = (@equip_index == i)
      @item_windows[i].height = 208
      @item_windows[i].active = false
      @item_windows[i].index = -1
    end
  end
  #--------------------------------------------------------------------------
  # * Update Status Window
  #--------------------------------------------------------------------------
  def update_status_window
    if @equip_window.active
      @status_window.set_new_parameters(nil, nil, nil, nil)
    elsif @item_window.active
      if @item_window.index == @item_window.item_max - 1
        @status_window.set_new_parameters(nil, nil, nil, nil)
      else
        temp_actor = @actor.clone
        temp_actor.change_equip(@equip_window.index, @item_window.item, true)
        new_atk = temp_actor.atk
        new_def = temp_actor.def
        new_spi = temp_actor.spi
        new_agi = temp_actor.agi
        @status_window.set_new_parameters(new_atk, new_def, new_spi, new_agi)
      end
    end
    @status_window.update
  end
  #--------------------------------------------------------------------------
  # * Update Equip Region Selection
  #--------------------------------------------------------------------------
  def update_equip_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    elsif Input.trigger?(Input::R)
      Sound.play_cursor
      next_actor
    elsif Input.trigger?(Input::L)
      Sound.play_cursor
      prev_actor
    elsif Input.trigger?(Input::C)
      if @actor.fix_equipment
        Sound.play_buzzer
      else
        Sound.play_decision
        @equip_window.active = false
        @item_window.active = true
        @item_window.index = 0
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Update Item Selection
  #--------------------------------------------------------------------------
  def update_item_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @equip_window.active = true
      @item_window.active = false
      @item_window.index = -1
    elsif Input.trigger?(Input::C)
      Sound.play_equip
      @actor.change_equip(@equip_window.index, @item_window.item)
      @equip_window.active = true
      @item_window.active = false
      @item_window.index = -1
      @equip_window.refresh
      for item_window in @item_windows
        item_window.refresh
      end
    end
  end
end

#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================

class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # * Method Aliasing
  #--------------------------------------------------------------------------
  alias sows_pocket_end_item_selection end_item_selection unless $@
  alias sows_pocket_update_item_selection update_item_selection unless $@
  #--------------------------------------------------------------------------
  # * Start Item Selection
  #--------------------------------------------------------------------------
  def start_item_selection
    @help_window = Window_Help.new(0, 416 - 128 - 56)
    @item_window = Window_Item.new(544 / 2, 0, 544 / 2, 232)
    @item_window.help_window = @help_window
    @actor_command_window.active = false
    @title_window = Window_Pocket.new
  end
  #--------------------------------------------------------------------------
  # * End Item Selection
  #--------------------------------------------------------------------------
  def end_item_selection
    sows_pocket_end_item_selection
        if @title_window != nil
      @title_window.dispose
      @title_window = nil
        end
  end
  #--------------------------------------------------------------------------
  # * Update Item Selection
  #--------------------------------------------------------------------------
  def update_item_selection
    sows_pocket_update_item_selection
    @title_window.update if @title_window != nil
  end
end

#============================================================================
# ** RPG
#----------------------------------------------------------------------------
#  A module containing RPGVX Data Structures.
#============================================================================

module RPG
  
  #==========================================================================
==
  # ** Item
  #----------------------------------------------------------------------------
  #  Data class for items.
  #==========================================================================
==
  class Item < UsableItem
    def pocket
      str = SOWS.split_tags(self, /<(?:pocket)[ ]*(\d+)>/i)
      pocket = str.nil? ? 0 : str.to_i
      return pocket
    end
  end
end

#============================================================================
# ** RPG
#----------------------------------------------------------------------------
#  A module containing RPGVX Data Structures.
#============================================================================

module RPG
  
  #==========================================================================
==
  # ** Weapon
  #----------------------------------------------------------------------------
  #  Data class for weapons.
  #==========================================================================
==
  class Weapon < BaseItem
    def pocket
      str = SOWS.split_tags(self, /<(?:pocket)[ ]*(\d+)>/i)
      pocket = str.nil? ? 0 : str.to_i
      return pocket
    end
  end
end

#============================================================================
# ** RPG
#----------------------------------------------------------------------------
#  A module containing RPGVX Data Structures.
#============================================================================

module RPG
  
  #==========================================================================
==
  # ** Armor
  #----------------------------------------------------------------------------
  #  Data class for armors.
  #==========================================================================
==
  class Armor < BaseItem
    def pocket
      str = SOWS.split_tags(self, /<(?:pocket)[ ]*(\d+)>/i)
      pocket = str.nil? ? 0 : str.to_i
      return pocket
    end
  end
end


Credit
- Credit me. That's all I need.

Compatibility
I didn't test this with other scripts. :/
Paper PokéMaster:
QUOTE
Any script that modifies the equip screen must go under this one.
Also, If you're using Yanfly's Melody Battle Engine or Yanfly's small skill/item window script, the pockets won't work in-battle.


__________________________

QUOTE
Better off lazy, at least I'm not exhausted.
Go to the top of the page
 
+Quote Post
   
Paper PokéMaste...
post Jun 15 2010, 06:09 PM
Post #2


Gotta catch 'em all!
Group Icon

Group: Revolutionary
Posts: 633
Type: Event Designer
RM Skill: Skilled




Nice! I really like the layout of the windows here. biggrin.gif
Is it like this in battle, too?


__________________________
CONGRATULATIONS!
You have been selected out of OVER 9000 for a -FREE- spamwich!!
Just click this link to claim your prize!
Go to the top of the page
 
+Quote Post
   
SowS
post Jun 16 2010, 04:33 AM
Post #3


The Lazy Guy
Group Icon

Group: Revolutionary
Posts: 292
Type: Scripter
RM Skill: Undisclosed




^yes.. biggrin.gif


__________________________

QUOTE
Better off lazy, at least I'm not exhausted.
Go to the top of the page
 
+Quote Post
   
Paper PokéMaste...
post Jun 16 2010, 08:44 PM
Post #4


Gotta catch 'em all!
Group Icon

Group: Revolutionary
Posts: 633
Type: Event Designer
RM Skill: Skilled




ohmy.gif
It looks like I'll be using this!

UPDATE:
D:
It works... Sorta. It changes the layout of the items window to the neat column view. It doesn't sort the items, though.
I set the pocket IDs, then I went through my database, applying these IDs to the items and equipment.
After that, I loaded up the testmap I have. I added all the items and equipment. All of it. Every single one.
Opened up the items menu. And every pocket included every type of item.

I love the layout, but it's not very good if the pockets don't work. :/

Something you may want to add to the first post is compatibility. Any script that modifies the equip screen must go under this one.
Also, If you're using Yanfly's Melody Battle Engine or Yanfly's small skill/item window script, the pockets won't work in-battle.


__________________________
CONGRATULATIONS!
You have been selected out of OVER 9000 for a -FREE- spamwich!!
Just click this link to claim your prize!
Go to the top of the page
 
+Quote Post
   
SowS
post Jun 17 2010, 02:52 AM
Post #5


The Lazy Guy
Group Icon

Group: Revolutionary
Posts: 292
Type: Scripter
RM Skill: Undisclosed




i'm sure the pockets are working... :/
the only possible time that an item will be on multiple pockets is having multiple pocket tags in that item...
but i guess i need to rewrite some parts of it, regarding the equip scene and the battle scene.. :/


__________________________

QUOTE
Better off lazy, at least I'm not exhausted.
Go to the top of the page
 
+Quote Post
   
SowS
post Jun 17 2010, 05:06 AM
Post #6


The Lazy Guy
Group Icon

Group: Revolutionary
Posts: 292
Type: Scripter
RM Skill: Undisclosed




Update:
V1.2
- Fixed the bug where the pocket name doesn't get disposed.
- Rewritten the classes and methods I edited in the equip scene.
- Repositioned the windows in equip scene and battle scene.


__________________________

QUOTE
Better off lazy, at least I'm not exhausted.
Go to the top of the page
 
+Quote Post
   
KillerRed9
post Aug 12 2010, 12:37 PM
Post #7


Level 2
Group Icon

Group: Member
Posts: 18
Type: Mapper
RM Skill: Skilled




Anyone else getting the syntax error on a few areas of the script? Here's an edited (and clean) one that works.

Click here!
CODE
#================================================================
======
========
# Bag Pockets V1.2
# by SowS - 06/11/10
#------------------------------------------------------------------------------
# Instructions:
# Put the script under Materials section of your script editor.
# Put this tag in the notes field of all your items/weapons/armors.
# <pocket n> where n is the pocket number
# >>>>>>>>REMINDER: You need to put the tags in all of your items!<<<<<<<<<
# It's possible to make an item be on multiple pockets, just put multiple tags
# on that particular item.
#==============================================================================

module SOWS
#----------------------------------------------------------------------------
# start of config
#----------------------------------------------------------------------------
MAX_POCKETS = 7 # maximum number of pockets
# these are the names of the pockets and their corresponding pocket numbers
POCKETS = { # id => "Pocket Name"
1 => "Items",
2 => "Weapon",
3 => "Shield",
4 => "Headgear",
5 => "Armor",
6 => "Accessory",
7 => "Key Items"
}
# these are the pockets in the equip scene. They're based on your current
# max number of equip types.
EQUIP_POCKETS = {
1 => "Weapon",
2 => "Shield",
3 => "Headgear",
4 => "Armor",
5 => "Accessory"
}
# The message in the help window while Cancel/Remove is selected.
CANCEL_HELP = "Return to the menu." # in Scene_Item
REMOVE_HELP = "Remove current equipment." # in Scene_Equip
#----------------------------------------------------------------------------
# end of config
#----------------------------------------------------------------------------
def self.split_tags(obj, tag)
obj.note.split(/[\r\n]+/).each { |notetag|
case notetag
when tag
@result = $1.to_i
end }
return @result
end
end

#==============================================================================
# ** Window_Item
#------------------------------------------------------------------------------
# This window displays a list of inventory items for the item screen, etc.
#==============================================================================

class Window_Item < Window_Selectable
include SOWS
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :page
#--------------------------------------------------------------------------
# * Object Initialization
# x : window x-coordinate
# y : window y-coordinate
# width : window width
# height : window height
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super(x, y, width, height)
@column_max = 1
self.index = 0
self.page = 1
refresh
end
#--------------------------------------------------------------------------
# * Whether or not to include in item list
# item : item
#--------------------------------------------------------------------------
def include?(item)
return false if item == nil
return false if self.page != item.pocket
if $game_temp.in_battle
return false unless item.is_a?(RPG::Item)
end
return true
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
@data = []
for item in $game_party.items
next unless include?(item)
@data.push(item)
if item.id == $game_party.last_item_id
self.index = @data.size - 1
end
end
@data.push(nil) if include?(nil)
@item_max = @data.size + 1
create_contents
for i in 0...@item_max - 1
draw_item(i)
end
draw_cancel
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if Input.trigger?(Input::RIGHT)
if self.page == MAX_POCKETS
self.page = 1
else
self.page += 1
end
elsif Input.trigger?(Input::LEFT)
if self.page == 1
self.page = MAX_POCKETS
else
self.page -= 1
end
end
end
#--------------------------------------------------------------------------
# * Draw Cancel
#--------------------------------------------------------------------------
def draw_cancel
rect = item_rect(@item_max - 1)
self.contents.clear_rect(rect)
rect.width -= 4
self.contents.draw_text(rect, "Cancel")
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
item = @data[index]
if item != nil
number = $game_party.item_number(item)
rect.width -= 4
draw_item_name(item, rect.x, rect.y)
self.contents.draw_text(rect, sprintf("x%2d", number), 2)
end
end
#--------------------------------------------------------------------------
# * Update Help Text
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(item == nil ? CANCEL_HELP : item.description)
end
end

#==============================================================================
# ** Window_Pocket
#------------------------------------------------------------------------------
# This window displays the current pocket name.
#==============================================================================

class Window_Pocket < Window_Base
include SOWS
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :pocket
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(equip = false, x = 0, y = 0, width = 544 / 2, height = WLH + 32)
super(x, y, width, height)
self.pocket = 1
@equip = equip
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
if @equip
self.contents.draw_text(0, 0, contents.width, WLH, EQUIP_POCKETS[self.pocket], 1)
else
self.contents.draw_text(0, 0, contents.width, WLH, POCKETS[self.pocket], 1)
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if Input.trigger?(Input::RIGHT)
if self.pocket == MAX_POCKETS
self.pocket = 1
else
self.pocket += 1
end
elsif Input.trigger?(Input::LEFT)
if self.pocket == 1
self.pocket = MAX_POCKETS
else
self.pocket -= 1
end
end
end
end

#==============================================================================
# ** Window_Help
#------------------------------------------------------------------------------
# This window shows skill and item explanations along with actor status.
#==============================================================================

class Window_Help < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x = 0, y = 0, width = 544, height = WLH + 32)
super(x, y, width, height)
end
end

#==============================================================================
# ** Window_EquipItem
#------------------------------------------------------------------------------
# This window displays choices when opting to change equipment on the
# equipment screen.
#==============================================================================

class Window_EquipItem < Window_Item
include SOWS
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
@data = []
for item in $game_party.items
next unless include?(item)
@data.push(item)
if item.id == $game_party.last_item_id
self.index = @data.size - 1
end
end
@data.push(nil) if include?(nil)
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
item = @data[index]
if item != nil
number = $game_party.item_number(item)
rect.width -= 4
draw_item_name(item, rect.x, rect.y)
self.contents.draw_text(rect, sprintf("x%2d", number), 2)
else
self.contents.draw_text(rect, "Remove")
end
end
#--------------------------------------------------------------------------
# * Update Help Text
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(item == nil ? REMOVE_HELP : item.description)
end
end

#==============================================================================
# ** Scene_Item
#------------------------------------------------------------------------------
# This class performs the item screen processing.
#==============================================================================

class Scene_Item < Scene_Base
#--------------------------------------------------------------------------
# * Method Aliasing
#--------------------------------------------------------------------------
alias sows_pocket_update update unless $@
alias sows_pocket_terminate terminate unless $@
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
create_menu_background
@viewport = Viewport.new(0, 0, 544, 416)
@help_window = Window_Help.new(0, 416 - 56)
@help_window.viewport = @viewport
@item_window = Window_Item.new(544 / 2, 0, 544 / 2, 360)
@item_window.viewport = @viewport
@item_window.help_window = @help_window
@item_window.active = false
@title_window = Window_Pocket.new
@title_window.viewport = @viewport
@target_window = Window_MenuStatus.new(0, 0)
hide_target_window
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
sows_pocket_terminate
@title_window.dispose
end
#--------------------------------------------------------------------------
# * Update Frame
#--------------------------------------------------------------------------
def update
sows_pocket_update
@title_window.update
@item_window.refresh if (Input.repeat?(Input::RIGHT) or Input.repeat?(
Input::LEFT))
@title_window.refresh if (Input.repeat?(Input::RIGHT) or Input.repeat?(
Input::LEFT))
end
#--------------------------------------------------------------------------
# * Update Item Selection
#--------------------------------------------------------------------------
def update_item_selection
if Input.trigger?(Input::cool.gif
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::C)
if @item_window.index == @item_window.item_max - 1
return_scene
else
@item = @item_window.item
$game_party.last_item_id = @item.id
if $game_party.item_can_use?(@item)
Sound.play_decision
determine_item
else
Sound.play_buzzer
end
end
end
end
end

#==============================================================================
# ** Scene_Equip
#------------------------------------------------------------------------------
# This class performs the equipment screen processing.
#==============================================================================

class Scene_Equip < Scene_Base
#--------------------------------------------------------------------------
# * Method Aliasing
#--------------------------------------------------------------------------
alias sows_pocket_terminate terminate unless $@
alias sows_pocket_update update unless $@
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
create_menu_background
@actor = $game_party.members[@actor_index]
@help_window = Window_Help.new(0, 416 - 56)
create_item_windows
@equip_window = Window_Equip.new(208, 0, @actor)
@equip_window.help_window = @help_window
@equip_window.index = @equip_index
@status_window = Window_EquipStatus.new(0, 0, @actor)
@title_window = Window_Pocket.new(true, 0, 152)
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
sows_pocket_terminate
@title_window.dispose
end
#--------------------------------------------------------------------------
# * Update Frame
#--------------------------------------------------------------------------
def update
sows_pocket_update
@title_window.update
if @equip_window.active
if Input.trigger?(Input::DOWN)
if @title_window.pocket == EQUIP_TYPE_MAX
@title_window.pocket = 1
else
@title_window.pocket += 1
end
@title_window.refresh
elsif Input.trigger?(Input::UP)
if @title_window.pocket == 1
@title_window.pocket = EQUIP_TYPE_MAX
else
@title_window.pocket -= 1
end
@title_window.refresh
end
end
end
#--------------------------------------------------------------------------
# * Create Item Window
#--------------------------------------------------------------------------
def create_item_windows
@item_windows = []
for i in 0...EQUIP_TYPE_MAX
@item_windows[i] = Window_EquipItem.new(544 / 2, 152, 544 / 2, 208, @actor, i)
@item_windows[i].help_window = @help_window
@item_windows[i].visible = (@equip_index == i)
@item_windows[i].height = 208
@item_windows[i].active = false
@item_windows[i].index = -1
end
end
#--------------------------------------------------------------------------
# * Update Status Window
#--------------------------------------------------------------------------
def update_status_window
if @equip_window.active
@status_window.set_new_parameters(nil, nil, nil, nil)
elsif @item_window.active
if @item_window.index == @item_window.item_max - 1
@status_window.set_new_parameters(nil, nil, nil, nil)
else
temp_actor = @actor.clone
temp_actor.change_equip(@equip_window.index, @item_window.item, true)
new_atk = temp_actor.atk
new_def = temp_actor.def
new_spi = temp_actor.spi
new_agi = temp_actor.agi
@status_window.set_new_parameters(new_atk, new_def, new_spi, new_agi)
end
end
@status_window.update
end
#--------------------------------------------------------------------------
# * Update Equip Region Selection
#--------------------------------------------------------------------------
def update_equip_selection
if Input.trigger?(Input::cool.gif
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::R)
Sound.play_cursor
next_actor
elsif Input.trigger?(Input::L)
Sound.play_cursor
prev_actor
elsif Input.trigger?(Input::C)
if @actor.fix_equipment
Sound.play_buzzer
else
Sound.play_decision
@equip_window.active = false
@item_window.active = true
@item_window.index = 0
end
end
end
#--------------------------------------------------------------------------
# * Update Item Selection
#--------------------------------------------------------------------------
def update_item_selection
if Input.trigger?(Input::cool.gif
Sound.play_cancel
@equip_window.active = true
@item_window.active = false
@item_window.index = -1
elsif Input.trigger?(Input::C)
Sound.play_equip
@actor.change_equip(@equip_window.index, @item_window.item)
@equip_window.active = true
@item_window.active = false
@item_window.index = -1
@equip_window.refresh
for item_window in @item_windows
item_window.refresh
end
end
end
end

#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================

class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# * Method Aliasing
#--------------------------------------------------------------------------
alias sows_pocket_end_item_selection end_item_selection unless $@
alias sows_pocket_update_item_selection update_item_selection unless $@
#--------------------------------------------------------------------------
# * Start Item Selection
#--------------------------------------------------------------------------
def start_item_selection
@help_window = Window_Help.new(0, 416 - 128 - 56)
@item_window = Window_Item.new(544 / 2, 0, 544 / 2, 232)
@item_window.help_window = @help_window
@actor_command_window.active = false
@title_window = Window_Pocket.new
end
#--------------------------------------------------------------------------
# * End Item Selection
#--------------------------------------------------------------------------
def end_item_selection
sows_pocket_end_item_selection
if @title_window != nil
@title_window.dispose
@title_window = nil
end
end
#--------------------------------------------------------------------------
# * Update Item Selection
#--------------------------------------------------------------------------
def update_item_selection
sows_pocket_update_item_selection
@title_window.update if @title_window != nil
end
end

#============================================================================
# ** RPG
#----------------------------------------------------------------------------
# A module containing RPGVX Data Structures.
#============================================================================

module RPG

#==========================================================================
#
# ** Item
#----------------------------------------------------------------------------
# Data class for items.
#==========================================================================

class Item < UsableItem
def pocket
str = SOWS.split_tags(self, /<(?:pocket)[ ]*(\d+)>/i)
pocket = str.nil? ? 0 : str.to_i
return pocket
end
end
end

#============================================================================
# ** RPG
#----------------------------------------------------------------------------
# A module containing RPGVX Data Structures.
#============================================================================

module RPG

#==========================================================================
#
# ** Weapon
#----------------------------------------------------------------------------
# Data class for weapons.
#==========================================================================
#
class Weapon < BaseItem
def pocket
str = SOWS.split_tags(self, /<(?:pocket)[ ]*(\d+)>/i)
pocket = str.nil? ? 0 : str.to_i
return pocket
end
end
end

#============================================================================
# ** RPG
#----------------------------------------------------------------------------
# A module containing RPGVX Data Structures.
#============================================================================

module RPG

#==========================================================================
#
# ** Armor
#----------------------------------------------------------------------------
# Data class for armors.
#==========================================================================

class Armor < BaseItem
def pocket
str = SOWS.split_tags(self, /<(?:pocket)[ ]*(\d+)>/i)
pocket = str.nil? ? 0 : str.to_i
return pocket
end
end
end


Otherwise, great script, SowS!

This post has been edited by KillerRed9: Aug 12 2010, 12:40 PM
Go to the top of the page
 
+Quote Post
   
SowS
post Aug 21 2010, 05:08 AM
Post #8


The Lazy Guy
Group Icon

Group: Revolutionary
Posts: 292
Type: Scripter
RM Skill: Undisclosed




well, i haven't updated this thread so the fixed version is not yet up.


__________________________

QUOTE
Better off lazy, at least I'm not exhausted.
Go to the top of the page
 
+Quote Post
   
silvershadic
post Aug 29 2010, 11:29 AM
Post #9


Bringer of fried chicken
Group Icon

Group: Revolutionary
Posts: 107
Type: Developer
RM Skill: Intermediate




Is there a way to add an image to that giant blank pot on the left?
Go to the top of the page
 
+Quote Post
   
SowS
post Sep 6 2010, 09:32 AM
Post #10


The Lazy Guy
Group Icon

Group: Revolutionary
Posts: 292
Type: Scripter
RM Skill: Undisclosed




of course, it's possible.

i'm not scripting anything for weeks now so... sorry if an update will be much much later...


__________________________

QUOTE
Better off lazy, at least I'm not exhausted.
Go to the top of the page
 
+Quote Post
   
Frousteleous
post Oct 16 2011, 09:48 PM
Post #11


Level 2
Group Icon

Group: Member
Posts: 16
Type: Mapper
RM Skill: Advanced




I know it's been more than a year since you posted in this topic, let alone anyone else, but i figured id ask about this anyways. I love your script. It's exactly what ive need for a long time. it wook me forever to re-find it here though, as i got it somewhere else several months ago.

I've got two major problems:
1) when i put multiple tags on the item, it only goes into the first tag. Like if a potion is tagged <pocket 1><pocket 2>, itll only go into 1, since its first. So yeah, not letting me post item to multiple bags.

2) In battle the bag wont slide to the next pocket. so only pocket 1 is available. this would be fine if the above problem was solved because i could just make an "in battle" pocket. but thats not the case :'( I figured it might be confliciting scripts, so i put it above all others. still didnt work. i put it into a new, untouched project and still had the same problems.

bottom line: i was just wondering if you ever fixed it since your last post, as it is your script.

if not, i was wondering if you knew of any other similar scripts, as ive never found one as suitable and customizable as yours smile.gif
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 19th May 2013 - 10:37 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker