Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Item Stats Window in shop(shows ALL item stats), A big improvement of my first script
cr4200
post Jun 4 2009, 01:18 PM
Post #1


Level 7
Group Icon

Group: Member
Posts: 93
Type: None
RM Skill: Skilled




Made By: cr4200
Version: 1.1
Release Date: 6/ 05/ 09

Intro
My very first script i ever posted on here drew all of the parameters of the selected item in the shop status window.
This script does basically the same thing but in a much better way.
It opens a whole new window which gave me more room to work with and
spread the parameters out and ithis allowed me to add an elements and states list of the
selected item in the shop buy window

*UPDATE*
The script now also draws the "extras" for the item like fast atk and two handed for weapons and block criticals and 1/2 mp cost for armor

*UPDATE*
I got bored so I decided to improve this so I fixed the bad layout of Icons and names and put in the name of the observed object and its price
at the top. I also cleaned up the script A LOT. So over all the whole window looks a lot better.

Features
    V 1.2
  • Draws observed items name and price at top
  • Layout is much better and cleaner
    V 1.1
  • Draws the extra item effects(fast attack, dual attack, half mp, 2x EXP gain, etc.)
    V 1.0
  • Draws all parameters
  • Draws element list
  • Draws state list
  • Customization of headers for window and lists
  • choose which icons represent the changed parameter
  • choose to turn the icons off and on


Script
CODE

#==============================================================================
=begin
Script made by: CR4200
Title: Items Stats Window

This script is a vast upgrade from my first script which showed item stats
within the shop status window.
That solution made me have to squeeze the parameters into that little box in the
corner. But now i've made a whole new window which gave me plenty of room
to work with. So now the actors names, parameters, item name, and
the icons(sort off) fit rather well. I was also able to include the items
element list and state list.
#_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_#
==In order to call the window in the shop menu, simply pres the the SHIFT button
==over the item you wish to see in more detail.
#_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_#
=end
#==============================================================================
#Controls whether to show icons or not
#False = don't show True = Show
$icon_switch = true

#Put the index of the icon on your iconset that you want to use for the stat
$atk_up_icon = 120
$def_up_icon = 121
$agi_up_icon = 123
$spi_up_icon = 122
$atk_down_icon = 124
$def_down_icon = 125
$agi_down_icon = 127
$spi_down_icon = 126
module StatsMod
OtherStats = "Other Stats" #header of the right side
Elements = "Elements" #header of the elements list
States = "States" #header of the states list
Price = "%s%s"
end


#-------Shop Items Window------->>
#draws item stats
#------------------------------->>
class Window_Shopitems < Window_Base
def initialize(x, y)
super(x, y, 545, 417)
@item = nil
refresh
draw_other
end
def refresh
self.contents.clear
if @item != nil
self.contents.font.size = 32
self.contents.draw_text(29, 0, 272, 34, @item.name)
self.contents.font.size = 20
text = sprintf(StatsMod::Price, @item.price, $data_system.terms.gold)
self.contents.draw_text(5, 0, 272, 34, text, 2)
draw_icon(@item.icon_index, 5, 5)
for actor in $game_party.members
x = 4
y = WLH * (2 + actor.index * 3.5) + 20
draw_actor_parameter_change(actor, x, y)
end
draw_other
draw_states
if @item.is_a?(RPG::Weapon)
draw_weapon_special
else
draw_armor_special
end
end
end
$icon_off = false
#------------------------------------------#
#This draws the parameter comparison between the actors
#current weapon and the weapon your looking at (shows atk, def, agi, and spi)
#------------------------------------------#
def draw_actor_parameter_change(actor, x, y)
return if @item.is_a?(RPG::Item)
enabled = actor.equippable?(@item)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(x, y - 26, 200, WLH, actor.name)
if @item.is_a?(RPG::Weapon)
item1 = weaker_weapon(actor)
elsif actor.two_swords_style and @item.kind == 0
item1 = nil
else
item1 = actor.equips[1 + @item.kind]
end
if enabled
if @item.is_a?(RPG::Weapon)
atk1 = item1 == nil ? 0 : item1.atk
atk2 = @item == nil ? 0 : @item.atk
def1 = item1 == nil ? 0 : item1.def
def2 = @item == nil ? 0 : @item.def
agi1 = item1 == nil ? 0 : item1.agi
agi2 = @item == nil ? 0 : @item.agi
spi1 = item1 == nil ? 0 : item1.spi
spi2 = @item == nil ? 0 : @item.spi
change = atk2 - atk1
change2 = def2 - def1
change3 = agi2 - agi1
change4 = spi2 - spi1
else
atk1 = item1 == nil ? 0 : item1.atk
atk2 = @item == nil ? 0 : @item.atk
def1 = item1 == nil ? 0 : item1.def
def2 = @item == nil ? 0 : @item.def
agi1 = item1 == nil ? 0 : item1.agi
agi2 = @item == nil ? 0 : @item.agi
spi1 = item1 == nil ? 0 : item1.spi
spi2 = @item == nil ? 0 : @item.spi
change = atk2 - atk1
change2 = def2 - def1
change3 = agi2 - agi1
change4 = spi2 - spi1
end
x -= 20
bitmap = Cache.system("Iconset")
if atk1 > atk2
self.contents.font.color = text_color(25)
self.contents.draw_text(x + 176, y, 200, WLH, sprintf("Atk %+d", change))
self.contents.font.color = normal_color
if $icon_off = $icon_switch
rect = Rect.new(124 % 16 * 24, $atk_down_icon / 16 * 24, 24, 24)
self.contents.blt(x + 150, y, bitmap, rect, enabled ? 255 : 128)
else
end
end
if atk1 < atk2
self.contents.font.color = text_color(24)
self.contents.draw_text(x + 176 , y, 200, WLH, sprintf("Atk %+d", change))
self.contents.font.color = normal_color
if $icon_off = $icon_switch
rect = Rect.new(120 % 16 * 24, $atk_up_icon / 16 * 24, 24, 24)
self.contents.blt(x + 150, y, bitmap, rect, enabled ? 255 : 128)
else
end
end
if def1 > def2
self.contents.font.color = text_color(25)
self.contents.draw_text(x + 56, y, 130, WLH, sprintf("Def %+d", change2))
self.contents.font.color = normal_color
if $icon_off = $icon_switch
rect = Rect.new(125 % 16 * 24, $def_down_icon / 16 * 24, 24, 24)
self.contents.blt(x + 30, y, bitmap, rect, enabled ? 255 : 128)
else
end
end
if def1 < def2
self.contents.font.color = text_color(24)
self.contents.draw_text(x + 56, y, 130, WLH, sprintf("Def %+d", change2))
self.contents.font.color = normal_color
if $icon_off = $icon_switch
rect = Rect.new(121 % 16 * 24, $def_up_icon / 16 * 24, 24, 24)
self.contents.blt(x + 30, y, bitmap, rect, enabled ? 255 : 128)
else
end
end
if agi1 > agi2
self.contents.font.color = text_color(25)
self.contents.draw_text(x + 56, y + 20, 130, WLH, sprintf("Agi %+d", change3))
self.contents.font.color = normal_color
if $icon_off = $icon_switch
rect = Rect.new(127 % 16 * 24, $agi_down_icon / 16 * 24, 24, 24)
self.contents.blt(x + 30, y + 25, bitmap, rect, enabled ? 255 : 128)
else
end
end
if agi1 < agi2
self.contents.font.color = text_color(24)
self.contents.draw_text(x + 56, y + 20, 130, WLH, sprintf("Agi %+d", change3))
self.contents.font.color = normal_color
if $icon_off = $icon_switch
rect = Rect.new(123 % 16 * 24, $agi_up_icon / 16 * 24, 24, 24)
self.contents.blt(x + 30, y + 25, bitmap, rect, enabled ? 255 : 128)
else
end
end
if spi1 > spi2
self.contents.font.color = text_color(25)
self.contents.draw_text(x + 176, y + 20, 200, WLH, sprintf("Spi %+d", change4))
self.contents.font.color = normal_color
if $icon_off = $icon_switch
rect = Rect.new(126 % 16 * 24, $spi_down_icon / 16 * 24, 24, 24)
self.contents.blt(x + 150, y + 25, bitmap, rect, enabled ? 255 : 128)
else
end
end
if spi1 < spi2
self.contents.font.color = text_color(24)
self.contents.draw_text(x + 176, y + 20, 200, WLH, sprintf("Spi %+d", change4))
self.contents.font.color = normal_color
if $icon_off = $icon_switch
rect = Rect.new(122 % 16 * 24, $spi_up_icon / 16 * 24, 24, 24)
self.contents.blt(x + 150, y + 25, bitmap, rect, enabled ? 255 : 128)
else
end
end
end
draw_item_name(item1, x + 150, y + WLH - 49, enabled)
self.contents.font.color = normal_color
end
#--------------------------------------------------------#
#This draws the elemental set of the item and the header for the right side and the element list
#--------------------------------------------------------#
def draw_other
self.contents.font.size = 28
self.contents.font.bold = true
self.contents.draw_text(x + 300, y, 200, 35, StatsMod::OtherStats, 1)
self.contents.font.size = 20
y =+ 15
self.contents.draw_text(x + 300, y + 20, 200, WLH, StatsMod::Elements)
self.contents.font.bold = false
if @item.is_a?(RPG::Weapon)
v = 0
n = 0
while v <= 5
for element in $data_weapons[@item.id].element_set
unless n >= $data_weapons[@item.id].element_set.size
self.contents.draw_text(x + 300, y + 45 + (n * 35), 200, WLH, $data_system.elements[element])
end
n += 1
end
v += 1
end
elsif @item.is_a?(RPG::Armor)
v = 0
n = 0
while v <= 5
for element in $data_armors[@item.id].element_set
unless n >= $data_armors[@item.id].element_set.size
self.contents.draw_text(x + 300, y + 45 + (n * 35), 200, WLH, $data_system.elements[element])
end
n += 1
end
v += 1
end
end
end
#------------------------------------------------#
#This draws the state set for the item and the header for the states list
#------------------------------------------------#
def draw_states
y =+ 15
self.contents.font.bold = true
self.contents.draw_text(x + 300, y + 20, 200, WLH, StatsMod::States, 2)
self.contents.font.bold = false
if @item.is_a?(RPG::Weapon)
v = 0
n = 0
while v <= 5
for state in $data_weapons[@item.id].state_set
unless n >= $data_weapons[@item.id].state_set.size
self.contents.draw_text(x + 300, y + 45 + (n * 35), 200, WLH, $data_states[state].name, 2)
end
n += 1
end
v += 1
end
elsif @item.is_a?(RPG::Armor)
v = 0
n = 0
while v <= 5
for state in $data_armors[@item.id].state_set
unless n >= $data_armors[@item.id].state_set.size
self.contents.draw_text(x + 300, y + 45 + (n * 35), 200, WLH, $data_states[state].name, 2)
end
n += 1
end
v += 1
end
end
end
def weaker_weapon(actor)
if actor.two_swords_style
weapon1 = actor.weapons[0]
weapon2 = actor.weapons[1]
if weapon1 == nil or weapon2 == nil
return nil
elsif weapon1.atk < weapon2.atk
return weapon1
else
return weapon2
end
else
return actor.weapons[0]
end
end
def item=(item)
if @item != item
@item = item
refresh
end
end
def draw_weapon_special
self.contents.font.bold = true
self.contents.draw_text(x + 300, y + 270 + 35, 200, WLH, "Weapon Extras", 1)
self.contents.font.bold = false
if @item.two_handed
self.contents.draw_text(x + 300, y + 295 + 35, 200, WLH, "2-Handed", 2)
end
if @item.fast_attack
self.contents.draw_text(x + 300, y + 295 + 35, 200, WLH, "Fast-Atk")
end
if @item.dual_attack
self.contents.draw_text(x + 300, y + 320 + 35, 200, WLH, "2x Atk")
end
if @item.critical_bonus
self.contents.draw_text(x + 300, y + 320 + 35, 200, WLH, "Critical", 2)
end
end
def draw_armor_special
self.contents.font.bold = true
self.contents.draw_text(x + 300, y + 270 + 35, 200, WLH, "Armor Extras", 1)
self.contents.font.bold = false
if @item.prevent_critical
self.contents.draw_text(x + 300, y + 295 + 35, 200, WLH, "No Critical", 2)
end
if @item.half_mp_cost
self.contents.draw_text(x + 300, y + 295 + 35, 200, WLH, "1/2 Mp")
end
if @item.double_exp_gain
self.contents.draw_text(x + 300, y + 320 + 35, 200, WLH, "2x Exp")
end
if @item.auto_hp_recover
self.contents.draw_text(x + 300, y + 320 + 35, 200, WLH, "Regen", 2)
end
end
end
#-----------------#
#this puts the Items_stats window into the shop scene
#-----------------#
class Scene_Shop < Scene_Base
alias shift_start start
def start
shift_start
super
@item_stats = Window_Shopitems.new(0, 0)
@item_stats.back_opacity = 255
@item_stats.openness = 0
@item_stats.visible = false
end
alias shift_show update_buy_selection
def update_buy_selection
shift_show
@status_window.item = @buy_window.item
if Input.trigger?(Input::SHIFT)
unless @buy_window.item.is_a?(RPG::Item)
Sound.play_decision
@item_stats.item = @buy_window.item
@buy_window.active = false
@item_stats.active = true
@item_stats.visible = true
@item_stats.openness = 255
else
Sound.play_buzzer
end
end
end
def update
super
update_menu_background
@help_window.update
@command_window.update
@gold_window.update
@dummy_window.update
@buy_window.update
@sell_window.update
@number_window.update
@status_window.update
if @command_window.active
update_command_selection
elsif @buy_window.active
update_buy_selection
elsif @sell_window.active
update_sell_selection
elsif @number_window.active
update_number_input
elsif @item_stats.active
update_stats
@item_stats.update
end
end
def update_stats
if Input.trigger?(Input::B)
@item_stats.visible = false
@item_stats.active = false
@buy_window.active = true
end
end
end

CODE
#======================================================================
========
=begin
Script made by: CR4200
Title: Items Stats Window

This script is a vast upgrade from my first script which showed item stats
within the shop status window.
That solution made me have to squeeze the parameters into that little box in the
corner. But now i've made a whole new window which gave me plenty of room
to work with. So now the actors names, parameters, item name, and
the icons(sort off) fit rather well. I was also able to include the items
element list and state list.
#_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_#
==In order to call the window in the shop menu, simply pres the the SHIFT button
==over the item you wish to see in more detail.
#_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_#
=end
#==============================================================================
#Controls whether to show icons or not
#False = don't show True = Show
$icon_switch = true

#Put the index of the icon on your iconset that you want to use for the stat
$atk_up_icon = 120
$def_up_icon = 121
$agi_up_icon = 123
$spi_up_icon = 122
$atk_down_icon = 124
$def_down_icon = 125
$agi_down_icon = 127
$spi_down_icon = 126
module StatsMod
OtherStats = "Other Stats" #header of the right side
Elements = "Elements" #header of the elements list
States = "States" #header of the states list
end


#-------Shop Items Window------->>
#draws item stats
#------------------------------->>
EQUIP_TYPE_MAX = 5
class Window_Shopitems < Window_Base
def initialize(x, y)
super(x, y, 545, 417)
@item = nil
refresh
draw_other
end
def refresh
self.contents.clear
if @item != nil
self.contents.font.size = 32
self.contents.font.size = 20
for actor in $game_party.members
x = 4
y = WLH * (2 + actor.index * 4)
draw_actor_parameter_change(actor, x, y)
end
draw_other
draw_states
if @item.is_a?(RPG::Weapon)
draw_weapon_special
else
draw_armor_special
end
end
end
$icon_off = false
#------------------------------------------#
#This draws the parameter comparison between the actors
#current weapon and the weapon your looking at (shows atk, def, agi, and spi)
#------------------------------------------#
def draw_actor_parameter_change(actor, x, y)
return if @item.is_a?(RPG::Item)
enabled = actor.equippable?(@item)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(x, y, 200, WLH, actor.name)
if @item.is_a?(RPG::Weapon)
item1 = weaker_weapon(actor)
elsif actor.two_swords_style and @item.kind == 0
item1 = nil
else
item1 = actor.equips[1 + @item.kind]
end
if enabled
if @item.is_a?(RPG::Weapon)
atk1 = item1 == nil ? 0 : item1.atk
atk2 = @item == nil ? 0 : @item.atk
def1 = item1 == nil ? 0 : item1.def
def2 = @item == nil ? 0 : @item.def
agi1 = item1 == nil ? 0 : item1.agi
agi2 = @item == nil ? 0 : @item.agi
spi1 = item1 == nil ? 0 : item1.spi
spi2 = @item == nil ? 0 : @item.spi
change = atk2 - atk1
change2 = def2 - def1
change3 = agi2 - agi1
change4 = spi2 - spi1
else
atk1 = item1 == nil ? 0 : item1.atk
atk2 = @item == nil ? 0 : @item.atk
def1 = item1 == nil ? 0 : item1.def
def2 = @item == nil ? 0 : @item.def
agi1 = item1 == nil ? 0 : item1.agi
agi2 = @item == nil ? 0 : @item.agi
spi1 = item1 == nil ? 0 : item1.spi
spi2 = @item == nil ? 0 : @item.spi
change = atk2 - atk1
change2 = def2 - def1
change3 = agi2 - agi1
change4 = spi2 - spi1
end
x += 20
if atk1 > atk2
self.contents.font.color = text_color(25)
self.contents.draw_text(x + 30, y, 200, WLH, sprintf("Atk %+d", change), 2)
self.contents.font.color = normal_color
if $icon_off = $icon_switch
bitmap = Cache.system("Iconset")
rect = Rect.new(124 % 16 * 24, $atk_down_icon / 16 * 24, 24, 24)
self.contents.blt(x + 130, y, bitmap, rect, enabled ? 255 : 128)
else
end
end
if atk1 < atk2
self.contents.font.color = text_color(24)
self.contents.draw_text(x + 30 , y, 200, WLH, sprintf("Atk %+d", change), 2)
self.contents.font.color = normal_color
if $icon_off = $icon_switch
bitmap = Cache.system("Iconset")
rect = Rect.new(120 % 16 * 24, $atk_up_icon / 16 * 24, 24, 24)
self.contents.blt(x + 130, y, bitmap, rect, enabled ? 255 : 128)
else
end

end
if def1 > def2
self.contents.font.color = text_color(25)
self.contents.draw_text(x - 10, y, 130, WLH, sprintf("Def %+d", change2), 2)
self.contents.font.color = normal_color
if $icon_off = $icon_switch
bitmap = Cache.system("Iconset")
rect = Rect.new(125 % 16 * 24, $def_down_icon / 16 * 24, 24, 24)
self.contents.blt(x + 30, y, bitmap, rect, enabled ? 255 : 128)
else
end
end
if def1 < def2
self.contents.font.color = text_color(24)
self.contents.draw_text(x - 10, y, 130, WLH, sprintf("Def %+d", change2), 2)
self.contents.font.color = normal_color
if $icon_off = $icon_switch
bitmap = Cache.system("Iconset")
rect = Rect.new(121 % 16 * 24, $def_up_icon / 16 * 24, 24, 24)
self.contents.blt(x + 30, y, bitmap, rect, enabled ? 255 : 128)
else
end
end
if agi1 > agi2
self.contents.font.color = text_color(25)
self.contents.draw_text(x - 10, y + 20, 130, WLH, sprintf("Agi %+d", change3), 2)
self.contents.font.color = normal_color
if $icon_off = $icon_switch
bitmap = Cache.system("Iconset")
rect = Rect.new(127 % 16 * 24, $agi_down_icon / 16 * 24, 24, 24)
self.contents.blt(x + 30, y + 25, bitmap, rect, enabled ? 255 : 128)
else
end
end
if agi1 < agi2
self.contents.font.color = text_color(24)
self.contents.draw_text(x - 10, y + 20, 130, WLH, sprintf("Agi %+d", change3), 2)
self.contents.font.color = normal_color
if $icon_off = $icon_switch
bitmap = Cache.system("Iconset")
rect = Rect.new(123 % 16 * 24, $agi_up_icon / 16 * 24, 24, 24)
self.contents.blt(x + 30, y + 25, bitmap, rect, enabled ? 255 : 128)
else
end
end
if spi1 > spi2
self.contents.font.color = text_color(25)
self.contents.draw_text(x + 30, y + 20, 200, WLH, sprintf("Spi %+d", change4), 2)
self.contents.font.color = normal_color
if $icon_off = $icon_switch
bitmap = Cache.system("Iconset")
rect = Rect.new(126 % 16 * 24, $spi_down_icon / 16 * 24, 24, 24)
self.contents.blt(x + 130, y + 25, bitmap, rect, enabled ? 255 : 128)
else
end
end
if spi1 < spi2
self.contents.font.color = text_color(24)
self.contents.draw_text(x + 30, y + 20, 200, WLH, sprintf("Spi %+d", change4), 2)
self.contents.font.color = normal_color
if $icon_off = $icon_switch
bitmap = Cache.system("Iconset")
rect = Rect.new(122 % 16 * 24, $spi_up_icon / 16 * 24, 24, 24)
self.contents.blt(x + 130, y + 25, bitmap, rect, enabled ? 255 : 128)
else
end
end
end
draw_item_name(item1, x, y + WLH - 49, enabled)
self.contents.font.color = normal_color
end
#--------------------------------------------------------#
#This draws the elemental set of the item and the header for the right side and the element list
#--------------------------------------------------------#
def draw_other
self.contents.font.size = 28
self.contents.font.bold = true
self.contents.draw_text(x + 300, y, 200, 35, StatsMod::OtherStats, 1)
self.contents.font.size = 20
y =+ 15
self.contents.draw_text(x + 300, y + 20, 200, WLH, StatsMod::Elements)
self.contents.font.bold = false
if @item.is_a?(RPG::Weapon)
v = 0
n = 0
while v <= 5
for element in $data_weapons[@item.id].element_set
unless n >= $data_weapons[@item.id].element_set.size
self.contents.draw_text(x + 300, y + 45 + (n * 35), 200, WLH, $data_system.elements[element])
end
n += 1
end
v += 1
end
elsif @item.is_a?(RPG::Armor)
v = 0
n = 0
while v <= 5
for element in $data_armors[@item.id].element_set
unless n >= $data_armors[@item.id].element_set.size
self.contents.draw_text(x + 300, y + 45 + (n * 35), 200, WLH, $data_system.elements[element])
end
n += 1
end
v += 1
end
end
end
#------------------------------------------------#
#This draws the state set for the item and the header for the states list
#------------------------------------------------#
def draw_states
y =+ 15
self.contents.font.bold = true
self.contents.draw_text(x + 300, y + 20, 200, WLH, StatsMod::States, 2)
self.contents.font.bold = false
if @item.is_a?(RPG::Weapon)
v = 0
n = 0
while v <= 5
for state in $data_weapons[@item.id].state_set
unless n >= $data_weapons[@item.id].state_set.size
self.contents.draw_text(x + 300, y + 45 + (n * 35), 200, WLH, $data_states[state].name, 2)
end
n += 1
end
v += 1
end
elsif @item.is_a?(RPG::Armor)
v = 0
n = 0
while v <= 5
for state in $data_armors[@item.id].state_set
unless n >= $data_armors[@item.id].state_set.size
self.contents.draw_text(x + 300, y + 45 + (n * 35), 200, WLH, $data_states[state].name, 2)
end
n += 1
end
v += 1
end
end
end
def weaker_weapon(actor)
if actor.two_swords_style
weapon1 = actor.weapons[0]
weapon2 = actor.weapons[1]
if weapon1 == nil or weapon2 == nil
return nil
elsif weapon1.atk < weapon2.atk
return weapon1
else
return weapon2
end
else
return actor.weapons[0]
end
end
def item=(item)
if @item != item
@item = item
refresh
end
end
def draw_weapon_special
self.contents.font.bold = true
self.contents.draw_text(x + 300, y + 270 + 35, 200, WLH, "Weapon Extras", 1)
self.contents.font.bold = false
if @item.two_handed
self.contents.draw_text(x + 300, y + 295 + 35, 200, WLH, "2-Handed", 2)
end
if @item.fast_attack
self.contents.draw_text(x + 300, y + 295 + 35, 200, WLH, "Fast-Atk")
end
if @item.dual_attack
self.contents.draw_text(x + 300, y + 320 + 35, 200, WLH, "2x Atk")
end
if @item.critical_bonus
self.contents.draw_text(x + 300, y + 320 + 35, 200, WLH, "Critical", 2)
end
end
def draw_armor_special
self.contents.font.bold = true
self.contents.draw_text(x + 300, y + 270 + 35, 200, WLH, "Armor Extras", 1)
self.contents.font.bold = false
if @item.prevent_critical
self.contents.draw_text(x + 300, y + 295 + 35, 200, WLH, "No Critical", 2)
end
if @item.half_mp_cost
self.contents.draw_text(x + 300, y + 295 + 35, 200, WLH, "1/2 Mp")
end
if @item.double_exp_gain
self.contents.draw_text(x + 300, y + 320 + 35, 200, WLH, "2x Exp")
end
if @item.auto_hp_recover
self.contents.draw_text(x + 300, y + 320 + 35, 200, WLH, "Regen", 2)
end
end
end
#-----------------#
#this puts the Items_stats window into the shop scene
#-----------------#
class Scene_Shop < Scene_Base
alias shift_start start
def start
shift_start
super
create_menu_background
create_command_window
@help_window = Window_Help.new
@gold_window = Window_Gold.new(384, 56)
@dummy_window = Window_Base.new(0, 112, 544, 304)
@buy_window = Window_ShopBuy.new(0, 112)
@buy_window.active = false
@buy_window.visible = false
@buy_window.help_window = @help_window
@sell_window = Window_ShopSell.new(0, 112, 544, 304)
@sell_window.active = false
@sell_window.visible = false
@sell_window.help_window = @help_window
@number_window = Window_ShopNumber.new(0, 112)
@number_window.active = false
@number_window.visible = false
@status_window = Window_ShopStatus.new(304, 112)
@status_window.visible = false
@item_stats = Window_Shopitems.new(0, 0)
@item_stats.visible = false
end
alias shift_show update_buy_selection
def update_buy_selection
shift_show
@status_window.item = @buy_window.item
if Input.trigger?(Input::B)
Sound.play_cancel
@command_window.active = true
@dummy_window.visible = true
@buy_window.active = false
@buy_window.visible = false
@status_window.visible = false
@status_window.item = nil
@help_window.set_text("")
return
end
if Input.trigger?(Input::C)
@item = @buy_window.item
number = $game_party.item_number(@item)
if @item == nil or @item.price > $game_party.gold or number == 99
Sound.play_buzzer
else
Sound.play_decision
max = @item.price == 0 ? 99 : $game_party.gold / @item.price
max = [max, 99 - number].min
@buy_window.active = false
@buy_window.visible = false
@number_window.set(@item, max, @item.price)
@number_window.active = true
@number_window.visible = true
end
end
if Input.trigger?(Input::SHIFT)
unless @buy_window.item.is_a?(RPG::Item)
Sound.play_decision
@item_stats.item = @buy_window.item
@buy_window.active = false
@item_stats.active = true
@item_stats.visible = true
else
Sound.play_buzzer
end
end
end
def update
super
update_menu_background
@help_window.update
@command_window.update
@gold_window.update
@dummy_window.update
@buy_window.update
@sell_window.update
@number_window.update
@status_window.update
if @command_window.active
update_command_selection
elsif @buy_window.active
update_buy_selection
elsif @sell_window.active
update_sell_selection
elsif @number_window.active
update_number_input
elsif @item_stats.active
update_stats
@item_stats.update
end
end
def update_stats
if Input.trigger?(Input::B)
@item_stats.visible = false
@item_stats.active = false
@buy_window.active = true
end
end
end


CODE
#================================================================
==============
=begin
Script made by: CR4200
Title: Items Stats Window

This script is a vast upgrade from my first script which showed item stats
within the shop status window.
That solution made me have to squeeze the parameters into that little box in the
corner. But now i've made a whole new window which gave me plenty of room
to work with. So now the actors names, parameters, item name, and
the icons(sort off) fit rather well. I was also able to include the items
element list and state list.
#_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_#
==In order to call the window in the shop menu, simply pres the the SHIFT button
==over the item you wish to see in more detail.
#_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_#
=end
#==============================================================================
#Controls whether to show icons or not
#False = don't show True = Show
$icon_switch = true

#Put the index of the icon on your iconset that you want to use for the stat
$atk_up_icon = 120
$def_up_icon = 121
$agi_up_icon = 123
$spi_up_icon = 122
$atk_down_icon = 124
$def_down_icon = 125
$agi_down_icon = 127
$spi_down_icon = 126
module StatsMod
OtherStats = "Other Stats" #header of the right side
Elements = "Elements" #header of the elements list
States = "States" #header of the states list
end


#-------Shop Items Window------->>
#draws item stats
#------------------------------->>
class Window_Shopitems < Window_Base
def initialize(x, y)
super(x, y, 545, 417)
@item = nil
refresh
draw_other
end
def refresh
self.contents.clear
if @item != nil
self.contents.font.size = 32
self.contents.font.size = 20
for actor in $game_party.members
x = 4
y = WLH * (2 + actor.index * 4)
draw_actor_parameter_change(actor, x, y)
end
draw_other
draw_states
end
end
$icon_off = false
#------------------------------------------#
#This draws the parameter comparison between the actors
#current weapon and the weapon your looking at (shows atk, def, agi, and spi)
#------------------------------------------#
def draw_actor_parameter_change(actor, x, y)
return if @item.is_a?(RPG::Item)
enabled = actor.equippable?(@item)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(x, y, 200, WLH, actor.name)
if @item.is_a?(RPG::Weapon)
item1 = weaker_weapon(actor)
elsif actor.two_swords_style and @item.kind == 0
item1 = nil
else
item1 = actor.equips[1 + @item.kind]
end
if enabled
if @item.is_a?(RPG::Weapon)
atk1 = item1 == nil ? 0 : item1.atk
atk2 = @item == nil ? 0 : @item.atk
def1 = item1 == nil ? 0 : item1.def
def2 = @item == nil ? 0 : @item.def
agi1 = item1 == nil ? 0 : item1.agi
agi2 = @item == nil ? 0 : @item.agi
spi1 = item1 == nil ? 0 : item1.spi
spi2 = @item == nil ? 0 : @item.spi
change = atk2 - atk1
change2 = def2 - def1
change3 = agi2 - agi1
change4 = spi2 - spi1
else
atk1 = item1 == nil ? 0 : item1.atk
atk2 = @item == nil ? 0 : @item.atk
def1 = item1 == nil ? 0 : item1.def
def2 = @item == nil ? 0 : @item.def
agi1 = item1 == nil ? 0 : item1.agi
agi2 = @item == nil ? 0 : @item.agi
spi1 = item1 == nil ? 0 : item1.spi
spi2 = @item == nil ? 0 : @item.spi
change = atk2 - atk1
change2 = def2 - def1
change3 = agi2 - agi1
change4 = spi2 - spi1
end
x += 20
if atk1 > atk2
self.contents.font.color = text_color(25)
self.contents.draw_text(x + 30, y, 200, WLH, sprintf("Atk %+d", change), 2)
self.contents.font.color = normal_color
if $icon_off = $icon_switch
bitmap = Cache.system("Iconset")
rect = Rect.new(124 % 16 * 24, $atk_down_icon / 16 * 24, 24, 24)
self.contents.blt(x + 130, y, bitmap, rect, enabled ? 255 : 128)
else
end
end
if atk1 < atk2
self.contents.font.color = text_color(24)
self.contents.draw_text(x + 30 , y, 200, WLH, sprintf("Atk %+d", change), 2)
self.contents.font.color = normal_color
if $icon_off = $icon_switch
bitmap = Cache.system("Iconset")
rect = Rect.new(120 % 16 * 24, $atk_up_icon / 16 * 24, 24, 24)
self.contents.blt(x + 130, y, bitmap, rect, enabled ? 255 : 128)
else
end

end
if def1 > def2
self.contents.font.color = text_color(25)
self.contents.draw_text(x - 10, y, 130, WLH, sprintf("Def %+d", change2), 2)
self.contents.font.color = normal_color
if $icon_off = $icon_switch
bitmap = Cache.system("Iconset")
rect = Rect.new(125 % 16 * 24, $def_down_icon / 16 * 24, 24, 24)
self.contents.blt(x + 30, y, bitmap, rect, enabled ? 255 : 128)
else
end
end
if def1 < def2
self.contents.font.color = text_color(24)
self.contents.draw_text(x - 10, y, 130, WLH, sprintf("Def %+d", change2), 2)
self.contents.font.color = normal_color
if $icon_off = $icon_switch
bitmap = Cache.system("Iconset")
rect = Rect.new(121 % 16 * 24, $def_up_icon / 16 * 24, 24, 24)
self.contents.blt(x + 30, y, bitmap, rect, enabled ? 255 : 128)
else
end
end
if agi1 > agi2
self.contents.font.color = text_color(25)
self.contents.draw_text(x - 10, y + 20, 130, WLH, sprintf("Agi %+d", change3), 2)
self.contents.font.color = normal_color
if $icon_off = $icon_switch
bitmap = Cache.system("Iconset")
rect = Rect.new(127 % 16 * 24, $agi_down_icon / 16 * 24, 24, 24)
self.contents.blt(x + 30, y + 25, bitmap, rect, enabled ? 255 : 128)
else
end
end
if agi1 < agi2
self.contents.font.color = text_color(24)
self.contents.draw_text(x - 10, y + 20, 130, WLH, sprintf("Agi %+d", change3), 2)
self.contents.font.color = normal_color
if $icon_off = $icon_switch
bitmap = Cache.system("Iconset")
rect = Rect.new(123 % 16 * 24, $agi_up_icon / 16 * 24, 24, 24)
self.contents.blt(x + 30, y + 25, bitmap, rect, enabled ? 255 : 128)
else
end
end
if spi1 > spi2
self.contents.font.color = text_color(25)
self.contents.draw_text(x + 30, y + 20, 200, WLH, sprintf("Spi %+d", change4), 2)
self.contents.font.color = normal_color
if $icon_off = $icon_switch
bitmap = Cache.system("Iconset")
rect = Rect.new(126 % 16 * 24, $spi_down_icon / 16 * 24, 24, 24)
self.contents.blt(x + 130, y + 25, bitmap, rect, enabled ? 255 : 128)
else
end
end
if spi1 < spi2
self.contents.font.color = text_color(24)
self.contents.draw_text(x + 30, y + 20, 200, WLH, sprintf("Spi %+d", change4), 2)
self.contents.font.color = normal_color
if $icon_off = $icon_switch
bitmap = Cache.system("Iconset")
rect = Rect.new(122 % 16 * 24, $spi_up_icon / 16 * 24, 24, 24)
self.contents.blt(x + 130, y + 25, bitmap, rect, enabled ? 255 : 128)
else
end
end
end
draw_item_name(item1, x, y + WLH - 49, enabled)
self.contents.font.color = normal_color
end
#--------------------------------------------------------#
#This draws the elemental set of the item and the header for the right side and the element list
#--------------------------------------------------------#
def draw_other
self.contents.font.size = 28
self.contents.font.bold = true
self.contents.draw_text(x + 300, y, 200, 35, StatsMod::OtherStats, 1)
self.contents.font.size = 20
y =+ 15
self.contents.draw_text(x + 300, y + 20, 200, WLH, StatsMod::Elements)
self.contents.font.bold = false
if @item.is_a?(RPG::Weapon)
v = 0
n = 0
while v <= 5
for element in $data_weapons[@item.id].element_set
unless n >= $data_weapons[@item.id].element_set.size
self.contents.draw_text(x + 300, y + 45 + (n * 35), 200, WLH, $data_system.elements[element])
end
n += 1
end
v += 1
end
elsif @item.is_a?(RPG::Armor)
v = 0
n = 0
while v <= 5
for element in $data_armors[@item.id].element_set
unless n >= $data_armors[@item.id].element_set.size
self.contents.draw_text(x + 300, y + 45 + (n * 35), 200, WLH, $data_system.elements[element])
end
n += 1
end
v += 1
end
end
end
#------------------------------------------------#
#This draws the state set for the item and the header for the states list
#------------------------------------------------#
def draw_states
y =+ 15
self.contents.font.bold = true
self.contents.draw_text(x + 300, y + 20, 200, WLH, StatsMod::States, 2)
self.contents.font.bold = false
if @item.is_a?(RPG::Weapon)
v = 0
n = 0
while v <= 5
for state in $data_weapons[@item.id].state_set
unless n >= $data_weapons[@item.id].state_set.size
self.contents.draw_text(x + 300, y + 45 + (n * 35), 200, WLH, $data_states[state].name, 2)
end
n += 1
end
v += 1
end
elsif @item.is_a?(RPG::Armor)
v = 0
n = 0
while v <= 5
for state in $data_armors[@item.id].state_set
unless n >= $data_armors[@item.id].state_set.size
self.contents.draw_text(x + 300, y + 45 + (n * 35), 200, WLH, $data_states[state].name, 2)
end
n += 1
end
v += 1
end
end
end
def weaker_weapon(actor)
if actor.two_swords_style
weapon1 = actor.weapons[0]
weapon2 = actor.weapons[1]
if weapon1 == nil or weapon2 == nil
return nil
elsif weapon1.atk < weapon2.atk
return weapon1
else
return weapon2
end
else
return actor.weapons[0]
end
end
def item=(item)
if @item != item
@item = item
refresh
end
end
end
#-----------------#
#this puts the Items_stats window into the shop scene
#-----------------#
class Scene_Shop < Scene_Base
alias shift_start start
def start
shift_start
super
create_menu_background
create_command_window
@help_window = Window_Help.new
@gold_window = Window_Gold.new(384, 56)
@dummy_window = Window_Base.new(0, 112, 544, 304)
@buy_window = Window_ShopBuy.new(0, 112)
@buy_window.active = false
@buy_window.visible = false
@buy_window.help_window = @help_window
@sell_window = Window_ShopSell.new(0, 112, 544, 304)
@sell_window.active = false
@sell_window.visible = false
@sell_window.help_window = @help_window
@number_window = Window_ShopNumber.new(0, 112)
@number_window.active = false
@number_window.visible = false
@status_window = Window_ShopStatus.new(304, 112)
@status_window.visible = false
@item_stats = Window_Shopitems.new(0, 0)
@item_stats.visible = false
end
alias shift_show update_buy_selection
def update_buy_selection
shift_show
@status_window.item = @buy_window.item
if Input.trigger?(Input::B)
Sound.play_cancel
@command_window.active = true
@dummy_window.visible = true
@buy_window.active = false
@buy_window.visible = false
@status_window.visible = false
@status_window.item = nil
@help_window.set_text("")
return
end
if Input.trigger?(Input::C)
@item = @buy_window.item
number = $game_party.item_number(@item)
if @item == nil or @item.price > $game_party.gold or number == 99
Sound.play_buzzer
else
Sound.play_decision
max = @item.price == 0 ? 99 : $game_party.gold / @item.price
max = [max, 99 - number].min
@buy_window.active = false
@buy_window.visible = false
@number_window.set(@item, max, @item.price)
@number_window.active = true
@number_window.visible = true
end
end
if Input.trigger?(Input::SHIFT)
unless @buy_window.item.is_a?(RPG::Item)
Sound.play_decision
@item_stats.item = @buy_window.item
@buy_window.active = false
@item_stats.active = true
@item_stats.visible = true
else
Sound.play_buzzer
end
end
end
alias shift_update update
def update
super
update_menu_background
@help_window.update
@command_window.update
@gold_window.update
@dummy_window.update
@buy_window.update
@sell_window.update
@number_window.update
@status_window.update
if @command_window.active
update_command_selection
elsif @buy_window.active
update_buy_selection
elsif @sell_window.active
update_sell_selection
elsif @number_window.active
update_number_input
elsif @item_stats.active
update_stats
@item_stats.update
end
end
def update_stats
if Input.trigger?(Input::B)
@item_stats.visible = false
@item_stats.active = false
@buy_window.active = true
end
end
end


Customization
Included in script

Compatibility
Should be pretty compatible with most things since basically all i did was make a new window and made an alias
in the Shop_Buy window for update_buy_selection and start

Screenshots
V1.2


Installation
Above Main, it's plug and play

Credits
cr4200(me)

This post has been edited by cr4200: Jul 20 2009, 01:00 PM
Attached File(s)
Attached File  item_stats.txt ( 13.28K ) Number of downloads: 25
Attached File  Item_Stats_V1.2.txt ( 13.55K ) Number of downloads: 59
 
Go to the top of the page
 
+Quote Post
   
The Wizard 007
post Jun 4 2009, 04:29 PM
Post #2


Jack of all trades
Group Icon

Group: Revolutionary
Posts: 118
Type: Developer
RM Skill: Skilled




This is awesome. No one really has made an advanced shop window for VX. THe default is very simplistic, this adds a lot of dimension. I will definetely use this, thank you very much.


__________________________
Currently working on:

Underground Syndicate (mafioso/modern type RPG)
Mind Maze (old school dungeon crawler with a different feel)
Dragon Adventure (Dragon Quest type fangame with more customization)
Dark Grind (Survival horror RPG)
Go to the top of the page
 
+Quote Post
   
candlejack
post Oct 24 2009, 01:04 PM
Post #3


Level 3
Group Icon

Group: Member
Posts: 42
Type: Event Designer
RM Skill: Skilled




I like the script it works, I was just wondering if you could make the font smaller, my weapons' names are overlapping with the cost of the item. either way it's nice thanks for making.


__________________________
Go to the top of the page
 
+Quote Post
   
Xzygon
post Oct 24 2009, 01:26 PM
Post #4


Pineapple Inc's President and Creator of Duality Online
Group Icon

Group: Revolutionary
Posts: 554
Type: Writer
RM Skill: Skilled




@candlejack
Read the rules. I hate having to tell people this down.gif
Don't NECROPOST.
If you don't know what that is, you should have read the rules.
If you need help with this script, just ask in the Sub-Forum Script Support.

Edit--
Actually, since I'm bored, I just went through the script in the first post (V.1.2)
Look for the line
CODE
self.contents.font.size = **

And change that to the size you want.
Just mess with each
self.contents.font.size
you find and you'll get it eventually.

This post has been edited by Xzygon: Oct 24 2009, 01:29 PM


__________________________
Check out my game, Duality Online!
Duality Online






Blah
A saying that I DID NOT STEAL FROM KUNG FU PANDA!
Today is a Gift.
That's why they call it the Present.
You never know what's inside,
Because the Present is always changing.
~Made it up with my cuz 7 Years Ago, without the help of anybody else~


Don't read!
00110000001100010011000000110000001100010011000000110000001100000011000000
11000100110001001100000011000000110000001100000011000100110000001100010011000100
1
10000001100010011000000110000001100000011000000110001001100010011000000110000001
1
00000011000000110001001100000011000000110001001100000011000100110001001100000011
0
00000110000001100000011000100110000001100000011000000110000001100000011000000110
0
01001100010011000000110000001100010011000000110001001100000011000100110001001100
0
10011000000110000001100000011000000110000001100010011000100110000001100010011000
0
00110000001100010011000000110001001100010011000000110000001100000011000100110001
0
01100000011000000110001001100000011000000110000001100000011000000110000001100010
0
11000100110000001100000011000100110001001100000011000000110001001100010011000000
1
10000001100000011000000110001001100000011000100110001001100000011000100110000001
1
00000011000100110000001100010011000100110000001100010011000100110000001100000011
0
00000110000001100010011000000110000001100000011000000110000001100000011000100110
0
01001100000011000000110001001100010011000000110000001100010011000100110000001100
0
10011000100110001001100010011000000110001001100010011000100110000001100000011000
1
00110000001100000011000000110001001100000011000000110000001100000011000000110000
0
01100010011000100110000001100000011000100110000001100000011000000110001001100010
0
11000000110001001100010011000100110001001100000011000100110001001100010011000000
1
10001001100000011000100110000001100010011000100110000001100000011000000110001001
1
00000011000000110001001100010011000000110001001100010011000000110000001100000011
0
00100110001001100000011000000110001001100000011000100110000001100000011000100110
0
00001100000011000000110000001100000011000000110001001100010011000000110000001100
0
10011000000110000001100000011000100110001001100000011000000110001001100000011000
1
00110000001100010011000100110000001100000011000000110001001100010011000000110001
0
01100010011000100110000001100000011000100110000001100000011000100110001001100010
0
11000100110000001100000011000100110000001100010011000100110001001100000011000000
1
10000001100000011000000110001001100010011000100110000001100010011000000110000001
1
00000011000100110001001100000011000100110000001100000011000100110000001100010011
0
00100110000001100010011000100110001001100000011000000110001001100010011000000110
0
00001100010011000100110001001100000011000000110001001100000011000000110000001100
0
00011000000110000001100010011000100110001001100000011000100110000001100000011000
0
00110001001100010011000000110001001100000011000000110000001100000011000100110001
0
01100000011000100110000001100000011000100110000001100010011000100110001001100000
0
11000000110001001100010011000000110000001100010011000000110000001100000011000000
1
10000001100000011000100110001001100000011000000110000001100010011000000110000001
1
00010011000100110000001100010011000000110000001100010011000000110001001100010011
0
00000110001001100010011000100110000001100000011000100110001001100000011000000110
0
00001100000011000100110000001100010011000100110001001100000011000000110001001100
0
00011000000110001001100010011000100110001001100000011000000110001001100000011000
0
00110001001100000011000000110000001100000011000000110000001100010011000100110000
0
01100000011000000110001001100010011000000110001001100010011000000110001001100010
0
11000100110001001100000011000100110001001100000011000000110001001100000011000000
1
10000001100010011000100110000001100000011000100110000001100010011000000110000001
1
00010011000000110001001100010011000100110000





I support
Supporting


Go to the top of the page
 
+Quote Post
   

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

 

Lo-Fi Version Time is now: 20th May 2013 - 02:32 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker