class Game_Party
def replace(*array)
array.flatten!
return if array.empty?
$game_party.members.each_with_index do |m, i|
$game_variables[i+510] = m.id
end
@actors = array
$game_player.refresh
$game_map.need_refresh = true
end
def replace_by_names(*array)
array.flatten!
ids = array.map do |name|
actor = $data_actors.find { |a| a && a.name == name }
actor ? actor.id : msgbox("数据库中不存在角色'#{name}'")
end.compact
replace(ids)
end
end
class Game_Party
def replace(*array)
array.flatten!
return if array.empty?
$game_party.members.each_with_index do |m, i|
$game_variables[i+510] = m.id
end
@actors = array
$game_player.refresh
$game_map.need_refresh = true
end
def replace_by_names(*array)
array.flatten!
ids = array.map do |name|
actor = $data_actors.find { |a| a && a.name == name }
actor ? actor.id : msgbox("数据库中不存在角色'#{name}'")
end.compact
replace(ids)
end
end