I downloaded a Script and i was wondering how to implement my own twist to it. It works 100% like i want it to except
#======================================#
# RARITYNAME = "Rarity name here" # word you want to call the rarity/rating
#======================================#
ICONNAME = "low"
RARITYNAME = "Rating"
module RPG
class Item
def rarity
case id
#======================================#
# BEGIN CONFIG
#======================================#
when 1 then return 1
when 2,3 then return 3
when 32 then return 5
when 8 then return 2
#======================================#
# END CONFIG
#======================================#
end
return 1
end
end
class Weapon
def rarity
case id
#======================================#
# BEGIN CONFIG
#======================================#
when 1 then return 1
when 2 then return 3
when 32 then return 5
when 8 then return 2
#======================================#
# END CONFIG
#======================================#
end
return 1
end
end
class Armor
def rarity
case id
#======================================#
# BEGIN CONFIG
#======================================#
when 1 then return 1
when 2 then return 3
when 32 then return 5
when 8 then return 2
#======================================#
# END CONFIG
#======================================#
end
return 1
end
end
end
class Window_Item < Window_Selectable
def initialize
super(0, 64, 640, 352)
@column_max = 1
refresh
self.index = 0
if $game_temp.in_battle
self.y = 64
self.height = 256
self.back_opacity = 160
end
end
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(item.id)
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 1 * (288 + 32)
y = index / 1 * 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
item.rarity.times do |i|
src_rect = Rect.new(0, 0, 24, 24)
self.contents.blt(300 + 32 * i + 16, y + 3, RPG::Cache.icon(ICONNAME.to_s), src_rect)
end
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
end
class Window_ItemName < Window_Base
def initialize
super(0, 0, 320, 64)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 640, 32, "Item Name", 0)
end
end
class Window_Rating < Window_Base
def initialize
super(320, 0, 320, 64)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 640, 32, RARITYNAME, 0)
end
end
class Scene_Item
def main
@help_window = Window_Help.new
@help_window.y = 416
@xtrinfo = Window_ItemName.new
@rare = Window_Rating.new
@item_window = Window_Item.new
@item_window.help_window = @help_window
@target_window = Window_Target.new
@target_window.visible = false
@target_window.active = false
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@help_window.dispose
@rare.dispose
@xtrinfo.dispose
@item_window.dispose
@target_window.dispose
end
end
That code works 100% fine i just want to make it so if the rarity is from 1-3 its "low" from 4-6 its "med" and from 7-9 its "high", i have all three icons in the folder i just dont know how to make it so that it changes the icon depending on what the rarity is, cause when i go to do it, it says rarity is undefined. Any assistance would be much appreciated. And from what i've learned
ICONNAME = if rarity < 4 then
ICONNAME = "low"
else if
rarity >3 && rarity <7 then
ICONNAME = "med"
else
ICONNAME = "high"
end
end
that works in terms of Syntax and everything, just doesnt work in the bigger script.