Could such a thing work?
def pbTrainerBattle(trainerid,trainername,endspeech,
doublebattle=false,trainerparty=0,canlose=false,variable=nil)
if $game_variables[007]==2 && val.include?("Komor")
next 2
if $game_variables[007]==3 && val.include?("Komor")
next 3
end
end
end