Submit Your Article Guild Wars 2 Forum RPG Maker VX.com
 
RPG Maker
 

 Username:
 Password:
   Not a member? Register!



Home > RGSS Script Reference > Window_EquipRight

Window_EquipRight


Inherits from: Window_Selectable

Description: This window shows the items the character currently has equipped. When the player selects an item from the list, the item window becomes active and allows the player to select an item to repalce the currently equipped item.

Code


class Window_EquipRight < Window_Selectable
# ------------------------------------
 def initialize(actor)
    super(272, 64, 368, 192)
    self.contents = Bitmap.new(width - 32, height - 32)
    @actor = actor
    refresh
    self.index = 0
  end
# ------------------------------------
  def item
    return @data[self.index]
  end
# ------------------------------------
  def refresh
    self.contents.clear
    @data = []
    @data.push($data_weapons[@actor.weapon_id])
    @data.push($data_armors[@actor.armor1_id])
    @data.push($data_armors[@actor.armor2_id])
    @data.push($data_armors[@actor.armor3_id])
    @data.push($data_armors[@actor.armor4_id])
    @item_max = @data.size
    self.contents.font.color = system_color
    self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon)
    self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1)
    self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2)
    self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3)
    self.contents.draw_text(5, 32 * 4, 92, 32, $data_system.words.armor4)
    draw_item_name(@data[0], 92, 32 * 0)
    draw_item_name(@data[1], 92, 32 * 1)
    draw_item_name(@data[2], 92, 32 * 2)
    draw_item_name(@data[3], 92, 32 * 3)
    draw_item_name(@data[4], 92, 32 * 4)
  end
# ------------------------------------
  def update_help
    @help_window.set_text(self.item == nil ? "" : self.item.description)
  end
end

Properties


Actor: The actor whose equipment is being changed.

Data: An array containing the five items the actor currently has equipped.

Methods


Initialize

Arguments:
Actor: The actor whose equipment is being changed.
Local Variables: None

How it Works: This method initializes the window. First, the window's x coordinate is initialized to 272, the y coordinate is initialized to 64, the width to 368, and the height to 192. Then, the @actor instance variables is set to the actor whose equipment is being changed. The window is then refreshed using the refresh method.

Item

Arguments: None
Local Variables: None

How it Works: This method returns the item in the @data array corresponding to the index of the currently selected item.

Refresh

Arguments: None
Local Variables: None

How it Works: This method draws the contents of the item window. The @data array is first initialized to an empty array. The IDs of the weapon, shield, helmet, armor, and accessory are then added to the @data array, in this order. The method then draws the custom words for the five equipment types, in the system color, all at x coordinate 4. The y coordinate is 0 for weapon, 32 for shield, 64 for helmet, 96 for armor, and 128 for accessory. The final part of the method uses the Window_Base#Draw_Item_Name method to draw the icon and item name for each of the actor's five pieces of equipment from the @data array. The x coordinate at which these items are drawn is 92 for all five pieces of equipment. The y coordinates are the same as the ones described above for drawing the custom words.

Update_Help

Arguments: None
Local Variables: None

How it Works: This method updates the help window with the description of the currently selected item, or nil if an empty space is currently selected. 
Syntax
@
@@
$
alias
[array index]
attr_accessor
attr_reader
attr_writer
class
def
do
ensure
for
if
[iterator]
key => value
new
next
nil
redo
require
return
rescue
self
super
undef
unless
until
while
yield

Classes
Arrow_Actor
Arrow_Base
Arrow_Enemy
Game_Actor
Game_Actors
Game_BattleAct
Game_Battler
Game_Character
Game_Common
Game_Enemy
Game_Event
Game_Map
Game_Party
Game_Picture
Game_Player
Game_Screen
Game_SlfSwitch
Game_Switches
Game_System
Game_Troop
Game_Variables
Interpreter
Scene_Debug
Scene_End
Scene_Equip
Scene_File
Scene_Gameover
Scene_Item
Scene_Load
Scene_Map
Scene_Menu
Scene_Name
Scene_Save
Scene_Shop
Scene_Skill
Scene_Status
Scene_Title
Sprite_Battler
Sprite_Character
Sprite_Picture
Sprite_Timer
Spriteset_Battle
Spriteset_Map
Window_Base
Window_Battleresult
Window_Battlestatus
Window_Command
Window_DebugLeft
Window_DebugRight
Window_EquipItem
Window_EquipLeft
Window_EquipRight
Window_Gold
Window_Help
Window_InputNumb
Window_Item
Window_MenuStatus
Window_Message
Window_NameEdit
Window_NameInput
Window_PartyCom
Window_PlayTime
Window_SaveFile
Window_Selectable
Window_ShopBuy
Window_ShopCom
Window_ShopNum
Window_ShopSell
Window_ShopStatus
Window_Skill
Window_SkillStatus
Window_Status
Window_Steps
Window_Target

Other
Class Hierarchy
Global Variables


RPG RPG Revolution
RPG RPG Revolution is your #1 stop for game development and console RPG games, as well as those created by people like you. Link to us to support us, so we may grow to be better website community for you.

RPG RPG Revolution is an Privacy Policy and Legal