KItemDesc XP Zilsel Version
#1
KItemDesc XP
Zilsel Version
version 1.0.2

by Kyonides


Introduction

This scriptlet just pretends to implement zlsl's need of a different item description menu by adding an extra window to display an icon or picture plus the hero's comment.

You may also want to activate a global switch to show skills as if they were simple items! Shocked Don't worry! You can deactivate that at any given time!

Warning: The player cannot change this on his own so you would need to let them use an event as a trigger.

Just paste it in a script section above Main but below Scene_Debug.

Screenshot

[Image: kitemdescxpzisel01.jpg]

The Script

XP Version
Code:
# * KItemDesc XP Zilsel Version
#   Scripter : Kyonides Arkanthes
#   v1.0.2 - 2019-11-24

# This scriptlet allows you to show custom icons and comments in the Inventory
# Menu scene. It will show the party leader's opinion on a given item.
# Place large icons in the Graphics/Pictures directory if you ever use them!
# You may also allow the player to check out his or her skills on the same menu
# by activating a global switch via an event command. It can be deactivated at
# any given time!

module KItemDesc
  INCLUDE_SKILLS_SWITCH_ID = 1
  PICTURE_X = 12
  PICTURE_Y = 12
  PICTURE_CENTER_X = true # true - Ignores X coordinate, false - uses X
  PICTURE_CENTER_Y = true # true - Ignores Y coordinate, false - uses Y
  COMMENTS_Y = 180
  ACTOR_OPINION_LABEL = "%s's Opinion"
  # Comments may include newlines alias \n if needed.
  DEFAULT_COMMENT = "The hero has nothing to say\nabout this"
  @comments = {} # There's no need to edit this line.
  # [[Kind, ID]] = { ActorID => "Hero's comment on current item", etc. }
  # Kind Options - :item, :weapon, :armor, :skill - Check the following example.
  @comments[[:item, 1]] = {
    1 => "You know, I'll never need potions\nfor I'm invincible!"
  }
  @comments.default = {} # Do not touch this! It will eat you alive!
  def self.comments() @comments end
end

class Game_Party
  def leader() @actors[0] end
end

class ItemDescWindow < Window_Base
  include KItemDesc
  def initialize
    super(320, 64, 320, 416)
    self.contents = Bitmap.new(width - 32, height - 32)
  end

  def refresh(new_item)
    return if @item == new_item
    @item = new_item
    c = self.contents
    c.clear
    return if @item.nil?
    lid = $game_party.leader.id
    name = $game_party.leader.name
    key = [@item.type, @item.id]
    comments = KItemDesc.comments[key][lid] || DEFAULT_COMMENT
    comments = comments.split("\n")
    text = sprintf(ACTOR_OPINION_LABEL, name)
    icon_name = @item.icon_name
    begin
      bit = RPG::Cache.picture(icon_name)
    rescue
      bit = RPG::Cache.icon(icon_name)
    end
    rect = Rect.new(0, 0, bit.width, bit.height)
    icon_x = PICTURE_CENTER_X ? 288 / 2 - bit.width / 2 : PICTURE_X
    icon_y = PICTURE_CENTER_Y ? COMMENTS_Y / 2 - bit.height / 2 : PICTURE_Y
    c.blt(icon_x, icon_y, bit, rect)
    c.draw_text(0, COMMENTS_Y, 288, 24, text)
    comments.size.times do |n|
      c.draw_text(0, COMMENTS_Y + 28 + n * 24, 288, 24, comments[n])
    end
  end
end

module RPG
  class Item
    def type() :item end
  end

  class Weapon
    def type() :weapon end
  end

  class Armor
    def type() :armor end
  end

  class Skill
    def type() :skill end
  end
end

class Game_Party
  def item_keys() @items.keys.sort end
  def weapon_keys() @weapons.keys.sort end
  def armor_keys() @armors.keys.sort end
  def skills() @actors.map{|a| a.skills } end
  def skill_number(item_id) skills.select{|n| n == item_id}.size end
end

class Window_Item
  alias :kyon_itemdesc_win_item_up_help :update_help
  def initialize
    battle = $game_temp.in_battle
    w = battle ? 640 : 320
    super(0, 64, w, 416)
    refresh
    self.index = 0
    return unless battle
    @column_max = 2
    self.y = 64
    self.height = 256
    self.back_opacity = 160
  end

  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    $game_party.item_keys.each{|i| @data << $data_items[i] }
    unless $game_temp.in_battle
      $game_party.weapon_keys.each{|i| @data << $data_weapons[i] }
      $game_party.armor_keys.each{|i| @data << $data_armors[i] }
      if $game_switches[KItemDesc::INCLUDE_SKILLS_SWITCH_ID]
        $game_party.skills.each{|i| @data << $data_skills[i] }
      end
    end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      @item_max.times{|i| draw_item(i) }
    end
    @desc_window.refresh(@data[@index]) if @desc_window
  end

  def draw_item(index)
    item = @data[index]
    number = current_item_number(item.type, item.id)
    usable = (item.type == :item and $game_party.item_can_use?(item.id))
    self.contents.font.color = usable ? normal_color : disabled_color
    x = 4 + index % @column_max * (288 + 32)
    y = index / @column_max * 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)
  end

  def current_item_number(item_type, item_id)
    case item_type
    when :item
      $game_party.item_number(item_id)
    when :weapon
      $game_party.weapon_number(item_id)
    when :armor
      $game_party.armor_number(item_id)
    when :skill
      $game_party.skill_number(item_id)
    end
  end

  def desc_window=(new_window)
    @desc_window = new_window
    @desc_window.refresh(@data[@index])
  end

  def update_help
    kyon_itemdesc_win_item_up_help
    @desc_window.refresh(@data[@index]) if @desc_window
  end
end

class Scene_Item
  def main
    @item_desc = ItemDescWindow.new
    @help_window = Window_Help.new
    @item_window = Window_Item.new
    @item_window.help_window = @help_window
    @item_window.desc_window = @item_desc
    @target_window = Window_Target.new
    @target_window.visible = false
    @target_window.active = false
    Graphics.transition
    main_loop until $scene != self
    Graphics.freeze
    @item_desc.dispose
    @help_window.dispose
    @item_window.dispose
    @target_window.dispose
  end

  def main_loop
    Graphics.update
    Input.update
    update
  end
end


Terms & Conditions

Free for use in any kind of videogame.
You must include my nickname in your game credits.
Give me a free copy of your completed game if you include at least 2 of my scripts! Laughing + Tongue sticking out
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }
#2
There is a flaw with the system. You use the ITEM ID to distinguish between one item and another. That's fine insofar as the ITEM database. But you also have ITEM IDs for Weapons and Armor. Using an ITEM ID of #2, I would have the same description for a high potion as I would an Iron Sword.

And you didn't add the '< Window_Selectable' to the Window_Item class, separating it from its Selectable parent class.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)

[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png]    [Image: liM4ikn.png]    [Image: fdzKgZA.png]    [Image: sj0H81z.png]
[Image: QL7oRau.png]    [Image: uSqjY09.png]    [Image: GAA3qE9.png]    [Image: 2Hmnx1G.png]    [Image: BwtNdKw.png%5B]
  Above are clickable links
Reply }
#3
Bug Fix + Improvement

Yes, guys! I have come back to let you know I smashed Wulfo's flea Laughing and implemented a new feature, listing skills as if they were simple items! Shocked

So yes, you will be able to check on items, weapons, armors and skills, though you will only find items there if you're already fighting for survival... Confused

Regarding Wulfo's Final Comment

I gotta say that his statement makes no sense. Nobody can separate an existing Ruby Ruby class from its predefined parent class. If it has been defined ONCE, there is NO NEED to keep repeating yourself over and over again.

What happened there was that back in 2019 nobody had figured out that the only time you need to ever establish a parent class is just when you are creating a given child class. And this is an one time event, my dear friends. From that moment onward, you only need to reopen that class as many times as needed. Actually, this last statement is the default mode for all Ruby Ruby modules, especially because they have no parent class. Modules can only have nested classes or modules and that's all.
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }
#4
It Turned Out This Spell Implementation Needed a Spell Troubleshooting

Nope, I'm not talking about my stories here! Laughing It just happens that after staying awake till late and waking up a few hours later, I did a few things to improve the script like including a list of skills... Yeah, that was what I thought at first. Confused Don't look at me! Sad I did my best taking in consideration I'm not being paid for this. Confused Plus, I had to prepare for a long trip to the Caribbean! Shocked 

But yeah, now skills should be listed as well this time. Laughing

Don't forget to activate the switch! Shocked
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }
#5
Something Had Been VeXing Me Lately...

I guess it was the lack of a VX port, guys! Shocked Don't worry! Happy I've brought you one just in case you ever felt as if you had been left behind. Now you can enjoy the convenience of showing actor's comments as well. Grinning

Yes! I've included screenshots on the first post and for both ports! Shocked
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   CTB - A Final Fantasy X-like Battle System, Version 3.2 Charlie Fleed 572 767,609 05-19-2016, 05:38 PM
Last Post: Starmage
   Equipment Upgrade System by Charlie Fleed, Version 1.2 Charlie Fleed 145 213,247 04-11-2014, 01:19 AM
Last Post: Gardesion
   Individual Battle Commands by Charlie Fleed, Version 1.0 Charlie Fleed 3 11,391 01-25-2014, 12:15 PM
Last Post: Charlie Fleed
   Sideview Battle System Tankentai XP - Version 2.2xp Victor Sant 22 48,728 03-03-2013, 05:37 PM
Last Post: DerVVulfman
   Auto Populate Maps, Version 0.5 Charlie Fleed 14 27,424 03-17-2012, 03:04 PM
Last Post: LilyKnight
   Jobs System by Charlie Fleed - Version 0.2 Charlie Fleed 0 5,509 10-13-2010, 05:07 PM
Last Post: Charlie Fleed
   XAS Action Battle System 3.72 *NEW VERSION* G.I. Toez 3 17,786 07-05-2010, 03:01 PM
Last Post: G.I. Toez
   Charlie's Passability Mini-Map, Version 0.4 Charlie Fleed 20 36,501 06-14-2010, 03:56 PM
Last Post: Charlie Fleed
   FFIX Skills Activation System, Version 0.3 Charlie Fleed 51 74,191 03-21-2010, 10:34 PM
Last Post: Charlie Fleed
   States Activation System aka State-Based Passive Augments, Version 0.2 Charlie Fleed 7 13,063 03-06-2010, 09:26 PM
Last Post: fgsfds



Users browsing this thread: 1 Guest(s)