本帖最后由 Sion 于 2014-3-11 16:42 编辑
lirn 发表于 2014-3-11 13:33
能否设计,当某个开关打开时,只有特定角色能对同伴使用药品,其他人只能对自己使用药品? ...
class Window_BattleActor def actor=(actor) return if @actor== actor @actor= actor refresh end def current_item_enabled?(i=index) !$game_switches[1] || #改开关 @actor.id == 2 || #改id $game_party.battle_members[i] == @actor end # alias_method :s20140311_draw_item, :draw_item def draw_item(index) @tmpindex = index s20140311_draw_item(index) @tmpindex = nil end def change_color(*args) super contents.font.color.alpha = translucent_alpha unless current_item_enabled?(@tmpindex) end end class Window_BattleItem def process_ok super SceneManager.scene.instance_eval { @actor_window.actor = BattleManager.actor } end end
class Window_BattleActor
def actor=(actor)
return if @actor== actor
@actor= actor
refresh
end
def current_item_enabled?(i=index)
!$game_switches[1] || #改开关
@actor.id == 2 || #改id
$game_party.battle_members[i] == @actor
end
#
alias_method :s20140311_draw_item, :draw_item
def draw_item(index)
@tmpindex = index
s20140311_draw_item(index)
@tmpindex = nil
end
def change_color(*args)
super
contents.font.color.alpha = translucent_alpha unless
current_item_enabled?(@tmpindex)
end
end
class Window_BattleItem
def process_ok
super
SceneManager.scene.instance_eval {
@actor_window.actor = BattleManager.actor
}
end
end
|