Project1
标题: 【已解決】將使用一個物品的時候將物品ID代入到一個變量ID [打印本页]
作者: 卡奥尼特 时间: 2017-4-3 09:50
标题: 【已解決】將使用一個物品的時候將物品ID代入到一個變量ID
本帖最后由 卡奥尼特 于 2017-4-3 11:05 编辑
是這樣的,咱打算做一個短篇的解謎遊戲 (某論壇的小活動,但也只能在這求助。)
而且,想把使用道具始終集中在一個公共事件處理。
所以,想把當前使用的物品的ID直接代入到一個變量裏。
要怎麼做的好呢?
【於 2017年4月3日 11:06:54 編輯追加】
嗯,已經自行解決,方法就是在 Scene_Item 的 72~75 行的這裡 加一個代碼
原代碼:
#--------------------------------------------------------------------------
# ● 使用物品
#--------------------------------------------------------------------------
def use_item
super
@item_window.redraw_current_item
end
#--------------------------------------------------------------------------
# ● 使用物品
#--------------------------------------------------------------------------
def use_item
super
@item_window.redraw_current_item
end
加了代碼後就變成了這樣子。 然後使用一個物品的時候,這個物品的ID就可以代入到25號變量。
好了咱繼續玩耍去咯。
而且,咱也不是很懂Ruby呢。 所以就……
#--------------------------------------------------------------------------
# ● 使用物品
#--------------------------------------------------------------------------
def use_item
super
@item_window.redraw_current_item
$game_variables[25] = item.id
end
#--------------------------------------------------------------------------
# ● 使用物品
#--------------------------------------------------------------------------
def use_item
super
@item_window.redraw_current_item
$game_variables[25] = item.id
end
作者: 鑫晴 时间: 2017-4-3 11:36
本帖最后由 鑫晴 于 2017-4-3 11:43 编辑
这样似乎能做出许多有趣的事情~
你刚刚使用了价值\V[22]\G的\I[\V[21]]\V[24],
\V[24]能够\V[23]
你刚刚使用了价值\V[22]\G的\I[\V[21]]\V[24],
\V[24]能够\V[23]
#--------------------------------------------------------------------------
# ● 使用物品
#--------------------------------------------------------------------------
def use_item
super
@item_window.redraw_current_item
$game_variables[21] = item.icon_index #图标序号
$game_variables[22] = item.price #物品价格
$game_variables[23] = item.description #物品描述
$game_variables[24] = item.name #物品名称
$game_variables[25] = item.id #物品序号
end
#--------------------------------------------------------------------------
# ● 使用物品
#--------------------------------------------------------------------------
def use_item
super
@item_window.redraw_current_item
$game_variables[21] = item.icon_index #图标序号
$game_variables[22] = item.price #物品价格
$game_variables[23] = item.description #物品描述
$game_variables[24] = item.name #物品名称
$game_variables[25] = item.id #物品序号
end
欢迎光临 Project1 (https://rpg.blue/) |
Powered by Discuz! X3.1 |