设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1571|回复: 2
打印 上一主题 下一主题

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

[复制链接]

Lv2.观梦者

梦石
0
星屑
661
在线时间
372 小时
注册时间
2008-1-13
帖子
149
跳转到指定楼层
1
发表于 2014-3-29 03:43:20 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

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

未命名.JPG (133.71 KB, 下载次数: 17)

1

1

未命名.JPG (133.71 KB, 下载次数: 16)

未命名.JPG

点评

可能重新定义一下 line_height 就行了  发表于 2014-4-27 15:32
你需要重写一个 def item_rect(index) 的方法  发表于 2014-3-29 17:03

Lv2.观梦者

梦石
0
星屑
661
在线时间
372 小时
注册时间
2008-1-13
帖子
149
2
 楼主| 发表于 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
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-25 05:33

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表