module BattleManager def self.battle_start $game_system.battle_count += 1 $game_party.on_battle_start $game_troop.on_battle_start $game_troop.enemy_names.each do |name| $game_message.add(sprintf(Vocab::Emerge, name)) end if @preemptive $game_message.add(sprintf(Vocab::Preemptive, $game_party.name)) elsif @surprise $game_message.add(sprintf(Vocab::Surprise, $game_party.name)) end for i in 1..4 #这里可以 $game_variables[i] = 1 #用迭代 end #不太熟所以用for写了 wait_for_message end end class Scene_Battle < Scene_Base alias on_item_ok_20150917 on_item_ok def on_item_ok on_item_ok_20150917 $game_variables[BattleManager.actor.index+1] -= 1 #index是0,所以从1号变量开始,可以改 end alias on_item_cancel_20150917 on_item_cancel def on_item_cancel on_item_cancel_20150917 $game_variables[BattleManager.actor.index+1] += 1 end end class Window_ActorCommand < Window_Command def add_item_command @itsw = $game_variables[BattleManager.actor.index+1] == 0 ? false : true add_command(Vocab::item, :item,@itsw) end end
module BattleManager
def self.battle_start
$game_system.battle_count += 1
$game_party.on_battle_start
$game_troop.on_battle_start
$game_troop.enemy_names.each do |name|
$game_message.add(sprintf(Vocab::Emerge, name))
end
if @preemptive
$game_message.add(sprintf(Vocab::Preemptive, $game_party.name))
elsif @surprise
$game_message.add(sprintf(Vocab::Surprise, $game_party.name))
end
for i in 1..4 #这里可以
$game_variables[i] = 1 #用迭代
end #不太熟所以用for写了
wait_for_message
end
end
class Scene_Battle < Scene_Base
alias on_item_ok_20150917 on_item_ok
def on_item_ok
on_item_ok_20150917
$game_variables[BattleManager.actor.index+1] -= 1 #index是0,所以从1号变量开始,可以改
end
alias on_item_cancel_20150917 on_item_cancel
def on_item_cancel
on_item_cancel_20150917
$game_variables[BattleManager.actor.index+1] += 1
end
end
class Window_ActorCommand < Window_Command
def add_item_command
@itsw = $game_variables[BattleManager.actor.index+1] == 0 ? false : true
add_command(Vocab::item, :item,@itsw)
end
end
写了一个,你可以试试,是不是你要的效果。
应该是可以不占用变量的,我本想用数组的,但是没写成功。 |