查看: 2118|回复: 2

[已经过期] 已会雪流星前辈的脚本来改大物品图标,求如何改光标

[复制链接]
梦石
0
星屑
896
在线时间
371 小时
注册时间
2008-1-13
回帖
110
发表于 2014-3-29 03:43:20 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
目前物品的光标只能占到物品图标的1半

1

1
未命名.JPG

点评

可能重新定义一下 line_height 就行了  发表于 2014-4-27 15:32
你需要重写一个 def item_rect(index) 的方法  发表于 2014-3-29 17:03
梦石
0
星屑
896
在线时间
371 小时
注册时间
2008-1-13
回帖
110
 楼主| 发表于 2014-3-29 19:23:25 | 显示全部楼层

本帖最后由 雪流星 于 2012-2-10 20:36 编辑


旧版:http://rpg.blue/forum.php?mod=viewthread&tid=79657

原本的版本中,没有使用 alias 去降低脚本冲突的可能。
而且VA和VX的绘制方法都有一些修改,所以直接重写一个通用的版本。

使用方法:
将图标文件放在 游戏根目录/Graphics/Icons 里面
在数据库的物品/武器/防具/技能/状态中的备注里面写 [icon 文件名](注意这点与旧版稍有不同)

2012-02-10 [关於VA]更新
* 忽然发现 VA 当中, Actor 和 Class 同样作为 BaseItem 的子类,也可以设定图标。
    所以将脚本稍做修改,可以使用 [icon X] 来设定图标。X 为图标的 index
    当然,这个设定只有角色和职业需要使用。(物品等可以这样设定,但是有需要吗?)
    具体要怎么用就看个人。

class RPG::BaseItem
  #--------------------------------------------------------------------------
  # ● 获取图标
  #--------------------------------------------------------------------------
  def get_icon
    self.note.split(/[\r\n]+/).each { |line|
      return $1 if line =~ /\[(?:icon) (\S+)\]/
    }
    return nil
  end
  #--------------------------------------------------------------------------
  # ● 图标 index
  #--------------------------------------------------------------------------
  alias draw_single_icon_icon_index icon_index
  def icon_index
    icon_index = get_icon
    # 如果有指定图标
    if icon_index && icon_index =~ /\d+/ # 如果指定的是數字
      @icon_index = icon_index.to_i # 轉換成數字
    elsif icon_index
      return icon_index # 返回指定图标文件名
    end
    return draw_single_icon_icon_index # 否则返回原本的图标 index
  end
end
class Window_Base
  #--------------------------------------------------------------------------
  # ● 绘制图标
  #--------------------------------------------------------------------------
  alias draw_single_icon_draw_icon draw_icon
  def draw_icon(icon_index, x, y, enabled = true)
    if icon_index.is_a?(Integer) # 判断是否为整数
      # 调用原本的绘制图标方法
      draw_single_icon_draw_icon(icon_index, x, y, enabled)
    else # 指定图标时
      bitmap = Cache.load_bitmap("Graphics/Icons/", icon_index)
      rect = Rect.new(0, 0, 24, 24)
      contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
    end
  end
end
复制代码

点评

这是我引用的脚本。重写一个 def item_rect(index) 的方法怎么弄啊,谢谢拉  发表于 2014-3-29 19:25
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部