05-12-2006, 01:00 PM
Equipment Scrolling System
by LeGAcY
Version: 1.00
May 12 2006
by LeGAcY
Version: 1.00
May 12 2006
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given.
No support is given.
Introduction
Lets you scroll through your equipment from the map.
Script
Code:
#=============================================================
# Equipment Scrolling System
#=============================================================
# LegACy
# Version 1.00
# 1.20.06
#=============================================================
# This script was made for my submition on CA's scripting contest, my first script
# ever. It allows player to scroll through equipment from map using Q and W buttons.
# To change from weapon to armor, use number 1 until 5 buttons. To view the stat
# use the 'Tab' Button.
#
# For customization, look at lines 220 - 223
# Special thanks to Cybersam for his keyboard input script
#=============================================================
#============================================================
# ** Window_Weapon
#============================================================
class Window_Weapon < Window_Base
#--------------------------------------------------------------------------
# * Initializing
#--------------------------------------------------------------------------
def initialize(actor = 0)
super(0, 0, 200, 56)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 160
@actor = actor
@weapon = $data_weapons[$game_party.actors[actor].weapon_id]
@shield = $data_armors[$game_party.actors[actor].armor1_id]
@helmet = $data_armors[$game_party.actors[actor].armor2_id]
@armor = $data_armors[$game_party.actors[actor].armor3_id]
@accesory = $data_armors[$game_party.actors[actor].armor4_id]
update
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(40, -4, 120, 32, "None")
case $equipment
when 0
unless $game_party.actors[@actor].weapon_id == 0
self.contents.clear
self.contents.draw_text(40, -4, 120, 32, @weapon.name)
bitmap = RPG::Cache.icon(@weapon.icon_name)
self.contents.blt(4, 2, bitmap, Rect.new(0, 0, 24, 24), opacity)
end
when 1
unless $game_party.actors[@actor].armor1_id == 0
self.contents.clear
self.contents.draw_text(40, -4, 120, 32, @shield.name)
bitmap = RPG::Cache.icon(@shield.icon_name)
self.contents.blt(4, 2, bitmap, Rect.new(0, 0, 24, 24), opacity)
end
when 2
unless $game_party.actors[@actor].armor2_id == 0
self.contents.clear
self.contents.draw_text(40, -4, 120, 32, @helmet.name)
bitmap = RPG::Cache.icon(@helmet.icon_name)
self.contents.blt(4, 2, bitmap, Rect.new(0, 0, 24, 24), opacity)
end
when 3
unless $game_party.actors[@actor].armor3_id == 0
self.contents.clear
self.contents.draw_text(40, -4, 120, 32, @armor.name)
bitmap = RPG::Cache.icon(@armor.icon_name)
self.contents.blt(4, 2, bitmap, Rect.new(0, 0, 24, 24), opacity)
end
when 4
unless $game_party.actors[@actor].armor4_id == 0
self.contents.clear
self.contents.draw_text(40, -4, 120, 32, @accesory.name)
bitmap = RPG::Cache.icon(@accesory.icon_name)
self.contents.blt(4, 2, bitmap, Rect.new(0, 0, 24, 24), opacity)
end
end
end
end
#============================================================
# ** Window_Description
#============================================================
class Window_Description < Window_Base
#--------------------------------------------------------------------------
# * Initializing
#--------------------------------------------------------------------------
def initialize(actor = 0)
super(0, 0, 440, 56)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 160
@actor = actor
@weapon = $data_weapons[$game_party.actors[actor].weapon_id]
@shield = $data_armors[$game_party.actors[actor].armor1_id]
@helmet = $data_armors[$game_party.actors[actor].armor2_id]
@armor = $data_armors[$game_party.actors[actor].armor3_id]
@accesory = $data_armors[$game_party.actors[actor].armor4_id]
update
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, -4, 436, 32, "")
case $equipment
when 0
unless $game_party.actors[@actor].weapon_id == 0
self.contents.clear
self.contents.draw_text(4, -4, 436, 32, @weapon.description)
end
when 1
unless $game_party.actors[@actor].armor1_id == 0
self.contents.clear
self.contents.draw_text(4, -4, 436, 32, @shield.description)
end
when 2
unless $game_party.actors[@actor].armor2_id == 0
self.contents.clear
self.contents.draw_text(4, -4, 436, 32, @helmet.description)
end
when 3
unless $game_party.actors[@actor].armor3_id == 0
self.contents.clear
self.contents.draw_text(4, -4, 436, 32, @armor.description)
end
when 4
unless $game_party.actors[@actor].armor4_id == 0
self.contents.clear
self.contents.draw_text(4, -4, 436, 32, @accesory.description)
end
end
end
end
#============================================================
# ** Window_Parameter
#============================================================
class Window_Parameter < Window_Base
#--------------------------------------------------------------------------
# * Initialize
#--------------------------------------------------------------------------
def initialize(actor = 0)
super(0, 0, 200, 120)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 160
@actor = actor
@weapon = $data_weapons[$game_party.actors[@actor].weapon_id]
@shield = $data_armors[$game_party.actors[@actor].armor1_id]
@helmet = $data_armors[$game_party.actors[@actor].armor2_id]
@armor = $data_armors[$game_party.actors[@actor].armor3_id]
@accesory = $data_armors[$game_party.actors[@actor].armor4_id]
update
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(128, -4, 50, 32, "")
self.contents.draw_text(128, 30, 40, 32, "")
self.contents.draw_text(128, 60, 40, 32, "")
case $equipment
when 0
unless $game_party.actors[@actor].weapon_id == 0
self.contents.clear
self.contents.draw_text(128, -4, 40, 32, @weapon.atk.to_s)
self.contents.draw_text(128, 30, 40, 32, @weapon.pdef.to_s)
self.contents.draw_text(128, 60, 40, 32, @weapon.mdef.to_s)
end
when 1
unless $game_party.actors[@actor].armor1_id == 0
self.contents.clear
self.contents.draw_text(128, -4, 50, 32, "None")
self.contents.draw_text(128, 30, 40, 32, @shield.pdef.to_s)
self.contents.draw_text(128, 60, 40, 32, @shield.mdef.to_s)
end
when 2
unless $game_party.actors[@actor].armor2_id == 0
self.contents.clear
self.contents.draw_text(128, -4, 50, 32, "None")
self.contents.draw_text(128, 30, 40, 32, @helmet.pdef.to_s)
self.contents.draw_text(128, 60, 40, 32, @helmet.mdef.to_s)
end
when 3
unless $game_party.actors[@actor].armor3_id == 0
self.contents.clear
self.contents.draw_text(128, -4, 50, 32, "None")
self.contents.draw_text(128, 30, 40, 32, @armor.pdef.to_s)
self.contents.draw_text(128, 60, 40, 32, @armor.mdef.to_s)
end
when 4
unless $game_party.actors[@actor].armor4_id == 0
self.contents.clear
self.contents.draw_text(128, -4, 50, 32, "None")
self.contents.draw_text(128, 30, 40, 32, @accesory.pdef.to_s)
self.contents.draw_text(128, 60, 40, 32, @accesory.mdef.to_s)
end
end
self.contents.font.color = system_color
self.contents.draw_text(4, -4, 120, 32, $data_system.words.atk)
self.contents.draw_text(4, 30, 120, 32, $data_system.words.pdef)
self.contents.draw_text(4, 60, 120, 32, $data_system.words.mdef)
end
end
#============================================================
# ** Scene_Map
#============================================================
class Scene_Map
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias legacy_equipscroll_scenemap_main main
alias legacy_equipscroll_scenemap_update update
#--------------------------------------------------------------------------
# * Main
#--------------------------------------------------------------------------
def main
#--------------------------------------------------------------------------
# Customization
#--------------------------------------------------------------------------
@actor = 0 # Actor on party (arshes is 0, basil is 1, etc)
@descript = true # True if you want to have the description window appear
@stat = true # True if you want to have the parameter window appear
@armor = true # True if you want to have armor scroll as well
#--------------------------------------------------------------------------
# End of Customization
#--------------------------------------------------------------------------
@weapon = Window_Weapon.new(@actor)
@weapon.x = 440
@description = Window_Description.new(@actor)
@description.x = 640
@parameter = Window_Parameter.new(@actor)
@parameter.x = 440
@parameter.y = -120
unless @descript == true
@description.visible = false
end
unless @stat == true
@parameter.visible = false
end
legacy_equipscroll_scenemap_main
@weapon.dispose
@description.dispose
@parameter.dispose
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
if Kboard.keyboard($R_Key_1)
unless $game_system.map_interpreter.running? or @armor == false
$game_system.se_play($data_system.cursor_se)
$equipment = 0
@weapon.update
@description.update
@parameter.update
end
end
if Kboard.keyboard($R_Key_2)
unless $game_system.map_interpreter.running? or @armor == false
$game_system.se_play($data_system.cursor_se)
$equipment = 1
@weapon.update
@description.update
@parameter.update
end
end
if Kboard.keyboard($R_Key_3)
unless $game_system.map_interpreter.running? or @armor == false
$game_system.se_play($data_system.cursor_se)
$equipment = 2
@weapon.update
@description.update
@parameter.update
end
end
if Kboard.keyboard($R_Key_4)
unless $game_system.map_interpreter.running? or @armor == false
$game_system.se_play($data_system.cursor_se)
$equipment = 3
@weapon.update
@description.update
@parameter.update
end
end
if Kboard.keyboard($R_Key_5)
unless $game_system.map_interpreter.running? or @armor == false
$game_system.se_play($data_system.cursor_se)
$equipment = 4
@weapon.update
@description.update
@parameter.update
end
end
if Kboard.keyboard($R_Key_TAB)
unless $game_system.map_interpreter.running?
$game_system.se_play($data_system.decision_se)
if @parameter.y != -120
@parameter.y = -120
else
@parameter.y = 56
end
if @description.x != 0
@description.x = 0
else
@description.x = 640
end
end
end
if Input.trigger?(Input::R)
unless $game_system.map_interpreter.running?
case $equipment
when 0
i = $game_party.actors[@actor].weapon_id + 1
if i == $data_weapons.size
i = 1
end
$game_actors[@actor + 1].equip($equipment, i)
while i != $game_party.actors[@actor].weapon_id
i +=1
if i == $data_weapons.size
i = 1
end
$game_actors[@actor + 1].equip($equipment, i)
end
when 1
i = $game_party.actors[@actor].armor1_id + 1
if i == $data_armors.size
i = 1
end
$game_actors[@actor + 1].equip($equipment, i)
while i != $game_party.actors[@actor].armor1_id or $data_armors[i].kind != 0
i +=1
if i == $data_armors.size
i = 1
end
$game_actors[@actor + 1].equip($equipment, i)
end
when 2
i = $game_party.actors[@actor].armor2_id + 1
if i == $data_armors.size
i = 1
end
$game_actors[@actor + 1].equip($equipment, i)
while i != $game_party.actors[@actor].armor2_id or $data_armors[i].kind != 1
i +=1
if i == $data_armors.size
i = 1
end
$game_actors[@actor + 1].equip($equipment, i)
end
when 3
i = $game_party.actors[@actor].armor3_id + 1
if i == $data_armors.size
i = 1
end
$game_actors[@actor + 1].equip($equipment, i)
while i != $game_party.actors[@actor].armor3_id or $data_armors[i].kind != 2
i +=1
if i == $data_armors.size
i = 1
end
$game_actors[@actor + 1].equip($equipment, i)
end
when 4
i = $game_party.actors[@actor].armor4_id + 1
if i == $data_armors.size
i = 1
end
$game_actors[@actor + 1].equip($equipment, i)
while i != $game_party.actors[@actor].armor4_id or $data_armors[i].kind != 3
i +=1
if i == $data_armors.size
i = 1
end
$game_actors[@actor + 1].equip($equipment, i)
end
end
$game_system.se_play($data_system.equip_se)
$scene = Scene_Map.new
end
end
if Input.trigger?(Input::L)
unless $game_system.map_interpreter.running?
case $equipment
when 0
i = $game_party.actors[@actor].weapon_id - 1
if i <= 0
i = $data_weapons.size - 1
end
$game_actors[@actor + 1].equip($equipment, i)
while i != $game_party.actors[@actor].weapon_id
i -=1
if i <= 0
i = $data_weapons.size - 1
end
$game_actors[@actor + 1].equip($equipment, i)
end
when 1
i = $game_party.actors[@actor].armor1_id - 1
if i <= 0
i = $data_armors.size - 1
end
$game_actors[@actor + 1].equip($equipment, i)
while i != $game_party.actors[@actor].armor1_id or $data_armors[i].kind != 0
i -=1
if i <= 0
i = $data_armors.size - 1
end
$game_actors[@actor + 1].equip($equipment, i)
end
when 2
i = $game_party.actors[@actor].armor2_id - 1
if i <= 0
i = $data_armors.size - 1
end
$game_actors[@actor + 1].equip($equipment, i)
while i != $game_party.actors[@actor].armor2_id or $data_armors[i].kind != 1
i -=1
if i <= 0
i = $data_armors.size - 1
end
$game_actors[@actor + 1].equip($equipment, i)
end
when 3
i = $game_party.actors[@actor].armor3_id - 1
if i <= 0
i = $data_armors.size - 1
end
$game_actors[@actor + 1].equip($equipment, i)
while i != $game_party.actors[@actor].armor3_id or $data_armors[i].kind != 2
i -=1
if i <= 0
i = $data_armors.size - 1
end
$game_actors[@actor + 1].equip($equipment, i)
end
when 4
i = $game_party.actors[@actor].armor4_id - 1
if i <= 0
i = $data_armors.size - 1
end
$game_actors[@actor + 1].equip($equipment, i)
while i != $game_party.actors[@actor].armor4_id or $data_armors[i].kind != 3
i -=1
if i <= 0
i = $data_armors.size - 1
end
$game_actors[@actor + 1].equip($equipment, i)
end
end
$game_system.se_play($data_system.equip_se)
$scene = Scene_Map.new
end
end
legacy_equipscroll_scenemap_update
end
end
#======================================
# Keyboard Script
#---------------------------------------------------------------------------
# Cybersam
# Date: 25/05/05
# Version 4
#======================================
module Kboard
#--------------------------------------------------------------------------
$RMouse_BUTTON_L = 0x01 # left mouse button
$RMouse_BUTTON_R = 0x02 # right mouse button
$RMouse_BUTTON_M = 0x04 # middle mouse button
$RMouse_BUTTON_4 = 0x05 # 4th mouse button
$RMouse_BUTTON_5 = 0x06 # 5th mouse button
#--------------------------------------------------------------------------
$R_Key_BACK = 0x08 # BACKSPACE key
$R_Key_TAB = 0x09 # TAB key
$R_Key_RETURN = 0x0D # ENTER key
$R_Key_SHIFT = 0x10 # SHIFT key
$R_Key_CTLR = 0x11 # CTLR key
$R_Key_ALT = 0x12 # ALT key
$R_Key_PAUSE = 0x13 # PAUSE key
$R_Key_CAPITAL = 0x14 # CAPS LOCK key
$R_Key_ESCAPE = 0x1B # ESC key
$R_Key_SPACE = 0x20 # SPACEBAR
$R_Key_PRIOR = 0x21 # PAGE UP key
$R_Key_NEXT = 0x22 # PAGE DOWN key
$R_Key_END = 0x23 # END key
$R_Key_HOME = 0x24 # HOME key
$R_Key_LEFT = 0x25 # LEFT ARROW key
$R_Key_UP = 0x26 # UP ARROW key
$R_Key_RIGHT = 0x27 # RIGHT ARROW key
$R_Key_DOWN = 0x28 # DOWN ARROW key
$R_Key_SELECT = 0x29 # SELECT key
$R_Key_PRINT = 0x2A # PRINT key
$R_Key_SNAPSHOT = 0x2C # PRINT SCREEN key
$R_Key_INSERT = 0x2D # INS key
$R_Key_DELETE = 0x2E # DEL key
#--------------------------------------------------------------------------
$R_Key_0 = 0x30 # 0 key
$R_Key_1 = 0x31 # 1 key
$R_Key_2 = 0x32 # 2 key
$R_Key_3 = 0x33 # 3 key
$R_Key_4 = 0x34 # 4 key
$R_Key_5 = 0x35 # 5 key
$R_Key_6 = 0x36 # 6 key
$R_Key_7 = 0x37 # 7 key
$R_Key_8 = 0x38 # 8 key
$R_Key_9 = 0x39 # 9 key
#--------------------------------------------------------------------------
$R_Key_A = 0x41 # A key
$R_Key_B = 0x42 # B key
$R_Key_C = 0x43 # C key
$R_Key_D = 0x44 # D key
$R_Key_E = 0x45 # E key
$R_Key_F = 0x46 # F key
$R_Key_G = 0x47 # G key
$R_Key_H = 0x48 # H key
$R_Key_I = 0x49 # I key
$R_Key_J = 0x4A # J key
$R_Key_K = 0x4B # K key
$R_Key_L = 0x4C # L key
$R_Key_M = 0x4D # M key
$R_Key_N = 0x4E # N key
$R_Key_O = 0x4F # O key
$R_Key_P = 0x50 # P key
$R_Key_Q = 0x51 # Q key
$R_Key_R = 0x52 # R key
$R_Key_S = 0x53 # S key
$R_Key_T = 0x54 # T key
$R_Key_U = 0x55 # U key
$R_Key_V = 0x56 # V key
$R_Key_W = 0x57 # W key
$R_Key_X = 0x58 # X key
$R_Key_Y = 0x59 # Y key
$R_Key_Z = 0x5A # Z key
#--------------------------------------------------------------------------
$R_Key_LWIN = 0x5B # Left Windows key (Microsoft Natural keyboard)
$R_Key_RWIN = 0x5C # Right Windows key (Natural keyboard)
$R_Key_APPS = 0x5D # Applications key (Natural keyboard)
#--------------------------------------------------------------------------
$R_Key_NUMPAD0 = 0x60 # Numeric keypad 0 key
$R_Key_NUMPAD1 = 0x61 # Numeric keypad 1 key
$R_Key_NUMPAD2 = 0x62 # Numeric keypad 2 key
$R_Key_NUMPAD3 = 0x63 # Numeric keypad 3 key
$R_Key_NUMPAD4 = 0x64 # Numeric keypad 4 key
$R_Key_NUMPAD5 = 0x65 # Numeric keypad 5 key
$R_Key_NUMPAD6 = 0x66 # Numeric keypad 6 key
$R_Key_NUMPAD7 = 0x67 # Numeric keypad 7 key
$R_Key_NUMPAD8 = 0x68 # Numeric keypad 8 key
$R_Key_NUMPAD9 = 0x69 # Numeric keypad 9 key
$R_Key_MULTIPLY = 0x6A # Multiply key (*)
$R_Key_ADD = 0x6B # Add key (+)
$R_Key_SEPARATOR = 0x6C # Separator key
$R_Key_SUBTRACT = 0x6D # Subtract key (-)
$R_Key_DECIMAL = 0x6E # Decimal key
$R_Key_DIVIDE = 0x6F # Divide key (/)
#--------------------------------------------------------------------------
$R_Key_F1 = 0x70 # F1 key
$R_Key_F2 = 0x71 # F2 key
$R_Key_F3 = 0x72 # F3 key
$R_Key_F4 = 0x73 # F4 key
$R_Key_F5 = 0x74 # F5 key
$R_Key_F6 = 0x75 # F6 key
$R_Key_F7 = 0x76 # F7 key
$R_Key_F8 = 0x77 # F8 key
$R_Key_F9 = 0x78 # F9 key
$R_Key_F10 = 0x79 # F10 key
$R_Key_F11 = 0x7A # F11 key
$R_Key_F12 = 0x7B # F12 key
#--------------------------------------------------------------------------
$R_Key_NUMLOCK = 0x90 # NUM LOCK key
$R_Key_SCROLL = 0x91 # SCROLL LOCK key
#--------------------------------------------------------------------------
$R_Key_LSHIFT = 0xA0 # Left SHIFT key
$R_Key_RSHIFT = 0xA1 # Right SHIFT key
$R_Key_LCONTROL = 0xA2 # Left CONTROL key
$R_Key_RCONTROL = 0xA3 # Right CONTROL key
$R_Key_L_ALT = 0xA4 # Left ALT key
$R_Key_R_ALT = 0xA5 # Right ALT key
# --------------------------------------------------------------------------
$R_Key_SEP = 0xBC # , key
$R_Key_DASH = 0xBD # - key
$R_Key_DOTT = 0xBE # . key
#--------------------------------------------------------------------------
GetKeyState = Win32API.new("user32","GetAsyncKeyState",['i'],'i')
GetKeyboardState = Win32API.new("user32","GetKeyState",['i'],'i')
GetSetKeyState = Win32API.new("user32","SetKeyboardState",['i'],'i')
#--------------------------------------------------------------------------
module_function
#--------------------------------------------------------------------------
def keyb(rkey)
if GetKeyState.call(rkey) != 0
return 1
end
return 0
end
#--------------------------------------------------------------------------
def keyboard(rkey)
GetKeyState.call(rkey) & 0x01 == 1
end
#--------------------------------------------------------------------------
def key(rkey, key = 0)
GetKeyboardState.call(rkey) & 0x01 == key
end
end
#============================================================
# ** Scene_Title
#============================================================
class Scene_Title
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias legacy_equipscroll_scenetitle_newgame command_new_game
#--------------------------------------------------------------------------
# * Command: New Game
#--------------------------------------------------------------------------
def command_new_game
$equipment = 0
legacy_equipscroll_scenetitle_newgame
end
end
Features
- Scroll through your equipment with 'Q' and 'W' buttons
- Change between equipment type with number (1-5) buttons
- Show status and decription using 'Tab' button
- Customizable suiting your need
"Scripting, It's my way of life." ~ Legacy