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.

Individual Items and Cash (Menu and Battle)

Hey so I'll get right into it.

My game has two parties and the perspective switches between the two of them. Normally i'd just search up a script for separate inventories for the two groups, but in my game the party members continually switch parties and trade places. Because of that—as well as the thematic nature of my game's story—I am looking for a way to give each of the eight playable characters individual inventories and money.

Naturally, this would primarily have an effect on:
• Menus, using items, etc—that's the obvious part
• Battles: each member can only use the items in his own inventory
• Shops: each member shops for him/herself
• Getting items: when you find something you select who gets it
• Sharing/trading items between members if they are in a party together

I'm thinking that the main menu might look something like this:
menumockup1.png


I'm hoping that someone would be willing to work on this with me. I'd be happy to make more mockups for other screens if needed.
 
This is the bare bones of the script so far lol, for some reason it took me a real long time for me to figure this out, definitely longer than I thought. Anyway, the script so far just fulfills your first and fourth parts of your request. You can get items and choose who gets them and you can use the items for that specific character within the menu. If it works well, I'll try my best to continue on to the next parts. There are few call scripts by the way.

actor = $game_party.actors 
 
Hey awesome dude. So I finally got around to trying this out.

I tested it by using those call scripts you said and it worked as expected—I had an few NPCs giving different items to one of my party members and it felt pretty smooth!! so thanks man this rocks and will make for an awesome backbone. :)

here's my next natural question, though: does it work with gold? i mean i'm not going to say that i require my mockup to be the menu, but is there a way to give each character his own gold?

the reason it matters so much because throughout the course of the game, the characters will be joining and leaving the party (there are two parties and eight characters and at various points they switch and the parties keep getting jumbled up because i really like character interaction). also will the game remember that characters have items when they are NOT in the party?

overall dude this is badass and you don't have to do more with it if you don't feel like it. if we can work on getting the rest of it to be as smooth as what you have so far this would be a really awesome script :angel:

(also worth noting i would totally encourage you to release this when its finished, i think it's totally cool enough to be SUBMITTED or whatever, and i'm not one of those douchebags who will claim ownership just because i requested it)
 
First of all, once I'm in, I'm going to finish, so I'll do whatever you need to get this script exactly how you like :D
And yes, I'll get the gold to work soon enough, but I'm about to leave my house, so I'll have to all this done after I come back or maybe later on this weekend (because I'll be out for a while). Also, I'll try to make it so that the game remembers what items/gold that actor was carrying.

(also worth noting i would totally encourage you to release this when its finished, i think it's totally cool enough to be SUBMITTED or whatever, and i'm not one of those douchebags who will claim ownership just because i requested it)

Actually, I was going to ask you next if I could do this lol, this truly is a awesome idea you got going on here, and I commend you for using it in your game. I'll make sure to put you in the credits :D
 
Script:

Code:
#==============================================================================

# Title: Individual Items and Cash | Version 1.0

# Author: TheLawG14 [aka. TheScripter]

# Requester: noise [@ hbgames.org]

#==============================================================================

#==============================================================================

# ** Game_Actor

#------------------------------------------------------------------------------

#  This class handles the actor. It's used within the Game_Actors class

#  ($game_actors) and refers to the Game_Party class ($game_party).

#==============================================================================

 

class Game_Actor < Game_Battler

  #--------------------------------------------------------------------------

  # * Public Instance Variables

  #--------------------------------------------------------------------------

  attr_accessor   :gold                     # amount of gold

  attr_accessor   :items

  #--------------------------------------------------------------------------

  # * Alias Listing

  #--------------------------------------------------------------------------

  alias scripter_game_actor_setup setup

  #--------------------------------------------------------------------------

  # * Setup

  #     actor_id : actor ID

  #--------------------------------------------------------------------------

  def setup(actor_id)

    scripter_game_actor_setup(actor_id)

    @gold = 0

    @items = {}

    @weapons = {}

    @armors = {}

  end

  #--------------------------------------------------------------------------

  # * Get Number of Items Possessed

  #     item_id : item ID

  #--------------------------------------------------------------------------

  def item_number(item_id)

    # If quantity data is in the hash, use it. If not, return 0

    return @items.include?(item_id) ? @items[item_id] : 0

  end

  #--------------------------------------------------------------------------

  # * Get Number of Weapons Possessed

  #     weapon_id : weapon ID

  #--------------------------------------------------------------------------

  def weapon_number(weapon_id)

    # If quantity data is in the hash, use it. If not, return 0

    return @weapons.include?(weapon_id) ? @weapons[weapon_id] : 0

  end

  #--------------------------------------------------------------------------

  # * Get Amount of Armor Possessed

  #     armor_id : armor ID

  #--------------------------------------------------------------------------

  def armor_number(armor_id)

    # If quantity data is in the hash, use it. If not, return 0

    return @armors.include?(armor_id) ? @armors[armor_id] : 0

  end

  #--------------------------------------------------------------------------

  # * Gain Items (or lose)

  #     item_id : item ID

  #     n       : quantity

  #--------------------------------------------------------------------------

  def gain_item(item_id, n)

    # Update quantity data in the hash.

    if item_id > 0

      @items[item_id] = [[item_number(item_id) + n, 0].max, 99].min

    end

  end

  #--------------------------------------------------------------------------

  # * Gain Weapons (or lose)

  #     weapon_id : weapon ID

  #     n         : quantity

  #--------------------------------------------------------------------------

  def gain_weapon(weapon_id, n)

    # Update quantity data in the hash.

    if weapon_id > 0

      @weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, 99].min

    end

  end

  #--------------------------------------------------------------------------

  # * Gain Armor (or lose)

  #     armor_id : armor ID

  #     n        : quantity

  #--------------------------------------------------------------------------

  def gain_armor(armor_id, n)

    # Update quantity data in the hash.

    if armor_id > 0

      @armors[armor_id] = [[armor_number(armor_id) + n, 0].max, 99].min

    end

  end

  #--------------------------------------------------------------------------

  # * Lose Items

  #     item_id : item ID

  #     n       : quantity

  #--------------------------------------------------------------------------

  def lose_item(item_id, n)

    # Reverse the numerical value and call it gain_item

    gain_item(item_id, -n)

  end

  #--------------------------------------------------------------------------

  # * Lose Weapons

  #     weapon_id : weapon ID

  #     n         : quantity

  #--------------------------------------------------------------------------

  def lose_weapon(weapon_id, n)

    # Reverse the numerical value and call it gain_weapon

    gain_weapon(weapon_id, -n)

  end

  #--------------------------------------------------------------------------

  # * Lose Armor

  #     armor_id : armor ID

  #     n        : quantity

  #--------------------------------------------------------------------------

  def lose_armor(armor_id, n)

    # Reverse the numerical value and call it gain_armor

    gain_armor(armor_id, -n)

  end

  #--------------------------------------------------------------------------

  # * Gain Gold (or lose)

  #     n : amount of gold

  #--------------------------------------------------------------------------

  def gain_gold(n)

    @gold = [[@gold + n, 0].max, 9999999].min

  end

  #--------------------------------------------------------------------------

  # * Lose Gold

  #     n : amount of gold

  #--------------------------------------------------------------------------

  def lose_gold(n)

    # Reverse the numerical value and call it gain_gold

    gain_gold(-n)

  end

  #--------------------------------------------------------------------------

  # * Determine if Item is Usable

  #     item_id : item ID

  #--------------------------------------------------------------------------

  def item_can_use?(item)

    # If item quantity is 0

    if item_number(item.id) == 0

      # Unusable

      return false

    end

    # Get usable time

    occasion = $data_items[item.id].occasion

    # If in battle

    if $game_temp.in_battle

      # If useable time is 0 (normal) or 1 (only battle) it's usable

      return (occasion == 0 or occasion == 1)

    end

    # If useable time is 0 (normal) or 2 (only menu) it's usable

    return (occasion == 0 or occasion == 2)

  end

end

 

#==============================================================================

# ** Window_Gold

#------------------------------------------------------------------------------

#  This window displays amount of gold.

#==============================================================================

 

class Window_Gold < Window_Base

  #--------------------------------------------------------------------------

  # * Object Initialization

  #--------------------------------------------------------------------------

  def initialize

    super(0, 0, 160, 64)

    self.contents = Bitmap.new(width - 32, height - 32)

    refresh

  end

  #--------------------------------------------------------------------------

  # * Refresh

  #--------------------------------------------------------------------------

  def refresh

    self.contents.clear

    gold = 0

    cx = contents.text_size($data_system.words.gold).width

    self.contents.font.color = normal_color

    for i in $game_party.actors

      gold += i.gold

    end

    self.contents.draw_text(4, 0, 120-cx-2, 32, gold.to_s, 2)

    self.contents.font.color = system_color

    self.contents.draw_text(124-cx, 0, cx, 32, $data_system.words.gold, 2)

  end

end

 

#==============================================================================

# ** Window_Command

#------------------------------------------------------------------------------

#  This window deals with general command choices.

#==============================================================================

 

class Window_Command < Window_Selectable

  #--------------------------------------------------------------------------

  # * Public Instance Variables

  #--------------------------------------------------------------------------

  attr_accessor :commands                  # commands

end

 

 

#==============================================================================

# ** Scene_Menu

#------------------------------------------------------------------------------

#  This class performs menu screen processing.

#==============================================================================

 

class Scene_Menu

  #--------------------------------------------------------------------------

  # * Alias Listing

  #--------------------------------------------------------------------------

  alias scripter_scene_menu_update_command update_command

  alias scripter_scene_menu_update_status update_status

  #--------------------------------------------------------------------------

  # * Frame Update (when command window is active)

  #--------------------------------------------------------------------------

  def update_command

    if Input.trigger?(Input::B)

      # Call original method if exited Menu

      scripter_scene_menu_update_command

    end

    if Input.trigger?(Input::C)

      if @command_window.commands = "Item"

        # Play decision SE

        $game_system.se_play($data_system.decision_se)

        # Switch to item screen

        @command_window.active = false

        @status_window.active = true

        @status_window.index = 0

      else

        # Call original method if not selecting Item Screen

        scripter_scene_menu_update_command

      end

    end

  end

  #--------------------------------------------------------------------------

  # * Frame Update (when status window is active)

  #--------------------------------------------------------------------------

  def update_status

    # Call Original Method

    scripter_scene_menu_update_status

    # If C button was pressed

    if Input.trigger?(Input::C)

      if @command_window.index == 0

        # Play decision SE

        $game_system.se_play($data_system.decision_se)

        # Switch to equipment screen

        $scene = Scene_ActorItem.new(@status_window.index)

      end

    end

  end

end

 

#==============================================================================

# ** Window_ActorGold

#------------------------------------------------------------------------------

#  This window displays amount of gold for an individual actor.

#==============================================================================

 

class Window_ActorGold < Window_Base

  #--------------------------------------------------------------------------

  # * Object Initialization

  #--------------------------------------------------------------------------

  def initialize(actor)

    super(0, 0, 160, 64)

    @actor = actor

    self.contents = Bitmap.new(width - 32, height - 32)

    refresh

  end

  #--------------------------------------------------------------------------

  # * Refresh

  #--------------------------------------------------------------------------

  def refresh

    self.contents.clear

    cx = contents.text_size($data_system.words.gold).width

    self.contents.font.color = normal_color

    self.contents.draw_text(4, 0, 120-cx-2, 32, @actor.gold.to_s, 2)

    self.contents.font.color = system_color

    self.contents.draw_text(124-cx, 0, cx, 32, $data_system.words.gold, 2)

  end

end

 

 

#==============================================================================

# ** Window_ActorTarget

#------------------------------------------------------------------------------

#  This window displays the actor information on the Item Screen.

#==============================================================================

 

class Window_ActorTarget < Window_Base

  #--------------------------------------------------------------------------

  # * Object Initialization

  #--------------------------------------------------------------------------

  def initialize(actor)

    super(160, 64, 480, 64)

    self.contents = Bitmap.new(width - 32, height - 32)

    @actor = actor

    @item_max = 1

    refresh

  end

  #--------------------------------------------------------------------------

  # * Refresh

  #--------------------------------------------------------------------------

  def refresh

    self.contents.clear

    draw_actor_state(@actor, 4, 0)

    draw_actor_hp(@actor, 148, 0)

    draw_actor_sp(@actor, 314, 0)

  end

end

 

 

#==============================================================================

# ** Window_Item

#------------------------------------------------------------------------------

#  This window displays items in possession on the item and battle screens.

#==============================================================================

 

class Window_ActorItem < Window_Selectable

  #--------------------------------------------------------------------------

  # * Object Initialization

  #--------------------------------------------------------------------------

  def initialize(actor)

    super(0, 128, 640, 352)

    @actor = actor

    @column_max = 2

    refresh

    self.index = 0

    # If in battle, move window to center of screen

    # and make it semi-transparent

    if $game_temp.in_battle

      self.y = 64

      self.height = 256

      self.back_opacity = 160

    end

  end

  #--------------------------------------------------------------------------

  # * Get Item

  #--------------------------------------------------------------------------

  def item

    return @data[self.index]

  end

  #--------------------------------------------------------------------------

  # * Refresh

  #--------------------------------------------------------------------------

  def refresh

    if self.contents != nil

      self.contents.dispose

      self.contents = nil

    end

    @data = []

    # Add item

    for i in 1...$data_items.size

      if @actor.item_number(i) > 0

        @data.push($data_items[i])

      end

    end

    # Also add weapons and items if outside of battle

    unless $game_temp.in_battle

      for i in 1...$data_weapons.size

        if @actor.weapon_number(i) > 0

          @data.push($data_weapons[i])

        end

      end

      for i in 1...$data_armors.size

        if @actor.armor_number(i) > 0

          @data.push($data_armors[i])

        end

      end

    end

    # If item count is not 0, make a bit map and draw all items

    @item_max = @data.size

    if @item_max > 0

      self.contents = Bitmap.new(width - 32, row_max * 32)

      for i in 0...@item_max

        draw_item(i)

      end

    end

  end

  #--------------------------------------------------------------------------

  # * Draw Item

  #     index : item number

  #--------------------------------------------------------------------------

  def draw_item(index)

    item = @data[index]

    case item

    when RPG::Item

      number = @actor.item_number(item.id)

    when RPG::Weapon

      number = @actor.weapon_number(item.id)

    when RPG::Armor

      number = @actor.armor_number(item.id)

    end

    if item.is_a?(RPG::Item) and

       @actor.item_can_use?(item)

      self.contents.font.color = normal_color

    else

      self.contents.font.color = disabled_color

    end

    x = 4 + index % 2 * (288 + 32)

    y = index / 2 * 32

    rect = Rect.new(x, y, self.width / @column_max - 32, 32)

    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))

    bitmap = RPG::Cache.icon(item.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, item.name, 0)

    self.contents.draw_text(x + 240, y, 16, 32, ":", 1)

    self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)

  end

  #--------------------------------------------------------------------------

  # * Help Text Update

  #--------------------------------------------------------------------------

  def update_help

    @help_window.set_text(self.item == nil ? "" : self.item.description)

  end

end

 

 

#==============================================================================

# ** Scene_ActorItem

#------------------------------------------------------------------------------

#  This class performs item screen processing for an individual actor.

#==============================================================================

 

class Scene_ActorItem

  #--------------------------------------------------------------------------

  # * Object Initialization

  #     actor_index : actor index

  #--------------------------------------------------------------------------

  def initialize(actor_index = 0)

    @actor_index = actor_index

  end

  #--------------------------------------------------------------------------

  # * Main Processing

  #--------------------------------------------------------------------------

  def main

    # Get actor

    @actor = $game_party.actors[@actor_index]

    # Make help window, item window

    @help_window = Window_Help.new

    @item_window = Window_ActorItem.new(@actor)

    # Associate help window

    @item_window.help_window = @help_window

    # Make target window (set to invisible / inactive)

    @target_window = Window_ActorTarget.new(@actor)

    @target_window.visible = true

    @target_window.active = false

    # Create gold window

    @gold_window = Window_ActorGold.new(@actor)

    @gold_window.x = 0

    @gold_window.y = 64

    # Execute transition

    Graphics.transition

    # Main loop

    loop do

      # Update game screen

      Graphics.update

      # Update input information

      Input.update

      # Frame update

      update

      # Abort loop if screen is changed

      if $scene != self

        break

      end

    end

    # Prepare for transition

    Graphics.freeze

    # Dispose of windows

    @help_window.dispose

    @item_window.dispose

    @target_window.dispose

    @gold_window.dispose

  end

  #--------------------------------------------------------------------------

  # * Frame Update

  #--------------------------------------------------------------------------

  def update

    # Update windows

    @help_window.update

    @item_window.update

    @target_window.update

    @gold_window.update

    # If item window is active: call update_item

    if @item_window.active

      update_item

      return

    end

  end

  #--------------------------------------------------------------------------

  # * Frame Update (when item window is active)

  #--------------------------------------------------------------------------

  def update_item

    # If B button was pressed

    if Input.trigger?(Input::B)

      # Play cancel SE

      $game_system.se_play($data_system.cancel_se)

      # Switch to menu screen

      $scene = Scene_Menu.new(0)

      return

    end

    # If C button was pressed

    if Input.trigger?(Input::C)

      # Get currently selected data on the item window

      @item = @item_window.item

      # If not a use item

      unless @item.is_a?(RPG::Item)

        # Play buzzer SE

        $game_system.se_play($data_system.buzzer_se)

        return

      end

      # If it can't be used

      if @actor.item_can_use?(@item.id)

        # Play buzzer SE

        $game_system.se_play($data_system.buzzer_se)

        return

      end

      # Play decision SE

      $game_system.se_play($data_system.decision_se)

      # If effect scope is an ally

      if @item.scope >= 3

        # If items are used up

        if @actor.item_number(@item.id) == 0

          # Play buzzer SE

          $game_system.se_play($data_system.buzzer_se)

          return

        end       

        target = @actor

        used = target.item_effect(@item)

        # Remake target window contents

        @target_window.refresh

        # If an item was used

        if used

          # Play item use SE

          $game_system.se_play(@item.menu_se)

          # If consumable

          if @item.consumable

            # Decrease used items by 1

            @actor.lose_item(@item.id, 1)

            # Redraw item window item

            @item_window.draw_item(@item_window.index)

          end    

          # If all party members are dead

          if $game_party.all_dead?

            # Switch to game over screen

            $scene = Scene_Gameover.new

            return

          end

          # If common event ID is valid

          if @item.common_event_id > 0

            # Common event call reservation

            $game_temp.common_event_id = @item.common_event_id

            # Switch to map screen

            $scene = Scene_Map.new

            return

          end

        end

        # If item wasn't used

        unless used

          # Play buzzer SE

          $game_system.se_play($data_system.buzzer_se)

        end

        return

      # If effect scope is other than an ally

      else

        # If command event ID is valid

        if @item.common_event_id > 0

          # Command event call reservation

          $game_temp.common_event_id = @item.common_event_id

          # Play item use SE

          $game_system.se_play(@item.menu_se)

          # If consumable

          if @item.consumable

            # Decrease used items by 1

            @actor.lose_item(@item.id, 1)

            # Draw item window item

            @item_window.draw_item(@item_window.index)

          end

          # Switch to map screen

          $scene = Scene_Map.new

          return

        end

      end

      return

    end

  end

end

 

 

#==============================================================================

# 

# *** END OF SCRIPT ***

#

#==============================================================================

 


Explanation:

1) To add gold to an actor, do the following:

actor = $game_actors[1]
actor.gain_gold(X)

First, make sure that you make the actor variable equal to the actor in the database you want. $game_actors[1] is the first actor in the database. It's up to you if you want to have this actor in your party or not (I'm assuming you'll want them in your party when they pick up the item).

X should be equal to the amount of gold you want that actor to gain.

Also, there will be a mini gold window in the actor's item screen, and a gold window that displays the total amount of gold in the party in the menu screen.


2) To add weapons/armors/items do:

actor = $game_actors[1]
actor.gain_weapon(id, number)

actor = $game_actors[1]
actor.gain_armor(id, number)

actor = $game_actors[1]
actor.gain_item(id, number)


3) Also, in order to keep your actor with the same gold, weapons, etc. if they leave your party and come back, here's what you need to do. When you click the Change Party Member option in the List of Event Commands, when you click add, there should be an option on the bottom that says Initialize. Uncheck that box and this work. What that does (if checked) resets your actor how it was originally setup in the database, and we don't want that because are actor has items and weapons that we want them to keep.


Questions:

How would you like the trade system to look, and how would you like the battle system to reflect this whole individual items system. Good luck and I hope this helps!
 
oh sweet dude i'll try this out later tonight or tomorrow when i get a chance. :)

How would you like the trade system to look, and how would you like the battle system to reflect this whole individual items system. Good luck and I hope this helps!

ultimately this is up to you. i mean the basic idea is that members in your party should logically be able to share items with each other (but not during battle, during battle they'd each be limited to the items in his/her inventory). i mean i haven't worked out the details of the battle system yet (for the sake of actually finishing the project, i was just going to use the default and modify it slightly to fit the style of the game.

i was THINKING that whenever you get an item, a menu would pop up (similar to the one in my mockup) displaying the current party members and you';d choose who to give it to, and that the same kind of menu would be used in a number of places (like trading between party members for example). but ultimately i'm not really picky as long as it WORKS. have fun with it dude :)
 
Good news, man! I think I finished! (Unless I forgot something lol):

[rgss]#==============================================================================
# Title: Individual Items and Cash | Version 1.0
# Author: TheLawG14 [aka. TheScripter]
# Requester: noise [@ hbgames.org]
#==============================================================================
 
 
#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
#  This class handles temporary data that is not included with save data.
#  Refer to "$game_temp" for the instance of this class.
#==============================================================================
 
class Game_Temp
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias scripter_game_temp_initialize initialize
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :in_menu                # in-menu flag
  attr_accessor :in_trade               # in-trade flag
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    scripter_game_temp_initialize
    @in_menu = false
    @in_trade = false
  end
end
 
 
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles the actor. It's used within the Game_Actors class
#  ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================
 
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor   :gold                     # amount of gold
  attr_accessor   :items
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias scripter_game_actor_setup setup
  #--------------------------------------------------------------------------
  # * Setup
  #     actor_id : actor ID
  #--------------------------------------------------------------------------
  def setup(actor_id)
    scripter_game_actor_setup(actor_id)
    @gold = 0
    @items = {}
    @weapons = {}
    @armors = {}
  end
  #--------------------------------------------------------------------------
  # * Get Number of Items Possessed
  #     item_id : item ID
  #--------------------------------------------------------------------------
  def item_number(item_id)
    # If quantity data is in the hash, use it. If not, return 0
    return @items.include?(item_id) ? @items[item_id] : 0
  end
  #--------------------------------------------------------------------------
  # * Get Number of Weapons Possessed
  #     weapon_id : weapon ID
  #--------------------------------------------------------------------------
  def weapon_number(weapon_id)
    # If quantity data is in the hash, use it. If not, return 0
    return @weapons.include?(weapon_id) ? @weapons[weapon_id] : 0
  end
  #--------------------------------------------------------------------------
  # * Get Amount of Armor Possessed
  #     armor_id : armor ID
  #--------------------------------------------------------------------------
  def armor_number(armor_id)
    # If quantity data is in the hash, use it. If not, return 0
    return @armors.include?(armor_id) ? @armors[armor_id] : 0
  end
  #--------------------------------------------------------------------------
  # * Gain Items (or lose)
  #     item_id : item ID
  #     n       : quantity
  #--------------------------------------------------------------------------
  def gain_item(item_id, n)
    # Update quantity data in the hash.
    if item_id > 0
      @items[item_id] = [[item_number(item_id) + n, 0].max, 99].min
    end
  end
  #--------------------------------------------------------------------------
  # * Gain Weapons (or lose)
  #     weapon_id : weapon ID
  #     n         : quantity
  #--------------------------------------------------------------------------
  def gain_weapon(weapon_id, n)
    # Update quantity data in the hash.
    if weapon_id > 0
      @weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, 99].min
    end
  end
  #--------------------------------------------------------------------------
  # * Gain Armor (or lose)
  #     armor_id : armor ID
  #     n        : quantity
  #--------------------------------------------------------------------------
  def gain_armor(armor_id, n)
    # Update quantity data in the hash.
    if armor_id > 0
      @armors[armor_id] = [[armor_number(armor_id) + n, 0].max, 99].min
    end
  end
  #--------------------------------------------------------------------------
  # * Lose Items
  #     item_id : item ID
  #     n       : quantity
  #--------------------------------------------------------------------------
  def lose_item(item_id, n)
    # Reverse the numerical value and call it gain_item
    gain_item(item_id, -n)
  end
  #--------------------------------------------------------------------------
  # * Lose Weapons
  #     weapon_id : weapon ID
  #     n         : quantity
  #--------------------------------------------------------------------------
  def lose_weapon(weapon_id, n)
    # Reverse the numerical value and call it gain_weapon
    gain_weapon(weapon_id, -n)
  end
  #--------------------------------------------------------------------------
  # * Lose Armor
  #     armor_id : armor ID
  #     n        : quantity
  #--------------------------------------------------------------------------
  def lose_armor(armor_id, n)
    # Reverse the numerical value and call it gain_armor
    gain_armor(armor_id, -n)
  end
  #--------------------------------------------------------------------------
  # * Gain Gold (or lose)
  #     n : amount of gold
  #--------------------------------------------------------------------------
  def gain_gold(n)
    @gold = [[@gold + n, 0].max, 9999999].min
  end
  #--------------------------------------------------------------------------
  # * Lose Gold
  #     n : amount of gold
  #--------------------------------------------------------------------------
  def lose_gold(n)
    # Reverse the numerical value and call it gain_gold
    gain_gold(-n)
  end
  #--------------------------------------------------------------------------
  # * Determine if Item is Usable
  #     item_id : item ID
  #--------------------------------------------------------------------------
  def item_can_use?(item)
    # If item quantity is 0
    if item_number(item.id) == 0
      # Unusable
      return false
    end
    # Get usable time
    occasion = $data_items[item.id].occasion
    # If in battle
    if $game_temp.in_battle
      # If useable time is 0 (normal) or 1 (only battle) it's usable
      return (occasion == 0 or occasion == 1)
    end
    # If useable time is 0 (normal) or 2 (only menu) it's usable
    return (occasion == 0 or occasion == 2)
  end
end
 
 
#==============================================================================
# ** Window_Gold
#------------------------------------------------------------------------------
#  This window displays amount of gold.
#==============================================================================
 
class Window_Gold < Window_Base
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    gold = 0
    cx = contents.text_size($data_system.words.gold).width
    self.contents.font.color = normal_color
    for i in $game_party.actors
      gold += i.gold
    end
    self.contents.draw_text(4, 0, 120-cx-2, 32, gold.to_s, 2)
    self.contents.font.color = system_color
    self.contents.draw_text(124-cx, 0, cx, 32, $data_system.words.gold, 2)
  end
end
 
 
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  This class performs menu screen processing.
#==============================================================================
 
class Scene_Menu
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias scripter_scene_menu_update_command update_command
  alias scripter_scene_menu_update_status update_status
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     menu_index : command cursor's initial position
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
    $game_temp.in_menu = true
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Make command window
    s1 = $data_system.words.item
    s2 = $data_system.words.skill
    s3 = $data_system.words.equip
    s4 = "Status"
    s5 = "Save"
    s6 = "End Game"
    s7 = "Trade"
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
    @command_window.height = 224
    @command_window.index = @menu_index
    # If number of party members is 0
    if $game_party.actors.size == 0
      # Disable items, skills, equipment, and status
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
    end
    # If save is forbidden
    if $game_system.save_disabled
      # Disable save
      @command_window.disable_item(4)
    end
    # Make play time window
    @playtime_window = Window_PlayTime.new
    @playtime_window.x = 0
    @playtime_window.y = 224
    # Make steps window
    @steps_window = Window_Steps.new
    @steps_window.x = 0
    @steps_window.y = 320
    # Make gold window
    @gold_window = Window_Gold.new
    @gold_window.x = 0
    @gold_window.y = 416
    # Make status window
    @status_window = Window_MenuStatus.new
    @status_window.x = 160
    @status_window.y = 0
    # Execute transition
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    @command_window.dispose
    @playtime_window.dispose
    @steps_window.dispose
    @gold_window.dispose
    @status_window.dispose  
    if $scene.is_a?(Scene_Map)
      $game_temp.in_menu = false
    else
      $game_temp.in_menu = true
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when command window is active)
  #--------------------------------------------------------------------------
  def update_command
    if Input.trigger?(Input::B)
      # Call original method if exited Menu
      scripter_scene_menu_update_command
    end
    if Input.trigger?(Input::C)
      if @command_window.index == 0
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to item screen
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      elsif @command_window.index == 6
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to trade screen
        $scene = Scene_Trade.new(0, 0)
      else
        # Call original method if not selecting Item Screen
        scripter_scene_menu_update_command
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when status window is active)
  #--------------------------------------------------------------------------
  def update_status
    # Call Original Method
    scripter_scene_menu_update_status
    # If C button was pressed
    if Input.trigger?(Input::C)
      if @command_window.index == 0
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to equipment screen
        $scene = Scene_ActorItem.new(@status_window.index)
      end
    end
  end
end
 
 
#==============================================================================
# ** Window_ActorGold
#------------------------------------------------------------------------------
#  This window displays amount of gold for an individual actor.
#==============================================================================
 
class Window_ActorGold < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(0, 0, 160, 64)
    @actor = actor
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    cx = contents.text_size($data_system.words.gold).width
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 0, 120-cx-2, 32, @actor.gold.to_s, 2)
    self.contents.font.color = system_color
    self.contents.draw_text(124-cx, 0, cx, 32, $data_system.words.gold, 2)
  end
end
 
 
#==============================================================================
# ** Window_ActorTarget
#------------------------------------------------------------------------------
#  This window displays the actor information on the Item Screen.
#==============================================================================
 
class Window_ActorTarget < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(160, 64, 480, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    @actor = actor
    @item_max = 1
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    draw_actor_state(@actor, 4, 0)
    draw_actor_hp(@actor, 148, 0)
    draw_actor_sp(@actor, 314, 0)
  end
end
 
 
#==============================================================================
# ** Window_ActorItem
#------------------------------------------------------------------------------
#  This window displays items in possession on the item and battle screens.
#==============================================================================
 
class Window_ActorItem < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(0, 128, 640, 352)
    @actor = actor
    @column_max = 2
    refresh
    self.index = 0
    # If in battle, move window to center of screen
    # and make it semi-transparent
    if $game_temp.in_battle
      self.y = 64
      self.height = 256
      self.back_opacity = 160
    end
    if $game_temp.in_trade
      self.y = 64
      self.height = 416
      self.width = 640
    end
  end
  #--------------------------------------------------------------------------
  # * Get Item
  #--------------------------------------------------------------------------
  def item
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    # Add item
    for i in 1...$data_items.size
      if @actor.item_number(i) > 0
        @data.push($data_items)
      end
    end
    for i in 1...$data_weapons.size
      if @actor.weapon_number(i) > 0
        @data.push($data_weapons)
      end
    end
    for i in 1...$data_armors.size
      if @actor.armor_number(i) > 0
        @data.push($data_armors)
      end
    end
    # If item count is not 0, make a bit map and draw all items
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    case item
    when RPG::Item
      number = @actor.item_number(item.id)
    when RPG::Weapon
      number = @actor.weapon_number(item.id)
    when RPG::Armor
      number = @actor.armor_number(item.id)
    end
    if item.is_a?(RPG::Item) and
       @actor.item_can_use?(item)
      self.contents.font.color = normal_color
    elsif item.is_a?(RPG::Weapon) or item.is_a?(RPG::Armor)
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4 + index % 2 * (288 + 32)
    y = index / 2 * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(item.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, item.name, 0)
    self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
    self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  end
  #--------------------------------------------------------------------------
  # * Help Text Update
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(self.item == nil ? "" : self.item.description)
  end
end
 
 
#==============================================================================
# ** Scene_ActorItem
#------------------------------------------------------------------------------
#  This class performs item screen processing for an individual actor.
#==============================================================================
 
class Scene_ActorItem
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     actor_index : actor index
  #--------------------------------------------------------------------------
  def initialize(actor_index = 0)
    @actor_index = actor_index
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Get actor
    @actor = $game_party.actors[@actor_index]
    # Make help window, item window
    @help_window = Window_Help.new
    @item_window = Window_ActorItem.new(@actor)
    # Associate help window
    @item_window.help_window = @help_window
    # Make target window (set to invisible / inactive)
    @target_window = Window_ActorTarget.new(@actor)
    @target_window.visible = true
    @target_window.active = false
    # Create gold window
    @gold_window = Window_ActorGold.new(@actor)
    @gold_window.x = 0
    @gold_window.y = 64
    # Execute transition
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    @help_window.dispose
    @item_window.dispose
    @target_window.dispose
    @gold_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update windows
    @help_window.update
    @item_window.update
    @target_window.update
    @gold_window.update
    # If item window is active: call update_item
    if @item_window.active
      update_item
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when item window is active)
  #--------------------------------------------------------------------------
  def update_item
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to menu screen
      $scene = Scene_Menu.new(0)
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Get currently selected data on the item window
      @item = @item_window.item
      # If not a use item
      unless @item.is_a?(RPG::Item) && $game_temp.in_trade == false
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # If it can't be used
      if @actor.item_can_use?(@item.id)
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # If effect scope is an ally
      if @item.scope >= 3
        # If items are used up
        if @actor.item_number(@item.id) == 0
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end      
        target = @actor
        used = target.item_effect(@item)
        # Remake target window contents
        @target_window.refresh
        # If an item was used
        if used
          # Play item use SE
          $game_system.se_play(@item.menu_se)
          # If consumable
          if @item.consumable
            # Decrease used items by 1
            @actor.lose_item(@item.id, 1)
            # Redraw item window item
            @item_window.draw_item(@item_window.index)
          end    
          # If all party members are dead
          if $game_party.all_dead?
            # Switch to game over screen
            $scene = Scene_Gameover.new
            return
          end
          # If common event ID is valid
          if @item.common_event_id > 0
            # Common event call reservation
            $game_temp.common_event_id = @item.common_event_id
            # Switch to map screen
            $scene = Scene_Map.new
            return
          end
        end
        # If item wasn't used
        unless used
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
        end
        return
      # If effect scope is other than an ally
      else
        # If command event ID is valid
        if @item.common_event_id > 0
          # Command event call reservation
          $game_temp.common_event_id = @item.common_event_id
          # Play item use SE
          $game_system.se_play(@item.menu_se)
          # If consumable
          if @item.consumable
            # Decrease used items by 1
            @actor.lose_item(@item.id, 1)
            # Draw item window item
            @item_window.draw_item(@item_window.index)
          end
          # Switch to map screen
          $scene = Scene_Map.new
          return
        end
      end
      return
    end
  end
end
 
 
#==============================================================================
# ** Window_Help
#------------------------------------------------------------------------------
#  This window shows skill and item explanations along with actor status.
#==============================================================================
 
class Window_Help < Window_Base
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias scripter_window_help_init initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    # Call original method
    scripter_window_help_init
    # Make appropriate changes if scene is Scene_Trade
    if $scene.is_a?(Scene_Trade) && $game_temp.in_menu == false && $game_temp.in_trade == false
      self.width = 580
    else
      self.x = 0
      self.width = 640
    end
  end
end
 
 
#==============================================================================
# ** Window_ActorSelect
#------------------------------------------------------------------------------
#  This window displays party members on the select screen
#==============================================================================
 
class Window_ActorSelect < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 580, 416)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
    self.index = -1
    self.active = false
    if $game_temp.in_menu == false
      self.back_opacity = 160
    end
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      x = (i * 290) + 20
      y = 0
      if x > 330
        unless i == 3
          x = 20
          y = 210
        else
          x = 290 + 20
          y = 210
        end        
      end
      actor = $game_party.actors
      draw_actor_graphic(actor, x + 25, y + 50)
      draw_actor_name(actor, x + 40, y + 0)
      draw_actor_level(actor, x + 40, y + 25)
      self.contents.draw_text(x + 110, y + 25, 84, 32,
      "(" + actor.next_rest_exp_s + " to " + (actor.level + 1).to_s + " ) ", 2)
      draw_actor_hp(actor, x + 20, y + 50)
      draw_actor_sp(actor, x + 20, y + 80)
      self.contents.draw_text(x + 20, y + 110, 92, 32, $data_system.words.weapon)
      draw_item_name($data_weapons[actor.weapon_id], x + 20, y + 140)
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    # If cursor is movable
    if self.active and @item_max > 0 and @index >= 0
      # If the right directional button was pressed
      if Input.trigger?(Input::RIGHT)
        # Move cursor right
        $game_system.se_play($data_system.cursor_se)
        @index += 1 unless @index == 3
      end
      # If the left directional button was pressed
      if Input.trigger?(Input::LEFT)
        $game_system.se_play($data_system.cursor_se)
        @index -= 1 unless @index == 0
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Cursor Rectangle Update
  #--------------------------------------------------------------------------
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
    else
      self.cursor_rect.set(@index * 280, 0, (self.width / 2) - 30, 200)
      if @index == 2
        self.cursor_rect.set(0 * 260, 190, (self.width / 2) - 30, 200)
      end
      if @index == 3
        self.cursor_rect.set(280, 190, (self.width / 2) - 30, 200)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Help Text Update
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text("")
    text1 = "Choose an actor to give the treasure to."
    text2 = "Choose the actor that will give away an item."
    text3 = "Choose the actor that will recieve the item."
    if $game_temp.in_menu == false
      @help_window.set_text(self.index == -1 ? "" : text1)
    elsif $game_temp.in_menu && $game_temp.in_trade == false
      @help_window.set_text(self.index == -1 ? "" : text2)
    elsif $game_temp.in_trade
      @help_window.set_text(self.index == -1 ? "" : text3)
    end      
  end
end
 
 
#==============================================================================
# ** Scene_Trade
#------------------------------------------------------------------------------
#  This class performs trade screen processing.
#==============================================================================
 
class Scene_Trade
  #--------------------------------------------------------------------------
  # * Object Initialization
  #    item   : the item being obtained [NOT FOR TRADING]
  #    number : amount of specific treasure
  #--------------------------------------------------------------------------
  def initialize(item, number)
    @item = item
    @number = number
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Make help window
    @help_window = Window_Help.new
    if $game_temp.in_menu == false
      @help_window.back_opacity = 160
      @help_window.x = 30
    end
    # Make command window
    s1 = "Trade"
    s2 = "Pick Actor"
    s3 = "Exit"
    @command_window = Window_Command.new(160, [s1, s2, s3])
    @command_window.x = 210
    @command_window.y = 180
    @command_window.z = 900
    # Make checks for in_menu flag
    if $game_temp.in_menu == false
      # Disable save
      @command_window.disable_item(0)
      @command_window.disable_item(2)
      @command_window.index = 1
    else
      @command_window.disable_item(1)
      @command_window.index = 0
    end
    # Make actor select window
    @select_window = Window_ActorSelect.new
    if $game_temp.in_menu == false
      @select_window.x = 30
      @select_window.y = 64
    else
      @select_window.x = 0
      @select_window.y = 64
      @select_window.width = 640
    end
    @select_window.help_window = @help_window
    # Make Item window
    @item_window = Window_ActorItem.new($game_party.actors[0])
    @item_window.active = false
    @item_window.visible = false
    # Make map as background if not in menu
    if $game_temp.in_menu == false
      # Make sprite set
      @spriteset = Spriteset_Map.new
    end
    # Execute transition
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    @command_window.dispose
    @select_window.dispose
    @help_window.dispose
    @item_window.dispose
    if $game_temp.in_menu == false
      @spriteset.dispose
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update windows
    @command_window.update
    @select_window.update
    @help_window.update
    if $game_temp.in_menu == false
      @spriteset.update
    end
    # If command window is active: call update_command
    if @command_window.active
      update_command
      return
    end
    if @select_window.active && $game_temp.in_menu == false && $game_temp.in_trade == false
      update_select
      return
    end
    if @select_window.active && $game_temp.in_menu && $game_temp.in_trade == false
      update_select2
      return
    end
    if @select_window.active && $game_temp.in_menu && $game_temp.in_trade
      update_select3
      return
    end
    if @item_window.active
      update_item
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when command window is active)
  #--------------------------------------------------------------------------
  def update_command
    if $game_temp.in_menu
      # If B button was pressed
      if Input.trigger?(Input::B)
        # Play cancel SE
        $game_system.se_play($data_system.cancel_se)
        # Switch to map screen
        $scene = Scene_Menu.new(6)
        return
      end
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Branch by command window cursor position
      case @command_window.index
      when 0  # Trade
        # If in_menu flag is false
        if $game_temp.in_menu == false
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to actor choose screen
        @command_window.active = false
        @command_window.visible = false
        @select_window.active = true
        @select_window.index = 0
      when 1  # Pick Actor
        if $game_temp.in_menu == true
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        else
          # Play decision SE
          $game_system.se_play($data_system.decision_se)
          # Switch to select window
          @command_window.active = false
          @command_window.visible = false
          @select_window.active = true
          @select_window.index = 0
        end        
      when 2  # Exit
        if $game_temp.in_menu == false
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        else
          # Play decision SE
          $game_system.se_play($data_system.decision_se)
          # Go back to menu
          $scene = Scene_Menu.new(0)
        end
        return
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when select window is active)
  #--------------------------------------------------------------------------
  def update_select
    if Input.trigger?(Input::C)
      # Branch by command window cursor position
      case @command_window.index
      when 1
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Brance by what type of treasure @item is
        case @item
        when RPG::Item # When Item
          $game_party.actors[@select_window.index].gain_item(@item.id, @number)
          $scene = Scene_Map.new
        when RPG::Weapon # When Weapon
          $game_party.actors[@select_window.index].gain_weapon(@item.id, @number)
          $scene = Scene_Map.new
        when RPG::Armor # When Armor
          $game_party.actors[@select_window.index].gain_armor(@item.id, @number)
          $scene = Scene_Map.new
        when Integer # When Integer
          $game_party.actors[@select_window.index].gain_gold(@item)
          $scene = Scene_Map.new
        end  
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when select window is active and in_menu flag is true)
  #--------------------------------------------------------------------------
  def update_select2
    # If B button was pressed
    if Input.trigger?(Input::B)
      @select_window.active = false
      @command_window.visible = true
      @command_window.active = true
      return
    end
    if Input.trigger?(Input::C)
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Dispose item window re-initialize it to new actor
      @item_window.dispose
      $game_temp.in_trade = true
      @item_window = Window_ActorItem.new($game_party.actors[@select_window.index])
      # Make item window active and visible and do opposite for select window
      @select_window.active = false
      @select_window.visible = false
      @item_window.active = true
      @item_window.visible = true
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when select window is active and in_trade flag is true)
  #--------------------------------------------------------------------------
  def update_select3
    if Input.trigger?(Input::C)
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Brance by what type of treasure @item is
      case @trade_item
      when RPG::Item # When Item
        $game_party.actors[@select_window.index].gain_item(@trade_item.id, 1)
      when RPG::Weapon # When Weapon
        $game_party.actors[@select_window.index].gain_weapon(@trade_item.id, 1)
      when RPG::Armor # When Armor
        $game_party.actors[@select_window.index].gain_armor(@trade_item.id, 1)
      end
      $game_temp.in_trade = false
      $scene = Scene_Menu.new(0)
    end
    return
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when item window is active)
  #--------------------------------------------------------------------------
  def update_item
    # If B button was pressed
    if Input.trigger?(Input::B)
      @item_window.visible = false
      @item_window.active = false
      @select_window.visible = true
      @select_window.active = true
      update_select2
      return
    end
    actor = $game_party.actors[@select_window.index]
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Get currently selected data on the item window
      @trade_item = @item_window.item
      # If it can't be used
      if actor.item_can_use?(@trade_item.id)
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      case @trade_item
      when RPG::Item
        # If items are used up
        if actor.item_number(@trade_item.id) == 0
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
      when RPG::Weapon
        # If items are used up
        if actor.weapon_number(@trade_item.id) == 0
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end  
      when RPG::Armor
        # If items are used up
        if actor.armor_number(@trade_item.id) == 0
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
      end        
      if @trade_item.is_a?(RPG::Item) && @trade_item.consumable == false
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end        
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      case @trade_item
      when RPG::Item
        actor.lose_item(@trade_item.id, 1)
      when RPG::Weapon
        actor.lose_weapon(@trade_item.id, 1)
      when RPG::Armor
        actor.lose_armor(@trade_item.id, 1)
      end
      # Redraw item window item
      @item_window.draw_item(@item_window.index)
      @item_window.visible = false
      @item_window.active = false
      @select_window.active = true
      @select_window.visible = true
      return
    end
  end
end
 
 
#==============================================================================
# ** Arrow_Actor
#------------------------------------------------------------------------------
#  This arrow cursor is used to choose an actor. This class inherits from the
#  Arrow_Base class.
#==============================================================================
 
class Arrow_IndividualActor < Arrow_Base
  #--------------------------------------------------------------------------
  # * Get Actor Indicated by Cursor
  #--------------------------------------------------------------------------
  def actor
    return $game_party.actors[@index]
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    # Cursor right
    if Input.repeat?(Input::RIGHT)
      $game_system.se_play($data_system.cursor_se)
      @index = @index
    end
    # Cursor left
    if Input.repeat?(Input::LEFT)
      $game_system.se_play($data_system.cursor_se)
      @index = @index
    end
    # Set sprite coordinates
    if self.actor != nil
      self.x = self.actor.screen_x
      self.y = self.actor.screen_y
    end
  end
  #--------------------------------------------------------------------------
  # * Help Text Update
  #--------------------------------------------------------------------------
  def update_help
    # Display actor status in help window
    @help_window.set_actor(self.actor)
  end
end
 
 
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================
 
class Scene_Battle
  #--------------------------------------------------------------------------
  # * Frame Update (actor command phase : item selection)
  #--------------------------------------------------------------------------
  def update_phase3_item_select
    # Make item window visible
    @item_window.visible = true
    # Update item window
    @item_window.update
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # End item selection
      end_item_select
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Get currently selected data on the item window
      @item = @item_window.item
      # If it can't be used
      if @active_battler.item_can_use?(@item.id)
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Set action
      @active_battler.current_action.item_id = @item.id
      # Make item window invisible
      @item_window.visible = false
      # If effect scope is single enemy
      if @item.scope == 1
        # Start enemy selection
        start_enemy_select
      # If effect scope is single ally
      elsif @item.scope == 3 or @item.scope == 5
        # Start actor selection
        start_actor_select
      # If effect scope is not single
      else
        # End item selection
        end_item_select
        # Go to command input for next actor
        phase3_next_actor
      end
      return
    end
  end  
  #--------------------------------------------------------------------------
  # * Start Actor Selection
  #--------------------------------------------------------------------------
  def start_actor_select
    # Make actor arrow
    @actor_arrow = Arrow_IndividualActor.new(@spriteset.viewport2)
    @actor_arrow.index = @actor_index
    # Associate help window
    @actor_arrow.help_window = @help_window
    # Disable actor command window
    @actor_command_window.active = false
    @actor_command_window.visible = false
  end
  #--------------------------------------------------------------------------
  # * Start Item Selection
  #--------------------------------------------------------------------------
  def start_item_select
    # Make item window
    @item_window = Window_ActorItem.new(@active_battler)
    # Associate help window
    @item_window.help_window = @help_window
    # Disable actor command window
    @actor_command_window.active = false
    @actor_command_window.visible = false
  end
  #--------------------------------------------------------------------------
  # * Make Item Action Results
  #--------------------------------------------------------------------------
  def make_item_action_result
    # Get item
    @item = $data_items[@active_battler.current_action.item_id]
    # If unable to use due to items running out
    if @active_battler.item_can_use?(@item.id)
      # Shift to step 1
      @phase4_step = 1
      return
    end
    # If consumable
    if @item.consumable
      # Decrease used item by 1
      @active_battler.lose_item(@item.id, 1)
    end
    # Display item name on help window
    @help_window.set_text(@item.name, 1)
    # Set animation ID
    @animation1_id = @item.animation1_id
    @animation2_id = @item.animation2_id
    # Set common event ID
    @common_event_id = @item.common_event_id
    # Decide on target
    index = @active_battler.current_action.target_index
    target = $game_party.smooth_target_actor(index)
    # Set targeted battlers
    set_target_battlers(@item.scope)
    # Apply item effect
    for target in @target_battlers
      target.item_effect(@item)
    end
  end
end
 
 
 
#==============================================================================
#
# *** END OF SCRIPT ***
#
#==============================================================================
[/rgss]


It's a really long script, but there I less call scripts lol :D

$scene = Scene_Trade.new(4, 1) or $scene = Scene_Trade.new(234, 0)

As you can see, in the first example there are two arguments. The first argument is the ID of the weapon/item/armor, and the second argument is how many of that there are. In the second example, the first argument is how much gold you want, and to differentiate if it is gold, leave the second argument as 0.

I also made a menu option in the menu to allow exchange of items between party members. Please tell me if you see anything wrong or if you'd like me to add something!
 
Good news, man! I think I finished! (Unless I forgot something lol):

[rgss]#==============================================================================
# Title: Individual Items and Cash | Version 1.0
# Author: TheLawG14 [aka. TheScripter]
# Requester: noise [@ hbgames.org]
#==============================================================================
 
 
#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
#  This class handles temporary data that is not included with save data.
#  Refer to "$game_temp" for the instance of this class.
#==============================================================================
 
class Game_Temp
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias scripter_game_temp_initialize initialize
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :in_menu                # in-menu flag
  attr_accessor :in_trade               # in-trade flag
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    scripter_game_temp_initialize
    @in_menu = false
    @in_trade = false
  end
end
 
 
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles the actor. It's used within the Game_Actors class
#  ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================
 
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor   :gold                     # amount of gold
  attr_accessor   :items
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias scripter_game_actor_setup setup
  #--------------------------------------------------------------------------
  # * Setup
  #     actor_id : actor ID
  #--------------------------------------------------------------------------
  def setup(actor_id)
    scripter_game_actor_setup(actor_id)
    @gold = 0
    @items = {}
    @weapons = {}
    @armors = {}
  end
  #--------------------------------------------------------------------------
  # * Get Number of Items Possessed
  #     item_id : item ID
  #--------------------------------------------------------------------------
  def item_number(item_id)
    # If quantity data is in the hash, use it. If not, return 0
    return @items.include?(item_id) ? @items[item_id] : 0
  end
  #--------------------------------------------------------------------------
  # * Get Number of Weapons Possessed
  #     weapon_id : weapon ID
  #--------------------------------------------------------------------------
  def weapon_number(weapon_id)
    # If quantity data is in the hash, use it. If not, return 0
    return @weapons.include?(weapon_id) ? @weapons[weapon_id] : 0
  end
  #--------------------------------------------------------------------------
  # * Get Amount of Armor Possessed
  #     armor_id : armor ID
  #--------------------------------------------------------------------------
  def armor_number(armor_id)
    # If quantity data is in the hash, use it. If not, return 0
    return @armors.include?(armor_id) ? @armors[armor_id] : 0
  end
  #--------------------------------------------------------------------------
  # * Gain Items (or lose)
  #     item_id : item ID
  #     n       : quantity
  #--------------------------------------------------------------------------
  def gain_item(item_id, n)
    # Update quantity data in the hash.
    if item_id > 0
      @items[item_id] = [[item_number(item_id) + n, 0].max, 99].min
    end
  end
  #--------------------------------------------------------------------------
  # * Gain Weapons (or lose)
  #     weapon_id : weapon ID
  #     n         : quantity
  #--------------------------------------------------------------------------
  def gain_weapon(weapon_id, n)
    # Update quantity data in the hash.
    if weapon_id > 0
      @weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, 99].min
    end
  end
  #--------------------------------------------------------------------------
  # * Gain Armor (or lose)
  #     armor_id : armor ID
  #     n        : quantity
  #--------------------------------------------------------------------------
  def gain_armor(armor_id, n)
    # Update quantity data in the hash.
    if armor_id > 0
      @armors[armor_id] = [[armor_number(armor_id) + n, 0].max, 99].min
    end
  end
  #--------------------------------------------------------------------------
  # * Lose Items
  #     item_id : item ID
  #     n       : quantity
  #--------------------------------------------------------------------------
  def lose_item(item_id, n)
    # Reverse the numerical value and call it gain_item
    gain_item(item_id, -n)
  end
  #--------------------------------------------------------------------------
  # * Lose Weapons
  #     weapon_id : weapon ID
  #     n         : quantity
  #--------------------------------------------------------------------------
  def lose_weapon(weapon_id, n)
    # Reverse the numerical value and call it gain_weapon
    gain_weapon(weapon_id, -n)
  end
  #--------------------------------------------------------------------------
  # * Lose Armor
  #     armor_id : armor ID
  #     n        : quantity
  #--------------------------------------------------------------------------
  def lose_armor(armor_id, n)
    # Reverse the numerical value and call it gain_armor
    gain_armor(armor_id, -n)
  end
  #--------------------------------------------------------------------------
  # * Gain Gold (or lose)
  #     n : amount of gold
  #--------------------------------------------------------------------------
  def gain_gold(n)
    @gold = [[@gold + n, 0].max, 9999999].min
  end
  #--------------------------------------------------------------------------
  # * Lose Gold
  #     n : amount of gold
  #--------------------------------------------------------------------------
  def lose_gold(n)
    # Reverse the numerical value and call it gain_gold
    gain_gold(-n)
  end
  #--------------------------------------------------------------------------
  # * Determine if Item is Usable
  #     item_id : item ID
  #--------------------------------------------------------------------------
  def item_can_use?(item)
    # If item quantity is 0
    if item_number(item.id) == 0
      # Unusable
      return false
    end
    # Get usable time
    occasion = $data_items[item.id].occasion
    # If in battle
    if $game_temp.in_battle
      # If useable time is 0 (normal) or 1 (only battle) it's usable
      return (occasion == 0 or occasion == 1)
    end
    # If useable time is 0 (normal) or 2 (only menu) it's usable
    return (occasion == 0 or occasion == 2)
  end
end
 
 
#==============================================================================
# ** Window_Gold
#------------------------------------------------------------------------------
#  This window displays amount of gold.
#==============================================================================
 
class Window_Gold < Window_Base
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    gold = 0
    cx = contents.text_size($data_system.words.gold).width
    self.contents.font.color = normal_color
    for i in $game_party.actors
      gold += i.gold
    end
    self.contents.draw_text(4, 0, 120-cx-2, 32, gold.to_s, 2)
    self.contents.font.color = system_color
    self.contents.draw_text(124-cx, 0, cx, 32, $data_system.words.gold, 2)
  end
end
 
 
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  This class performs menu screen processing.
#==============================================================================
 
class Scene_Menu
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias scripter_scene_menu_update_command update_command
  alias scripter_scene_menu_update_status update_status
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     menu_index : command cursor's initial position
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
    $game_temp.in_menu = true
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Make command window
    s1 = $data_system.words.item
    s2 = $data_system.words.skill
    s3 = $data_system.words.equip
    s4 = "Status"
    s5 = "Save"
    s6 = "End Game"
    s7 = "Trade"
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
    @command_window.height = 224
    @command_window.index = @menu_index
    # If number of party members is 0
    if $game_party.actors.size == 0
      # Disable items, skills, equipment, and status
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
    end
    # If save is forbidden
    if $game_system.save_disabled
      # Disable save
      @command_window.disable_item(4)
    end
    # Make play time window
    @playtime_window = Window_PlayTime.new
    @playtime_window.x = 0
    @playtime_window.y = 224
    # Make steps window
    @steps_window = Window_Steps.new
    @steps_window.x = 0
    @steps_window.y = 320
    # Make gold window
    @gold_window = Window_Gold.new
    @gold_window.x = 0
    @gold_window.y = 416
    # Make status window
    @status_window = Window_MenuStatus.new
    @status_window.x = 160
    @status_window.y = 0
    # Execute transition
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    @command_window.dispose
    @playtime_window.dispose
    @steps_window.dispose
    @gold_window.dispose
    @status_window.dispose  
    if $scene.is_a?(Scene_Map)
      $game_temp.in_menu = false
    else
      $game_temp.in_menu = true
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when command window is active)
  #--------------------------------------------------------------------------
  def update_command
    if Input.trigger?(Input::B)
      # Call original method if exited Menu
      scripter_scene_menu_update_command
    end
    if Input.trigger?(Input::C)
      if @command_window.index == 0
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to item screen
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      elsif @command_window.index == 6
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to trade screen
        $scene = Scene_Trade.new(0, 0)
      else
        # Call original method if not selecting Item Screen
        scripter_scene_menu_update_command
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when status window is active)
  #--------------------------------------------------------------------------
  def update_status
    # Call Original Method
    scripter_scene_menu_update_status
    # If C button was pressed
    if Input.trigger?(Input::C)
      if @command_window.index == 0
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to equipment screen
        $scene = Scene_ActorItem.new(@status_window.index)
      end
    end
  end
end
 
 
#==============================================================================
# ** Window_ActorGold
#------------------------------------------------------------------------------
#  This window displays amount of gold for an individual actor.
#==============================================================================
 
class Window_ActorGold < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(0, 0, 160, 64)
    @actor = actor
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    cx = contents.text_size($data_system.words.gold).width
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 0, 120-cx-2, 32, @actor.gold.to_s, 2)
    self.contents.font.color = system_color
    self.contents.draw_text(124-cx, 0, cx, 32, $data_system.words.gold, 2)
  end
end
 
 
#==============================================================================
# ** Window_ActorTarget
#------------------------------------------------------------------------------
#  This window displays the actor information on the Item Screen.
#==============================================================================
 
class Window_ActorTarget < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(160, 64, 480, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    @actor = actor
    @item_max = 1
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    draw_actor_state(@actor, 4, 0)
    draw_actor_hp(@actor, 148, 0)
    draw_actor_sp(@actor, 314, 0)
  end
end
 
 
#==============================================================================
# ** Window_ActorItem
#------------------------------------------------------------------------------
#  This window displays items in possession on the item and battle screens.
#==============================================================================
 
class Window_ActorItem < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(0, 128, 640, 352)
    @actor = actor
    @column_max = 2
    refresh
    self.index = 0
    # If in battle, move window to center of screen
    # and make it semi-transparent
    if $game_temp.in_battle
      self.y = 64
      self.height = 256
      self.back_opacity = 160
    end
    if $game_temp.in_trade
      self.y = 64
      self.height = 416
      self.width = 640
    end
  end
  #--------------------------------------------------------------------------
  # * Get Item
  #--------------------------------------------------------------------------
  def item
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    # Add item
    for i in 1...$data_items.size
      if @actor.item_number(i) > 0
        @data.push($data_items)
      end
    end
    for i in 1...$data_weapons.size
      if @actor.weapon_number(i) > 0
        @data.push($data_weapons)
      end
    end
    for i in 1...$data_armors.size
      if @actor.armor_number(i) > 0
        @data.push($data_armors)
      end
    end
    # If item count is not 0, make a bit map and draw all items
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    case item
    when RPG::Item
      number = @actor.item_number(item.id)
    when RPG::Weapon
      number = @actor.weapon_number(item.id)
    when RPG::Armor
      number = @actor.armor_number(item.id)
    end
    if item.is_a?(RPG::Item) and
       @actor.item_can_use?(item)
      self.contents.font.color = normal_color
    elsif item.is_a?(RPG::Weapon) or item.is_a?(RPG::Armor)
      self.contents.font.color = normal_color
    else
      self.contents.font.color = disabled_color
    end
    x = 4 + index % 2 * (288 + 32)
    y = index / 2 * 32
    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    bitmap = RPG::Cache.icon(item.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, item.name, 0)
    self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
    self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  end
  #--------------------------------------------------------------------------
  # * Help Text Update
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(self.item == nil ? "" : self.item.description)
  end
end
 
 
#==============================================================================
# ** Scene_ActorItem
#------------------------------------------------------------------------------
#  This class performs item screen processing for an individual actor.
#==============================================================================
 
class Scene_ActorItem
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     actor_index : actor index
  #--------------------------------------------------------------------------
  def initialize(actor_index = 0)
    @actor_index = actor_index
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Get actor
    @actor = $game_party.actors[@actor_index]
    # Make help window, item window
    @help_window = Window_Help.new
    @item_window = Window_ActorItem.new(@actor)
    # Associate help window
    @item_window.help_window = @help_window
    # Make target window (set to invisible / inactive)
    @target_window = Window_ActorTarget.new(@actor)
    @target_window.visible = true
    @target_window.active = false
    # Create gold window
    @gold_window = Window_ActorGold.new(@actor)
    @gold_window.x = 0
    @gold_window.y = 64
    # Execute transition
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    @help_window.dispose
    @item_window.dispose
    @target_window.dispose
    @gold_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update windows
    @help_window.update
    @item_window.update
    @target_window.update
    @gold_window.update
    # If item window is active: call update_item
    if @item_window.active
      update_item
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when item window is active)
  #--------------------------------------------------------------------------
  def update_item
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to menu screen
      $scene = Scene_Menu.new(0)
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Get currently selected data on the item window
      @item = @item_window.item
      # If not a use item
      unless @item.is_a?(RPG::Item) && $game_temp.in_trade == false
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # If it can't be used
      if @actor.item_can_use?(@item.id)
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # If effect scope is an ally
      if @item.scope >= 3
        # If items are used up
        if @actor.item_number(@item.id) == 0
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end      
        target = @actor
        used = target.item_effect(@item)
        # Remake target window contents
        @target_window.refresh
        # If an item was used
        if used
          # Play item use SE
          $game_system.se_play(@item.menu_se)
          # If consumable
          if @item.consumable
            # Decrease used items by 1
            @actor.lose_item(@item.id, 1)
            # Redraw item window item
            @item_window.draw_item(@item_window.index)
          end    
          # If all party members are dead
          if $game_party.all_dead?
            # Switch to game over screen
            $scene = Scene_Gameover.new
            return
          end
          # If common event ID is valid
          if @item.common_event_id > 0
            # Common event call reservation
            $game_temp.common_event_id = @item.common_event_id
            # Switch to map screen
            $scene = Scene_Map.new
            return
          end
        end
        # If item wasn't used
        unless used
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
        end
        return
      # If effect scope is other than an ally
      else
        # If command event ID is valid
        if @item.common_event_id > 0
          # Command event call reservation
          $game_temp.common_event_id = @item.common_event_id
          # Play item use SE
          $game_system.se_play(@item.menu_se)
          # If consumable
          if @item.consumable
            # Decrease used items by 1
            @actor.lose_item(@item.id, 1)
            # Draw item window item
            @item_window.draw_item(@item_window.index)
          end
          # Switch to map screen
          $scene = Scene_Map.new
          return
        end
      end
      return
    end
  end
end
 
 
#==============================================================================
# ** Window_Help
#------------------------------------------------------------------------------
#  This window shows skill and item explanations along with actor status.
#==============================================================================
 
class Window_Help < Window_Base
  #--------------------------------------------------------------------------
  # * Alias Listing
  #--------------------------------------------------------------------------
  alias scripter_window_help_init initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    # Call original method
    scripter_window_help_init
    # Make appropriate changes if scene is Scene_Trade
    if $scene.is_a?(Scene_Trade) && $game_temp.in_menu == false && $game_temp.in_trade == false
      self.width = 580
    else
      self.x = 0
      self.width = 640
    end
  end
end
 
 
#==============================================================================
# ** Window_ActorSelect
#------------------------------------------------------------------------------
#  This window displays party members on the select screen
#==============================================================================
 
class Window_ActorSelect < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 580, 416)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
    self.index = -1
    self.active = false
    if $game_temp.in_menu == false
      self.back_opacity = 160
    end
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      x = (i * 290) + 20
      y = 0
      if x > 330
        unless i == 3
          x = 20
          y = 210
        else
          x = 290 + 20
          y = 210
        end        
      end
      actor = $game_party.actors
      draw_actor_graphic(actor, x + 25, y + 50)
      draw_actor_name(actor, x + 40, y + 0)
      draw_actor_level(actor, x + 40, y + 25)
      self.contents.draw_text(x + 110, y + 25, 84, 32,
      "(" + actor.next_rest_exp_s + " to " + (actor.level + 1).to_s + " ) ", 2)
      draw_actor_hp(actor, x + 20, y + 50)
      draw_actor_sp(actor, x + 20, y + 80)
      self.contents.draw_text(x + 20, y + 110, 92, 32, $data_system.words.weapon)
      draw_item_name($data_weapons[actor.weapon_id], x + 20, y + 140)
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    # If cursor is movable
    if self.active and @item_max > 0 and @index >= 0
      # If the right directional button was pressed
      if Input.trigger?(Input::RIGHT)
        # Move cursor right
        $game_system.se_play($data_system.cursor_se)
        @index += 1 unless @index == 3
      end
      # If the left directional button was pressed
      if Input.trigger?(Input::LEFT)
        $game_system.se_play($data_system.cursor_se)
        @index -= 1 unless @index == 0
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Cursor Rectangle Update
  #--------------------------------------------------------------------------
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
    else
      self.cursor_rect.set(@index * 280, 0, (self.width / 2) - 30, 200)
      if @index == 2
        self.cursor_rect.set(0 * 260, 190, (self.width / 2) - 30, 200)
      end
      if @index == 3
        self.cursor_rect.set(280, 190, (self.width / 2) - 30, 200)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Help Text Update
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text("")
    text1 = "Choose an actor to give the treasure to."
    text2 = "Choose the actor that will give away an item."
    text3 = "Choose the actor that will recieve the item."
    if $game_temp.in_menu == false
      @help_window.set_text(self.index == -1 ? "" : text1)
    elsif $game_temp.in_menu && $game_temp.in_trade == false
      @help_window.set_text(self.index == -1 ? "" : text2)
    elsif $game_temp.in_trade
      @help_window.set_text(self.index == -1 ? "" : text3)
    end      
  end
end
 
 
#==============================================================================
# ** Scene_Trade
#------------------------------------------------------------------------------
#  This class performs trade screen processing.
#==============================================================================
 
class Scene_Trade
  #--------------------------------------------------------------------------
  # * Object Initialization
  #    item   : the item being obtained [NOT FOR TRADING]
  #    number : amount of specific treasure
  #--------------------------------------------------------------------------
  def initialize(item, number)
    @item = item
    @number = number
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Make help window
    @help_window = Window_Help.new
    if $game_temp.in_menu == false
      @help_window.back_opacity = 160
      @help_window.x = 30
    end
    # Make command window
    s1 = "Trade"
    s2 = "Pick Actor"
    s3 = "Exit"
    @command_window = Window_Command.new(160, [s1, s2, s3])
    @command_window.x = 210
    @command_window.y = 180
    @command_window.z = 900
    # Make checks for in_menu flag
    if $game_temp.in_menu == false
      # Disable save
      @command_window.disable_item(0)
      @command_window.disable_item(2)
      @command_window.index = 1
    else
      @command_window.disable_item(1)
      @command_window.index = 0
    end
    # Make actor select window
    @select_window = Window_ActorSelect.new
    if $game_temp.in_menu == false
      @select_window.x = 30
      @select_window.y = 64
    else
      @select_window.x = 0
      @select_window.y = 64
      @select_window.width = 640
    end
    @select_window.help_window = @help_window
    # Make Item window
    @item_window = Window_ActorItem.new($game_party.actors[0])
    @item_window.active = false
    @item_window.visible = false
    # Make map as background if not in menu
    if $game_temp.in_menu == false
      # Make sprite set
      @spriteset = Spriteset_Map.new
    end
    # Execute transition
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    @command_window.dispose
    @select_window.dispose
    @help_window.dispose
    @item_window.dispose
    if $game_temp.in_menu == false
      @spriteset.dispose
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update windows
    @command_window.update
    @select_window.update
    @help_window.update
    if $game_temp.in_menu == false
      @spriteset.update
    end
    # If command window is active: call update_command
    if @command_window.active
      update_command
      return
    end
    if @select_window.active && $game_temp.in_menu == false && $game_temp.in_trade == false
      update_select
      return
    end
    if @select_window.active && $game_temp.in_menu && $game_temp.in_trade == false
      update_select2
      return
    end
    if @select_window.active && $game_temp.in_menu && $game_temp.in_trade
      update_select3
      return
    end
    if @item_window.active
      update_item
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when command window is active)
  #--------------------------------------------------------------------------
  def update_command
    if $game_temp.in_menu
      # If B button was pressed
      if Input.trigger?(Input::B)
        # Play cancel SE
        $game_system.se_play($data_system.cancel_se)
        # Switch to map screen
        $scene = Scene_Menu.new(6)
        return
      end
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Branch by command window cursor position
      case @command_window.index
      when 0  # Trade
        # If in_menu flag is false
        if $game_temp.in_menu == false
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to actor choose screen
        @command_window.active = false
        @command_window.visible = false
        @select_window.active = true
        @select_window.index = 0
      when 1  # Pick Actor
        if $game_temp.in_menu == true
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        else
          # Play decision SE
          $game_system.se_play($data_system.decision_se)
          # Switch to select window
          @command_window.active = false
          @command_window.visible = false
          @select_window.active = true
          @select_window.index = 0
        end        
      when 2  # Exit
        if $game_temp.in_menu == false
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        else
          # Play decision SE
          $game_system.se_play($data_system.decision_se)
          # Go back to menu
          $scene = Scene_Menu.new(0)
        end
        return
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when select window is active)
  #--------------------------------------------------------------------------
  def update_select
    if Input.trigger?(Input::C)
      # Branch by command window cursor position
      case @command_window.index
      when 1
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Brance by what type of treasure @item is
        case @item
        when RPG::Item # When Item
          $game_party.actors[@select_window.index].gain_item(@item.id, @number)
          $scene = Scene_Map.new
        when RPG::Weapon # When Weapon
          $game_party.actors[@select_window.index].gain_weapon(@item.id, @number)
          $scene = Scene_Map.new
        when RPG::Armor # When Armor
          $game_party.actors[@select_window.index].gain_armor(@item.id, @number)
          $scene = Scene_Map.new
        when Integer # When Integer
          $game_party.actors[@select_window.index].gain_gold(@item)
          $scene = Scene_Map.new
        end  
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when select window is active and in_menu flag is true)
  #--------------------------------------------------------------------------
  def update_select2
    # If B button was pressed
    if Input.trigger?(Input::B)
      @select_window.active = false
      @command_window.visible = true
      @command_window.active = true
      return
    end
    if Input.trigger?(Input::C)
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Dispose item window re-initialize it to new actor
      @item_window.dispose
      $game_temp.in_trade = true
      @item_window = Window_ActorItem.new($game_party.actors[@select_window.index])
      # Make item window active and visible and do opposite for select window
      @select_window.active = false
      @select_window.visible = false
      @item_window.active = true
      @item_window.visible = true
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when select window is active and in_trade flag is true)
  #--------------------------------------------------------------------------
  def update_select3
    if Input.trigger?(Input::C)
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Brance by what type of treasure @item is
      case @trade_item
      when RPG::Item # When Item
        $game_party.actors[@select_window.index].gain_item(@trade_item.id, 1)
      when RPG::Weapon # When Weapon
        $game_party.actors[@select_window.index].gain_weapon(@trade_item.id, 1)
      when RPG::Armor # When Armor
        $game_party.actors[@select_window.index].gain_armor(@trade_item.id, 1)
      end
      $game_temp.in_trade = false
      $scene = Scene_Menu.new(0)
    end
    return
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when item window is active)
  #--------------------------------------------------------------------------
  def update_item
    # If B button was pressed
    if Input.trigger?(Input::B)
      @item_window.visible = false
      @item_window.active = false
      @select_window.visible = true
      @select_window.active = true
      update_select2
      return
    end
    actor = $game_party.actors[@select_window.index]
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Get currently selected data on the item window
      @trade_item = @item_window.item
      # If it can't be used
      if actor.item_can_use?(@trade_item.id)
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      case @trade_item
      when RPG::Item
        # If items are used up
        if actor.item_number(@trade_item.id) == 0
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
      when RPG::Weapon
        # If items are used up
        if actor.weapon_number(@trade_item.id) == 0
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end  
      when RPG::Armor
        # If items are used up
        if actor.armor_number(@trade_item.id) == 0
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
      end        
      if @trade_item.is_a?(RPG::Item) && @trade_item.consumable == false
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end        
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      case @trade_item
      when RPG::Item
        actor.lose_item(@trade_item.id, 1)
      when RPG::Weapon
        actor.lose_weapon(@trade_item.id, 1)
      when RPG::Armor
        actor.lose_armor(@trade_item.id, 1)
      end
      # Redraw item window item
      @item_window.draw_item(@item_window.index)
      @item_window.visible = false
      @item_window.active = false
      @select_window.active = true
      @select_window.visible = true
      return
    end
  end
end
 
 
#==============================================================================
# ** Arrow_Actor
#------------------------------------------------------------------------------
#  This arrow cursor is used to choose an actor. This class inherits from the
#  Arrow_Base class.
#==============================================================================
 
class Arrow_IndividualActor < Arrow_Base
  #--------------------------------------------------------------------------
  # * Get Actor Indicated by Cursor
  #--------------------------------------------------------------------------
  def actor
    return $game_party.actors[@index]
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    # Cursor right
    if Input.repeat?(Input::RIGHT)
      $game_system.se_play($data_system.cursor_se)
      @index = @index
    end
    # Cursor left
    if Input.repeat?(Input::LEFT)
      $game_system.se_play($data_system.cursor_se)
      @index = @index
    end
    # Set sprite coordinates
    if self.actor != nil
      self.x = self.actor.screen_x
      self.y = self.actor.screen_y
    end
  end
  #--------------------------------------------------------------------------
  # * Help Text Update
  #--------------------------------------------------------------------------
  def update_help
    # Display actor status in help window
    @help_window.set_actor(self.actor)
  end
end
 
 
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================
 
class Scene_Battle
  #--------------------------------------------------------------------------
  # * Frame Update (actor command phase : item selection)
  #--------------------------------------------------------------------------
  def update_phase3_item_select
    # Make item window visible
    @item_window.visible = true
    # Update item window
    @item_window.update
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # End item selection
      end_item_select
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Get currently selected data on the item window
      @item = @item_window.item
      # If it can't be used
      if @active_battler.item_can_use?(@item.id)
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Play decision SE
      $game_system.se_play($data_system.decision_se)
      # Set action
      @active_battler.current_action.item_id = @item.id
      # Make item window invisible
      @item_window.visible = false
      # If effect scope is single enemy
      if @item.scope == 1
        # Start enemy selection
        start_enemy_select
      # If effect scope is single ally
      elsif @item.scope == 3 or @item.scope == 5
        # Start actor selection
        start_actor_select
      # If effect scope is not single
      else
        # End item selection
        end_item_select
        # Go to command input for next actor
        phase3_next_actor
      end
      return
    end
  end  
  #--------------------------------------------------------------------------
  # * Start Actor Selection
  #--------------------------------------------------------------------------
  def start_actor_select
    # Make actor arrow
    @actor_arrow = Arrow_IndividualActor.new(@spriteset.viewport2)
    @actor_arrow.index = @actor_index
    # Associate help window
    @actor_arrow.help_window = @help_window
    # Disable actor command window
    @actor_command_window.active = false
    @actor_command_window.visible = false
  end
  #--------------------------------------------------------------------------
  # * Start Item Selection
  #--------------------------------------------------------------------------
  def start_item_select
    # Make item window
    @item_window = Window_ActorItem.new(@active_battler)
    # Associate help window
    @item_window.help_window = @help_window
    # Disable actor command window
    @actor_command_window.active = false
    @actor_command_window.visible = false
  end
  #--------------------------------------------------------------------------
  # * Make Item Action Results
  #--------------------------------------------------------------------------
  def make_item_action_result
    # Get item
    @item = $data_items[@active_battler.current_action.item_id]
    # If unable to use due to items running out
    if @active_battler.item_can_use?(@item.id)
      # Shift to step 1
      @phase4_step = 1
      return
    end
    # If consumable
    if @item.consumable
      # Decrease used item by 1
      @active_battler.lose_item(@item.id, 1)
    end
    # Display item name on help window
    @help_window.set_text(@item.name, 1)
    # Set animation ID
    @animation1_id = @item.animation1_id
    @animation2_id = @item.animation2_id
    # Set common event ID
    @common_event_id = @item.common_event_id
    # Decide on target
    index = @active_battler.current_action.target_index
    target = $game_party.smooth_target_actor(index)
    # Set targeted battlers
    set_target_battlers(@item.scope)
    # Apply item effect
    for target in @target_battlers
      target.item_effect(@item)
    end
  end
end
 
 
 
#==============================================================================
#
# *** END OF SCRIPT ***
#
#==============================================================================
[/rgss]


It's a really long script, but there I less call scripts lol :D

$scene = Scene_Trade.new(4, 1) or $scene = Scene_Trade.new(234, 0)

As you can see, in the first example there are two arguments. The first argument is the ID of the weapon/item/armor, and the second argument is how many of that there are. In the second example, the first argument is how much gold you want, and to differentiate if it is gold, leave the second argument as 0.

I also made a menu option in the menu to allow exchange of items between party members. Please tell me if you see anything wrong or if you'd like me to add something!


EDIT: Oh, and battles should be working perfectly too :thumb:
 

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