查看: 3566|回复: 5

[已经过期] 金银铜系统·仅需一个icon·比例1:100

[复制链接]
梦石
0
星屑
701
在线时间
511 小时
注册时间
2012-4-8
回帖
193
发表于 2015-2-13 20:33:44 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 黑白界 于 2015-3-8 11:01 编辑

https://rpg.blue/forum.php?mod=viewthread&tid=344109
已经有前辈做过了类似的,不过需要三张图片

于是我做了一个只需一个icon的,不需要素材,商店显示有效
在最开始设置 $icon_jinqian = 你选择的icon的编号 就好
金1.png
金2.png
金3.png
[pre lang="ruby"]$icon_jinqian=  361  #金钱图标的编号
class Window_Base
  def draw_icon2(icon_index,xx,yy)
    bitmap = Cache.system("Iconset")
    rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
    b = Bitmap.new(24,24)
    b.blt(0, 0, bitmap, rect, 255)
    for x in 0..23
      for y in 0..23
        next if b.get_pixel(x, y).alpha == 0
        c=b.get_pixel(x, y)
        m = (c.red + c.green + c.blue) / 3
        b.set_pixel(x, y, Color.new(m, m, m, c.alpha))
      end
    end
    rect2 = Rect.new(0, 0, 24, 24)
    contents.blt(xx, yy, b,rect2, 255)
  end
  def draw_icon3(icon_index,xx,yy)
    bitmap = Cache.system("Iconset")
    rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
    b = Bitmap.new(24,24)
    b.blt(0, 0, bitmap, rect, 255)
    for x in 0..23
      for y in 0..23
        next if b.get_pixel(x, y).alpha == 0
        c = b.get_pixel(x, y)
        m = (c.red + c.green + c.blue) / 3-30
        b.set_pixel(x, y, Color.new(c.red, m, m, c.alpha))
      end
    end
    rect2 = Rect.new(0, 0, 24, 24)
    contents.blt(xx, yy, b,rect2, 255)
  end
  def draw_currency_value(unit,s,x,y,width)
    if unit >=10000
      i1=unit/10000
      i2=(unit-i1*10000)/100
      i3=unit-i1*10000-i2*100
    elsif unit >=100
      i1=0
      i2=unit/100
      i3=unit-i2*100
    else
      i1=0
      i2=0
      i3=unit
    end
    cx1 = text_size(i1).width+4
    cx2 = text_size(i2).width+4
    cx3 = text_size(i3).width+4
    self.contents.fill_rect(x, y,width, 24, Color.new(0,0,0,200))
    self.contents.fill_rect(x, y,width, 1, Color.new(200,200,200,200))
    self.contents.fill_rect(x, y,1, 24, Color.new(200,200,200,200))
    self.contents.fill_rect(x, y+23,width, 1, Color.new(200,200,200,200))
    self.contents.fill_rect(x+width, y,1, 24, Color.new(200,200,200,200))
    draw_icon($icon_jinqian, x+width-60-cx3-cx2, y)
    draw_icon2($icon_jinqian, x+width-42-cx3, y)
    draw_icon3($icon_jinqian, x+width-24, y)
    self.contents.font.color=Color.new(150,150,50)
    self.contents.font.size=20
    draw_text(x+width-cx3-54-cx2-cx1, y, cx1, 24,i1)
    draw_text(x+width-cx3-36-cx2, y, cx2, 24,i2)
    draw_text(x+width-cx3-18, y, cx3, 24,i3)
  end
end[/pre]
兼容VIPArcher装备帮助增强的脚本
[pre lang="ruby"]
$huobijin=      "金"
$huobiyin=      "银"
$huobitong=     "铜"
class Window_Help_Ex < Window_Base
  def set_item(item)

    if item == nil

      set_text("")

      return

    end

    @xtext = ""

    if $VIPArcherScript[:itemcolor] # require 物品描绘颜色脚本

      @xtext = "\\c[16]名称:\\c[#{VIPArcher::ItemColor::Color_Lv[item.color]}]" +

      "#{item.name}  #{item.color if item.color != 0}#{"★" if item.color != 0}\\c[0]\n"

    else

      @xtext = "\\c[16]名称:\\c[0]#{item.name}\n"

    end

    @xtext += "\\c[16]介绍:\\c[0]#{item.description}\n"

    if $VIPArcherScript[:load]      # require 队伍负重脚本

      @xtext += "\\c[16]售价:#{item.price} 重量:#{item.load}\\c[0]\n"

    else
    unit=item.price
    if unit >=10000
      i1=unit/10000
      i2=(unit-i1*10000)/100
      i3=unit-i1*10000-i2*100
    elsif unit >=100
      i1=0
      i2=unit/100
      i3=unit-i2*100
    else
      i1=0
      i2=0
      i3=unit
    end
    a1="#{$huobijin}"
    a2="#{$huobiyin}"
    a3="#{$huobitong}"
    if i1==0
      i1=nil
      a1=nil
    end
    if i2==0
      i2=nil
      a2=nil
    end
    if i3==0
      i3=nil
      a3=nil
    end
    @xtext += item.price == 0 ? "\\c[16]售价:\\c[14]无法出售\\c[0]\n":"\\c[16]售价:#{i1}#{a1}#{i2}#{a2}#{i3}#{a3}\\c[0]\n"

    end if item.is_a?(RPG::EquipItem) || item.is_a?(RPG::Item)

    @xtext += VIPArcher::Equipplus.getequiphelp(item) if item.is_a?(RPG::EquipItem)

    @xtext += VIPArcher::Equipplus.getskillhelp(item) if item.is_a?(RPG::Skill)

    @xtext += VIPArcher::Equipplus.getitemhelp(item) if item.is_a?(RPG::Item)

    if $VIPArcherScript[:exdrop_rate]   # require 队伍掉率扩展

      @xtext += "\\c[#{$2.to_i > 0 ? UP : DOWN}]#{$1}掉率: #{$2}%\\c[0]\n" if

      item.note =~ /<(\W+)掉率:\s*([0-9+.-]+)%>/i

    end if item.is_a?(RPG::EquipItem) || item.is_a?(RPG::Skill)

    @xtext = @xtext[0,@text.size - 2] if @xtext[@xtext.size - 2,2] == "\n"

  end
end
[/pre]
武侠|养成|战棋游戏《以武证道》头秃开发中...
开发日记在此

…あたしは天

梦石
0
星屑
2308
在线时间
4033 小时
注册时间
2010-10-4
回帖
10548

开拓者贵宾

发表于 2015-2-13 20:41:22 | 显示全部楼层
所以说不要用 for 循环…… 你看,越界了吧

bitmap.width.times 明明更好用的= =
回复

使用道具 举报

梦石
0
星屑
701
在线时间
511 小时
注册时间
2012-4-8
回帖
193
 楼主| 发表于 2015-2-13 20:43:34 | 显示全部楼层
taroxd 发表于 2015-2-13 20:41
所以说不要用 for 循环…… 你看,越界了吧

bitmap.width.times 明明更好用的= = ...

没太懂。。什么叫越界?
bitmap.width.times也不懂是什么意思,945的教程里没提过。。
武侠|养成|战棋游戏《以武证道》头秃开发中...
开发日记在此
回复

使用道具 举报

…あたしは天

梦石
0
星屑
2308
在线时间
4033 小时
注册时间
2010-10-4
回帖
10548

开拓者贵宾

发表于 2015-2-13 20:44:52 | 显示全部楼层
本帖最后由 taroxd 于 2015-2-13 20:46 编辑
黑白界 发表于 2015-2-13 20:43
没太懂。。什么叫越界?
bitmap.width.times也不懂是什么意思,945的教程里没提过。。 ...


bitmap 宽度只有 24,你却访问到了 25。
这个错误应该是被 RM 抑制了,所以你才没有发现。但如果你用数组,这种基本上是要报错的。

评分

参与人数 1星屑 +1 收起 理由
黑白界 + 1 忘了从0开始数了..话说那教程也写错了...

查看全部评分

回复

使用道具 举报

梦石
0
星屑
34457
在线时间
5096 小时
注册时间
2012-11-19
回帖
4715

开拓者

发表于 2015-2-14 07:54:13 | 显示全部楼层
直接弄三张不同颜色的 ICON 显示,也不用这样麻烦的去逐一取得颜色并改变。
如果金钱窗口刷新比较频繁的话,掉帧可能会很严重的。

点评

可是做三张不同颜色的icon,还要塞进一个iconset,好麻烦的。。我比较喜欢即插即用。。。  发表于 2015-2-14 12:51
正常情况不会去刷新金钱窗口的吧= =  发表于 2015-2-14 08:09
xp vx va mv  va mz 各类型脚本/插件定制
回复

使用道具 举报

梦石
0
星屑
9292
在线时间
2504 小时
注册时间
2011-5-20
回帖
14521

开拓者

发表于 2015-2-14 17:50:30 | 显示全部楼层
taroxd 发表于 2015-2-13 03:44
bitmap 宽度只有 24,你却访问到了 25。
这个错误应该是被 RM 抑制了,所以你才没有发现。但如果你用数组 ...

bitmap.width.times的times是数量还是什么···
[img]http://service.t.sina.com.cn/widget/qmd/5339802982/c02e16bd/7.png
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部