じ☆ve冰风 发表于 5 天前

KItemDesc VX

KItemDesc VX Zilsel Version
version 1.0.2

by Kyonides Arkanthes​


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





The Script
                Code:       
# * KItemDesc VX Zilsel Version#   Scripter : Kyonides Arkanthes#   v1.0.2 - 2019-11-30# 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.# Optional: Place large icons in Graphics/Pictures folder with their item names.# 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 KItemDescINCLUDE_SKILLS_SWITCH_ID = 1PICTURE_X = 12PICTURE_Y = 12PICTURE_CENTER_X = true # true - Ignores X coordinate, false - uses XPICTURE_CENTER_Y = true # true - Ignores Y coordinate, false - uses YCOMMENTS_Y = 180ACTOR_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.# [] = { 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\npotions for I'm invincible!"}@comments.default = {} # Do not touch this! It will eat you alive!def self.comments() @comments endendmodule Cachedef self.picture(filename) load_bitmap('Graphics/Pictures', filename) endendclass Game_Partydef leader() $game_actors[@actors] endendclass ItemDescWindow < Window_Baseinclude KItemDescdef initialize    super(272, 56, 272, 360)    self.contents = Bitmap.new(width - 32, height - 32)enddef 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 || DEFAULT_COMMENT    comments = comments.split("\n")    text = sprintf(ACTOR_OPINION_LABEL, name)    w = width - 32    begin      bit = Cache.picture(@item.name)      rect = Rect.new(0, 0, bit.width, bit.height)      icon_x = PICTURE_CENTER_X ? w / 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)    rescue      icon_x = PICTURE_CENTER_X ? w / 2 - 12 : PICTURE_X      icon_y = PICTURE_CENTER_Y ? COMMENTS_Y / 2 - 12 : PICTURE_Y      draw_icon(@item.icon_index, icon_x, icon_y)    end    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)    endendendmodule RPGclass Item    def type() :item endendclass Weapon    def type() :weapon endendclass Armor    def type() :armor endendclass Skill    def type() :skill endendendclass Game_Partydef item_number(item)    number = case item    when RPG::Item then @items    when RPG::Weapon then @weapons    when RPG::Armor then @armors    when RPG::Skill then skill_number(item.id)    end    number || 0enddef item_keys() @items.keys.sort enddef weapon_keys() @weapons.keys.sort enddef armor_keys() @armors.keys.sort enddef skills() @actors.map{|a| a.skills } enddef skill_number(item_id) skills.select{|n| n == item_id}.size endendclass Window_Itemalias :kyon_itemdesc_win_item_up_help :update_helpdef initialize(x, y, width, height)    super(x, y, width, height)    self.index = 0    @column_max = 2 if $game_temp.in_battle    refreshenddef refresh    @data = []    $game_party.item_keys.each do |i|      @data << $data_items      self.index = @data.size - 1 if i == $game_party.last_item_id    end    unless $game_temp.in_battle      $game_party.weapon_keys.each{|i| @data << $data_weapons }      $game_party.armor_keys.each{|i| @data << $data_armors }      if $game_switches      $game_party.skills.each{|i| @data << $data_skills }      end    end    @data << nil if include?(nil)    @item_max = @data.size    create_contents    @item_max.times{|i| draw_item(i) }    @desc_window.refresh(@data[@index]) if @desc_windowenddef desc_window=(new_window)    @desc_window = new_window    @desc_window.refresh(@data[@index])enddef update_help    kyon_itemdesc_win_item_up_help    @desc_window.refresh(@data[@index]) if @desc_windowendendclass Scene_Itemalias :kyon_itemdesc_scn_item_term :terminatedef start    create_menu_background    @viewport = Viewport.new(0, 0, 544, 416)    @item_desc = ItemDescWindow.new    @help_window = Window_Help.new    @help_window.viewport = @viewport    @item_window = Window_Item.new(0, 56, 272, 360)    @item_window.viewport = @viewport    @item_window.active = false    @item_window.help_window = @help_window    @item_window.desc_window = @item_desc    @target_window = Window_MenuStatus.new(0, 0)    hide_target_windowenddef terminate    kyon_itemdesc_scn_item_term    @item_desc.disposeendend


Terms & Conditions

Free for use in any kind of videogame, but you must include my nickname and the URL in your game credits.


本贴来自国际rpgmaker官方论坛作者:kyonides处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/kitemdesc-vx.115824/
页: [1]
查看完整版本: KItemDesc VX