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

Project1

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

[已经解决] 有关P叔的一个属性装备脚本问题

[复制链接]

Lv4.逐梦者

梦石
0
星屑
19299
在线时间
3075 小时
注册时间
2013-1-11
帖子
1288
跳转到指定楼层
1
发表于 2015-11-6 20:16:43 | 显示全部楼层 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 张咚咚 于 2015-11-7 12:41 编辑

只知道通过脚本获取一个带有属性的武器,怎么样可以在商店里购买属性武器呢?







Project1.zip (260.68 KB, 下载次数: 84)

点评

尽量别一帖多问  发表于 2015-11-15 11:52

Lv4.逐梦者

梦石
0
星屑
19299
在线时间
3075 小时
注册时间
2013-1-11
帖子
1288
2
 楼主| 发表于 2015-11-7 20:47:00 | 显示全部楼层
不能沉啊!!顶起来!!
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
19299
在线时间
3075 小时
注册时间
2013-1-11
帖子
1288
3
 楼主| 发表于 2015-11-13 09:09:48 | 显示全部楼层
正太君 发表于 2015-11-11 22:18
这个问题不是一两句脚本就能解决的...
由于脚本改动的地方比较多,还添加了部分脚本,所以这里就不上脚本了 ...

买的装备角色好像不能穿。。
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
19299
在线时间
3075 小时
注册时间
2013-1-11
帖子
1288
4
 楼主| 发表于 2015-11-14 10:22:15 | 显示全部楼层
本帖最后由 张咚咚 于 2015-11-14 10:44 编辑
正太君 发表于 2015-11-13 16:57
利用劳动课来机房帮你修脚本...


谢谢你,嗯,还有最后一个问题。

就是卖装备时,它显示属性增减正常,买的时候只能以普通属性增减,怎么把附加属性也算进去呢。





RUBY 代码复制
  1. #==============================================================================
  2. # ■ Window_ShopStatus
  3. #------------------------------------------------------------------------------
  4. #  商店画面、显示物品所持数与角色装备的窗口。
  5. #==============================================================================
  6.  
  7. class Window_ShopStatus < Window_Base
  8.   #--------------------------------------------------------------------------
  9.   # ● 初始化对像
  10.   #     x      : 窗口 X 座标
  11.   #     y      : 窗口 Y 座标
  12.   #--------------------------------------------------------------------------
  13.   def initialize(x, y)
  14.     super(x, y, 240, 360)
  15.     @item = nil
  16.     refresh
  17.   end
  18.   #--------------------------------------------------------------------------
  19.   # ● 刷新
  20.   #--------------------------------------------------------------------------
  21.   def refresh
  22.     self.contents.clear
  23.     if @item != nil
  24.       number = $game_party.item_number(@item)
  25.       self.contents.font.color = system_color
  26.       self.contents.draw_text(4, 0, 200, WLH, Vocab::Possession)
  27.       self.contents.font.color = normal_color
  28.       self.contents.draw_text(4, 0, 200, WLH, number, 2)
  29.       for actor in $game_party.members
  30.         x = 4
  31.         y = WLH * (2 + actor.index * 2)
  32.         draw_actor_parameter_change(actor, x, y)
  33.       end
  34.     end
  35.   end
  36.   #--------------------------------------------------------------------------
  37.   # ● 绘制角色当前装备和能力值
  38.   #     actor : 角色
  39.   #     x     : 绘制点 X 座标
  40.   #     y     : 绘制点 Y 座标
  41.   #--------------------------------------------------------------------------
  42.   def draw_actor_parameter_change(actor, x, y)
  43.     return if @item.is_a?(RPG::Item)
  44.     enabled = actor.equippable?(@item)
  45.     self.contents.font.color = normal_color
  46.     self.contents.font.color.alpha = enabled ? 255 : 128
  47.     self.contents.draw_text(x, y, 200, WLH, "")
  48.     self.contents.draw_text(x, y + WLH * 1, 200, WLH, "气血上限")
  49.     self.contents.draw_text(x, y + WLH * 2, 200, WLH, "法力上限")
  50.     self.contents.draw_text(x, y + WLH * 3, 200, WLH, "攻击")
  51.     self.contents.draw_text(x, y + WLH * 4, 200, WLH, "防御")
  52.     self.contents.draw_text(x, y + WLH * 5, 200, WLH, "抗魔")
  53.     self.contents.draw_text(x, y + WLH * 6, 200, WLH, "速度")
  54.     self.contents.draw_text(x, y + WLH * 7, 200, WLH, "暴击率")
  55.     self.contents.draw_text(x, y + WLH * 8, 200, WLH, "闪避率")
  56.  
  57.     if @item.is_a?(RPG::Weapon)
  58.       item1 = weaker_weapon(actor)
  59.     elsif actor.two_swords_style and @item.kind == 0
  60.       item1 = nil
  61.     else
  62.       item1 = actor.equips[1 + @item.kind]
  63.     end
  64.  
  65.       draw_item_name(item1, x, y, enabled)
  66.  
  67.       maxhp1 = item1 == nil ? 0 : item1.maxhp
  68.       maxhp2 = @item == nil ? 0 : @item.maxhp
  69.       change = maxhp2 - maxhp1
  70.       self.contents.font.color = Color.new(0, 255, 0, 255) if change > 0     #绿色(+)
  71.       self.contents.font.color = Color.new(255, 255, 255, 255) if change == 0 #白色(=)
  72.       self.contents.font.color = Color.new(128, 0, 0, 255) if change < 0     #红色(-)
  73.       self.contents.draw_text(x, y + WLH * 1, 200, WLH, sprintf("%+d", change), 2)
  74.  
  75.       maxmp1 = item1 == nil ? 0 : item1.maxmp
  76.       maxmp2 = @item == nil ? 0 : @item.maxmp
  77.       change = maxmp2 - maxmp1
  78.       self.contents.font.color = Color.new(0, 255, 0, 255) if change > 0     #绿色(+)
  79.       self.contents.font.color = Color.new(255, 255, 255, 255) if change == 0 #白色(=)
  80.       self.contents.font.color = Color.new(128, 0, 0, 255) if change < 0     #红色(-)
  81.       self.contents.draw_text(x, y + WLH * 2, 200, WLH, sprintf("%+d", change), 2)
  82.  
  83.       atk1 = item1 == nil ? 0 : item1.atk
  84.       atk2 = @item == nil ? 0 : @item.atk
  85.       change = atk2 - atk1
  86.       self.contents.font.color = Color.new(0, 255, 0, 255) if change > 0     #绿色(+)
  87.       self.contents.font.color = Color.new(255, 255, 255, 255) if change == 0 #白色(=)
  88.       self.contents.font.color = Color.new(128, 0, 0, 255) if change < 0     #红色(-)
  89.       self.contents.draw_text(x, y + WLH * 3, 200, WLH, sprintf("%+d", change), 2)
  90.  
  91.       def1 = item1 == nil ? 0 : item1.def
  92.       def2 = @item == nil ? 0 : @item.def
  93.       change = def2 - def1
  94.       self.contents.font.color = Color.new(0, 255, 0, 255) if change > 0     #绿色(+)
  95.       self.contents.font.color = Color.new(255, 255, 255, 255) if change == 0 #白色(=)
  96.       self.contents.font.color = Color.new(128, 0, 0, 255) if change < 0     #红色(-)
  97.       self.contents.draw_text(x, y + WLH * 4, 200, WLH, sprintf("%+d", change), 2)
  98.  
  99.       spi1 = item1 == nil ? 0 : item1.spi
  100.       spi2 = @item == nil ? 0 : @item.spi
  101.       change = spi2 - spi1
  102.       self.contents.font.color = Color.new(0, 255, 0, 255) if change > 0     #绿色(+)
  103.       self.contents.font.color = Color.new(255, 255, 255, 255) if change == 0 #白色(=)
  104.       self.contents.font.color = Color.new(128, 0, 0, 255) if change < 0     #红色(-)
  105.       self.contents.draw_text(x, y + WLH * 5, 200, WLH, sprintf("%+d", change), 2)
  106.  
  107.       agi1 = item1 == nil ? 0 : item1.agi
  108.       agi2 = @item == nil ? 0 : @item.agi
  109.       change = agi2 - agi1
  110.       self.contents.font.color = Color.new(0, 255, 0, 255) if change > 0     #绿色(+)
  111.       self.contents.font.color = Color.new(255, 255, 255, 255) if change == 0 #白色(=)
  112.       self.contents.font.color = Color.new(128, 0, 0, 255) if change < 0     #红色(-)
  113.       self.contents.draw_text(x, y + WLH * 6, 200, WLH, sprintf("%+d", change), 2)
  114.  
  115.       hit1 = item1 == nil ? 0 : item1.hit
  116.       hit2 = @item == nil ? 0 : @item.hit
  117.       change = hit2 - hit1
  118.       self.contents.font.color = Color.new(0, 255, 0, 255) if change > 0     #绿色(+)
  119.       self.contents.font.color = Color.new(255, 255, 255, 255) if change == 0 #白色(=)
  120.       self.contents.font.color = Color.new(128, 0, 0, 255) if change < 0     #红色(-)
  121.       self.contents.draw_text(x, y + WLH * 7, 200, WLH, sprintf("%+d", change), 2)
  122.  
  123.       eva1 = item1 == nil ? 0 : item1.eva
  124.       eva2 = @item == nil ? 0 : @item.eva
  125.       change = eva2 - eva1
  126.       self.contents.font.color = Color.new(0, 255, 0, 255) if change > 0     #绿色(+)
  127.       self.contents.font.color = Color.new(255, 255, 255, 255) if change == 0 #白色(=)
  128.       self.contents.font.color = Color.new(128, 0, 0, 255) if change < 0     #红色(-)
  129.       self.contents.draw_text(x, y + WLH * 8, 200, WLH, sprintf("%+d", change), 2)
  130.  
  131.   end
  132.   #--------------------------------------------------------------------------
  133.   # ● 获取双刀派角色所装备的武器中较弱的武器
  134.   #     actor : 角色
  135.   #--------------------------------------------------------------------------
  136.   def weaker_weapon(actor)
  137.     if actor.two_swords_style
  138.       weapon1 = actor.weapons[0]
  139.       weapon2 = actor.weapons[1]
  140.       if weapon1 == nil or weapon2 == nil
  141.         return nil
  142.       elsif weapon1.atk < weapon2.atk
  143.         return weapon1
  144.       else
  145.         return weapon2
  146.       end
  147.     else
  148.       return actor.weapons[0]
  149.     end
  150.   end
  151.   #--------------------------------------------------------------------------
  152.   # ● 设置物品
  153.   #     item : 新物品
  154.   #--------------------------------------------------------------------------
  155.   def item=(item)
  156.     if @item != item
  157.       @item = item
  158.       refresh
  159.     end
  160.   end
  161. end





RUBY 代码复制
  1. #==============================================================================
  2. # ■ Window_ShopBuy
  3. #------------------------------------------------------------------------------
  4. #  商店画面、浏览显示可以购买的商品的窗口。
  5. #==============================================================================
  6.  
  7. class Window_ShopBuy < Window_Selectable
  8.   #--------------------------------------------------------------------------
  9.   # ● 初始化对像
  10.   #     x      : 窗口 X 座标
  11.   #     y      : 窗口 Y 座标
  12.   #--------------------------------------------------------------------------
  13.   def initialize(x, y)
  14.     super(x, y, 304, 360)
  15.     @shop_goods = $game_temp.shop_goods
  16.     refresh
  17.     self.index = 0
  18.   end
  19.   #--------------------------------------------------------------------------
  20.   # ● 获取商品
  21.   #--------------------------------------------------------------------------
  22.   def item
  23.     return @data[self.index]
  24.   end
  25.   #--------------------------------------------------------------------------
  26.   # ● 刷新
  27.   #--------------------------------------------------------------------------
  28.   def refresh
  29.     @data = []
  30.     unless $game_switches[1] # 控制开关必须和这里一致...
  31.       for goods_item in @shop_goods
  32.         case goods_item[0]
  33.         when 0
  34.           item = $data_items[goods_item[1]]
  35.         when 1
  36.           item = $base_weapons[goods_item[1]]
  37.         when 2
  38.           item = $base_armors[goods_item[1]]
  39.         end
  40.         if item != nil
  41.           @data.push(item)
  42.         end
  43.       end
  44.     else
  45.       for i in 0..$game_variables[1].size # 存储数组必须和这里一致...
  46.         @data.push($game_variables[1][i]) if $game_variables[1][i]
  47.       end
  48.     end
  49.     @item_max = @data.size
  50.     create_contents
  51.     for i in 0...@item_max
  52.       draw_item(i)
  53.     end
  54.   end
  55.   #--------------------------------------------------------------------------
  56.   # ● 绘制商品
  57.   #     index : 商品索引
  58.   #--------------------------------------------------------------------------
  59.   def draw_item(index)
  60.     item = @data[index]
  61.     number = $game_party.item_number(item)
  62.     enabled = (item.price <= $game_party.gold and number < 99)
  63.     rect = item_rect(index)
  64.     self.contents.clear_rect(rect)
  65.     draw_item_name(item, rect.x, rect.y, enabled)
  66.     rect.width -= 4
  67.     self.contents.draw_text(rect, item.price, 2)
  68.   end
  69.   #--------------------------------------------------------------------------
  70.   # ● 更新帮助窗口文字
  71.   #--------------------------------------------------------------------------
  72.   def update_help
  73.     @help_window.set_text(item == nil ? "" : item.description)
  74.   end
  75. end



点评

是scene_shop,我还是一会儿起床再开电脑吧...  发表于 2015-11-14 10:53
好了  发表于 2015-11-14 10:45
贴出来,我电脑都没开,用飞机帮你看...  发表于 2015-11-14 10:40
我需要Scene_ShopBuy的脚本...顺便这个脚本写得真够废材的咿咿...  发表于 2015-11-14 10:35
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-22 14:45

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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