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

Project1

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

[已经过期] 想以超过道具id为条件的条件句要怎么写?

[复制链接]

Lv5.捕梦者

梦石
0
星屑
24374
在线时间
5054 小时
注册时间
2016-3-8
帖子
1622
1
发表于 2021-2-21 13:12:47 | 显示全部楼层
为啥行不通

只要 item 不为 nil , 是个 RPG::Item 就行得通的吧...

#<RPG::Item:0xc8a9678 @description="回复500HP。", @name="药水", @consumable=true, @occasion=0, @icon_index=192, @price=50, @scope=7, @animation_id=37, @note="", @speed=0, @id=1, @features=[], @effects=[#<RPG::UsableItem::Effect:0xc8a9484 @code=11, @data_id=0, @value1=0.0, @value2=500.0>], @damage=#<RPG::UsableItem::Damage:0xc8a9204 @type=0, @element_id=0, @formula="0", @variance=20, @critical=false>, @success_rate=100, @hit_type=0, @itype_id=1, @repeats=1, @tp_gain=0>
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
24374
在线时间
5054 小时
注册时间
2016-3-8
帖子
1622
2
发表于 2021-2-21 16:53:29 | 显示全部楼层
本帖最后由 alexncf125 于 2021-2-21 17:01 编辑
alianlord 发表于 2021-2-21 16:28
搞不定,我是在window_help 中想用条件句切换显示内容。
item.id 似乎要在Scene_Item之中,使用才会正常。
...


请问为什么我在Window_Help写的这红句能正常地p出物品ID

class Window_Help < Window_Base
  alias set_item_p_item_id set_item
  def set_item(item)
    p item.id if item && item.is_a?(RPG::Item)
    p_item_id_set_item(item)
  end
end

点评

我很赞同  发表于 2021-2-21 17:04
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
24374
在线时间
5054 小时
注册时间
2016-3-8
帖子
1622
3
发表于 2021-2-21 18:54:01 | 显示全部楼层
本帖最后由 alexncf125 于 2021-2-21 20:22 编辑
alianlord 发表于 2021-2-21 17:24
我题出的推理只是假设,错了也正常。
你能在地图场景中,写个能显示item_id的触发事件吗? ...


我就不写了
看看Scene_Map(地图场景)下的Window_KeyItem第45行item.id
只就「地图场景中,显示item_id」这问题而言, 我觉得应该很有关联

至于为什么在Scene_Item之中,能正常使用item.id呢
一是因为Scene_Item第35行有@item_window = Window_ItemList.new吧...
二是因为Scene_ItemBase第27-29行有  def item; @item_window.item; end吧...

而Window_ItemList里有什么呢...
  def item
    @data && index >= 0 ? @data[index] : nil
  end

@data是什么呢...
  def make_item_list
    @data = $game_party.all_items.select {|item| include?(item) }
    @data.push(nil) if include?(nil)
  end
回复 支持 1 反对 0

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-5 03:19

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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