| 赞 | 164 |
| VIP | |
| 好人卡 | |
| 积分 | 299 |
| 经验 | |
| 最后登录 | 2026-10-2 |
| 在线时间 | 5734 小时 |
- 梦石
- 0
- 星屑
- 29901
- 在线时间
- 5734 小时
- 注册时间
- 2016-3-8
- 回帖
- 1653
|
楼主 |
发表于 2020-8-18 12:52:05
|
显示全部楼层
本帖最后由 alexncf125 于 2020-8-19 08:31 编辑
研究完一阵子,现在除注释了【Game_Battler】中 item_test 内那句 return true if $game_party.in_battle 外
我还把【Scene_Battle】那段 def on_actor_ok 魔改成以下的样子
[pre lang="ruby"]
#------------------------------------------------- -------------------------
# ● 角色“确定”
#------------------------------------------------- -------------------------
def on_actor_ok
#[url]https://rpg.blue/forum.php?mod=viewthread&tid=411480
#当在菜单对我方使用了一个包含了行动限制状态的道具时角色会进入行动限制的状态,
#此时若我方全部人员都被限制了行动,则道具显示变成灰色,
#但是光标仍然留在选择道具的目标窗口,此时如果再点击一次确定键就会报错。
#将【Scene_ItemBase】的第65行改成 if user and item_usable?
if item_target_actors && item_usable? #~这里用不用加 item_target_actors (?,还是直接 if item_usable?
BattleManager.actor.input.target_index = @actor_window.index
@actor_window.hide
@skill_window.hide
@item_window.hide
next_command
else
BattleManager.actor.input.target_index = @actor_window.index #~这句是有什么用途的? 要不要删去??
@actor_window.activate
Sound.play_buzzer
end
end
#------------------------------------------------- -------------------------
# ● 获取物品的使用目标数组
#------------------------------------------------- -------------------------
def item_target_actors
item = @item_window.item
if !item.for_friend?
[]
elsif item.for_all?
$game_party.members
else
[$game_party.members[@actor_window.index]]
end
end
#------------------------------------------------- -------------------------
# ● 判定物品是否可以使用
#------------------------------------------------- -------------------------
def item_usable?
item = @item_window.item
item_target_actors.any? do |target|
target.usable?(item) && item_effects_valid?
end
end
#------------------------------------------------- -------------------------
# ● 判定物品的效果是否有效
#------------------------------------------------- -------------------------
def item_effects_valid?
item = @item_window.item
item_target_actors.any? do |target|
target.item_test(target, item) #~ 在【Scene_ItemBase】中是 target.item_test(user, item)
#~ 我改成 target.item_test(target, item) 是不是不对?
end
end[/pre]
以上是魔改自【Scene_ItemBase】的
[pre lang="ruby"]
#------------------------------------------------- -------------------------
# ● 获取物品的使用目标数组
#------------------------------------------------- -------------------------
def item_target_actors
if !item.for_friend?
[]
elsif item.for_all?
$game_party.members
else
[$game_party.members[@actor_window.index]]
end
end
#------------------------------------------------- -------------------------
# ● 判定物品是否可以使用
#------------------------------------------------- -------------------------
def item_usable?
user.usable?(item) && item_effects_valid?
end
#------------------------------------------------- -------------------------
# ● 判定物品的效果是否有效
#------------------------------------------------- -------------------------
def item_effects_valid?
item_target_actors.any? do |target|
target.item_test(user, item)
end
end[/pre]
总体来说,我把【Scene_ItemBase】的 user 换成了 item_target_actors.any? do |target| 的 target
和 item 换成了 @item_window.item 后,搬到【Scene_Battle】去了,也不知这样改有没有什么问题,大大能指点一下么?
另外如果我想搭配星泻的脚本使用,
是不是加上以下这段就可行了??
- class Scene_Battle < Scene_Base
- alias on_item_ok_unuse_inv_face on_item_ok
- def on_item_ok
- $game_temp.temp_unuse_item = @item_window.item
- item_target_actors.any? do |target|
- $game_temp.temp_unuse_actor = target
- end
- on_item_ok_unuse_inv_face
- end
- end
复制代码
星潟的脚本[pre lang="ruby"]#==============================================================================
# ■ RGSS3 无法使用时角色脸图半透明化&文本显示 Ver1.00 by 星潟
#------------------------------------------------------------------------------
# 物品画面和技能画面中使用物品时,如果无法对某个角色使用
# 该角色的脸图会半透明
# 并且显示一个文本。
# 一般情况下只支持默认使用物品系统。
#==============================================================================
module T_UNUSE_ITEM
#无法使用时在脸图上显示的文字。
WORD = "-不可用-"
#修改文字y坐标。
#0~3为较合适的范围。(可以使用小数)
LINE = 3
end
class Game_Temp
attr_accessor :temp_unuse_item
attr_accessor :temp_unuse_actor
end
class Window_Base < Window
#--------------------------------------------------------------------------
# 顔グラフィック描写
#--------------------------------------------------------------------------
alias draw_actor_face_unuse_inv_face draw_actor_face
def draw_actor_face(actor, x, y, enabled = true)
#使用不可メッセージの表示フラグを設定
flag = false
#本来の表示フラグが有効であり
#なおかつ、使用者情報及びアイテム情報が存在する場合は
#アイテム情報にあるアイテムの使用可否を以て
#使用不可メッセージと顔グラフィックの表示フラグを変更する。
if $game_temp.temp_unuse_item != nil && !actor.item_test($game_temp.temp_unuse_actor, $game_temp.temp_unuse_item)
enabled = false
flag = true
end
#本来の処理を実行する。
draw_actor_face_unuse_inv_face(actor, x, y, enabled)
#使用不可メッセージを描写。
draw_text(x, y + line_height * T_UNUSE_ITEM::LINE, 96, line_height, T_UNUSE_ITEM::WORD, 1) if flag
end
end
class Scene_Base
#--------------------------------------------------------------------------
# 終了
#--------------------------------------------------------------------------
alias terminate_unuse_inv_face terminate
def terminate
#アイテムの情報を消去する。
$game_temp.temp_unuse_item = nil
#使用者の情報を消去する。
$game_temp.temp_unuse_actor = nil
#本来の処理を実行する。
terminate_unuse_inv_face
end
end
class Scene_ItemBase < Scene_MenuBase
#--------------------------------------------------------------------------
# アイテムの決定
#--------------------------------------------------------------------------
alias determine_item_unuse_inv_face determine_item
def determine_item
#アイテムの情報を記録する。
$game_temp.temp_unuse_item = item
#使用者の情報を記録する。
$game_temp.temp_unuse_actor = user
#本来の処理を実行する。
determine_item_unuse_inv_face
end
#--------------------------------------------------------------------------
# サブウィンドウの表示
#--------------------------------------------------------------------------
alias show_sub_window_unuse_inv_face show_sub_window
def show_sub_window(window)
#サブウィンドウをリフレッシュし、顔グラフィックを変更しておく。
window.refresh
#本来の処理を実行する。
show_sub_window_unuse_inv_face(window)
end
end[/pre]
|
|