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.

[VX]Rarity System, with items

Soooo....basically, I'm looking for a rarity system.

This is a script for RPG Maker XP done by Trickster, and I would like it if someone could convert it for me! Or make a new one. :P

Thanks.

Code:
class Window_Base < Window
def draw_item_name(item, x, y)
if item == nil
return
end
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
#--------------------------------------------------------------------------
# * Colored Text Edit [START]
#--------------------------------------------------------------------------
set_color(item)
#--------------------------------------------------------------------------
# * Colored Text Edit [END]
#--------------------------------------------------------------------------
self.contents.draw_text(x + 28, y, 212, 32, item.name)
self.contents.font.color = normal_color
end
#----------------------------------------------------------------------------
# * set_color : parameter item
# sets the color of the window font based on the element id of the item.
# the element ids reference the rarity of the item.
#----------------------------------------------------------------------------
def set_color(item)
if item.element_set.include?(10) # Uncommon
self.contents.font.color = Color.new(24, 244, 24) # Green
elsif item.element_set.include?(9) # Common
self.contents.font.color = Color.new(255, 255, 255) # White
elsif item.element_set.include?(11) # Rare
self.contents.font.color = Color.new(224, 224, 24) # Gold
elsif item.element_set.include?(12) # Epic
self.contents.font.color = Color.new( 12, 12, 255) # Blue
elsif item.element_set.include?(13) # Legendary
self.contents.font.color = Color.new(244, 24, 244) # Purple
elsif item.element_set.include?(14) # Artifact
self.contents.font.color = Color.new(244, 24, 24) # Red
else
self.contents.font.color = normal_color
end
end
end

class Window_Item < Window_Selectable
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
set_color(item)
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)
self.contents.font.color = normal_color
end
end

module RPG
class Armor

def element_set
return @guard_element_set
end

end
end
 

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