task NormalStage {
function Wait(let frame){loop(frame){yield};}
function WaitForZeroEnemy{while(GetEnemyNum != 0){yield;}}	
let ENM11 = "script\Script-Stage1\1面-自機狙い1.txt";
let ENM12 = "script\Script-Stage1\1面-自機狙い2.txt";
let ENM13 = "script\Script-Stage1\1面-扇状弾1.txt";
let ENM14 = "script\Script-Stage1\1面-ランダム拡散.txt";
let ENM15 = "script\Script-Stage1\1面-全方位弾.txt";

let ENM21 = "script\Script-Stage2\2面-くにゃ弾1.txt";
let ENM22 = "script\Script-Stage2\2面-Way弾.txt";
let ENM23 = "script\Script-Stage2\2面-特殊全方位1.txt";
let ENM24 = "script\Script-Stage2\2面-Way連弾.txt";
let ENM25 = "script\Script-Stage2\2面-くにゃ弾2.txt";
let ENM26 = "script\Script-Stage2\2面-全方位弾.txt";

let ENM31 = "script\Script-Stage3\3面-扇状弾1.txt";
let ENM32 = "script\Script-Stage3\3面-自機狙い1.txt";
let ENM33 = "script\Script-Stage3\3面-自機狙い2.txt";
let ENM34 = "script\Script-Stage3\3面-下加速弾1.txt";
let ENM35 = "script\Script-Stage3\3面-全方位弾1.txt";
CompileEnemyFromFile(ENM11);
CompileEnemyFromFile(ENM12);
CompileEnemyFromFile(ENM13);
CompileEnemyFromFile(ENM14);
CompileEnemyFromFile(ENM15);

Wait(60);
StageNo=1;
PlayMusic("script\BGM\No.02.mp3");
Wait(50);
CreateEnemyFromFile(ENM11,0,60,0,0,0);
Wait(50);
CreateEnemyFromFile(ENM11,0,90,0,0,0);
Wait(50);
CreateEnemyFromFile(ENM11,0,120,0,0,0);
Wait(50);
CreateEnemyFromFile(ENM11,0,150,0,0,0);
Wait(50);
CreateEnemyFromFile(ENM11,0,190,0,0,0);
Wait(50);
CreateEnemyFromFile(ENM12,430,60,0,0,0);
Wait(50);
CreateEnemyFromFile(ENM12,430,90,0,0,0);
Wait(50);
CreateEnemyFromFile(ENM12,430,120,0,0,0);
Wait(50);
CreateEnemyFromFile(ENM12,430,150,0,0,0);
Wait(50);
CreateEnemyFromFile(ENM12,430,190,0,0,0);
WaitForZeroEnemy;
Wait(120);
StageTitle1;
Wait(700);
CreateEnemyFromFile(ENM13,Cx-100,0,0,0,0);
CreateEnemyFromFile(ENM13,Cx+100,0,0,0,0);
Wait(150);
CreateEnemyFromFile(ENM14,rand(Cx-150,Cx+150),0,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM14,rand(Cx-150,Cx+150),0,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM14,rand(Cx-150,Cx+150),0,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM14,rand(Cx-150,Cx+150),0,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM14,rand(Cx-150,Cx+150),0,0,0,0);
Wait(120);
CreateEnemyFromFile(ENM13,Cx-50,0,0,0,0);
CreateEnemyFromFile(ENM13,Cx+50,0,0,0,0);
Wait(150);
CreateEnemyFromFile(ENM14,rand(Cx-150,Cx+150),0,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM14,rand(Cx-150,Cx+150),0,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM14,rand(Cx-150,Cx+150),0,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM14,rand(Cx-150,Cx+150),0,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM14,rand(Cx-150,Cx+150),0,0,0,0);
WaitForZeroEnemy;
Wait(150);
CreateEnemyFromFile(ENM15,Cx-150,0,0,0,0);
Wait(60);
CreateEnemyFromFile(ENM15,Cx+150,0,0,0,0);
Wait(60);
CreateEnemyFromFile(ENM11,0,60,0,0,0);
Wait(50);
CreateEnemyFromFile(ENM11,0,90,0,0,0);
Wait(50);
CreateEnemyFromFile(ENM11,0,120,0,0,0);
Wait(50);
CreateEnemyFromFile(ENM11,0,150,0,0,0);
Wait(50);
CreateEnemyFromFile(ENM11,0,190,0,0,0);
Wait(50);
CreateEnemyFromFile(ENM11,0,220,0,0,0);
Wait(50);
CreateEnemyFromFile(ENM11,0,250,0,0,0);
Wait(50);
CreateEnemyFromFile(ENM11,0,280,0,0,0);
Wait(50);
CreateEnemyFromFile(ENM11,0,130,0,0,0);
WaitForZeroEnemy;
Wait(120);
CreateEnemyFromFile(ENM13,Cx-50,0,0,0,0);
CreateEnemyFromFile(ENM13,Cx+50,0,0,0,0);
Wait(150);
CreateEnemyFromFile(ENM13,Cx-100,0,0,0,0);
CreateEnemyFromFile(ENM13,Cx+100,0,0,0,0);
Wait(150);
CreateEnemyFromFile(ENM13,Cx-150,0,0,0,0);
CreateEnemyFromFile(ENM13,Cx+150,0,0,0,0);
WaitForZeroEnemy;
Wait(150);
CreateEnemyFromFile(ENM14,rand(Cx-150,Cx+150),0,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM14,rand(Cx-150,Cx+150),0,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM14,rand(Cx-150,Cx+150),0,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM14,rand(Cx-150,Cx+150),0,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM14,rand(Cx-150,Cx+150),0,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM14,rand(Cx-150,Cx+150),0,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM14,rand(Cx-150,Cx+150),0,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM14,rand(Cx-150,Cx+150),0,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM14,rand(Cx-150,Cx+150),0,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM14,rand(Cx-150,Cx+150),0,0,0,0);
WaitForZeroEnemy;
Wait(150);
if(GetCommonData("Rank")=="E"){
CreateEnemyBossFromFile("script\Script-1Boss\Frolir-MiddleBossE.txt",0,0,0,0,0);
}else if(GetCommonData("Rank")=="N"){
CreateEnemyBossFromFile("script\Script-1Boss\Frolir-MiddleBossN.txt",0,0,0,0,0);
}else if(GetCommonData("Rank")=="H"){
CreateEnemyBossFromFile("script\Script-1Boss\Frolir-MiddleBossH.txt",0,0,0,0,0);
}else if(GetCommonData("Rank")=="L"){
CreateEnemyBossFromFile("script\Script-1Boss\Frolir-MiddleBossL.txt",0,0,0,0,0);
} 
WaitForZeroEnemy;
Wait(120);
CreateEnemyFromFile(ENM15,Cx-150,0,0,0,0);
CreateEnemyFromFile(ENM15,Cx+150,0,0,0,0);
Wait(100);
CreateEnemyFromFile(ENM13,Cx-50,0,0,0,0);
CreateEnemyFromFile(ENM13,Cx+50,0,0,0,0);
Wait(100);
CreateEnemyFromFile(ENM11,0,60,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM11,0,120,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM11,0,60,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM11,0,120,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM11,0,60,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM11,0,120,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM11,0,60,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM11,0,120,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM11,0,60,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM11,0,120,0,0,0);
Wait(130);
CreateEnemyFromFile(ENM15,Cx-150,0,0,0,0);
CreateEnemyFromFile(ENM15,Cx+150,0,0,0,0);
Wait(110);
CreateEnemyFromFile(ENM13,Cx-150,0,0,0,0);
CreateEnemyFromFile(ENM13,Cx+150,0,0,0,0);
WaitForZeroEnemy;
Wait(150);
CreateEnemyFromFile(ENM14,rand(Cx-150,Cx+150),0,0,0,0);
Wait(140);
CreateEnemyFromFile(ENM14,rand(Cx-150,Cx+150),0,0,0,0);
Wait(130);
CreateEnemyFromFile(ENM14,rand(Cx-150,Cx+150),0,0,0,0);
Wait(120);
CreateEnemyFromFile(ENM14,rand(Cx-150,Cx+150),0,0,0,0);
Wait(110);
CreateEnemyFromFile(ENM14,rand(Cx-150,Cx+150),0,0,0,0);
Wait(100);
CreateEnemyFromFile(ENM14,rand(Cx-150,Cx+150),0,0,0,0);
Wait(90);
CreateEnemyFromFile(ENM14,rand(Cx-150,Cx+150),0,0,0,0);
Wait(80);
CreateEnemyFromFile(ENM14,rand(Cx-150,Cx+150),0,0,0,0);
Wait(70);
CreateEnemyFromFile(ENM14,rand(Cx-150,Cx+150),0,0,0,0);
Wait(60);
CreateEnemyFromFile(ENM14,rand(Cx-150,Cx+150),0,0,0,0);
WaitForZeroEnemy;
Wait(120);
CreateEnemyFromFile(ENM13,Cx-150,0,0,0,0);
Wait(90);
CreateEnemyFromFile(ENM13,Cx+150,0,0,0,0);
Wait(90);
CreateEnemyFromFile(ENM13,Cx+100,0,0,0,0);
Wait(90);
CreateEnemyFromFile(ENM13,Cx+50,0,0,0,0);
Wait(90);
CreateEnemyFromFile(ENM13,Cx-100,0,0,0,0);
Wait(90);
CreateEnemyFromFile(ENM13,Cx-50,0,0,0,0);
WaitForZeroEnemy;
Wait(160);
CreateEnemyFromFile(ENM11,0,60,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM12,0,120,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM11,0,60,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM12,0,120,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM11,0,60,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM12,0,120,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM11,0,60,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM12,0,120,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM11,0,60,0,0,0);
Wait(35);
CreateEnemyFromFile(ENM12,0,120,0,0,0);
WaitForZeroEnemy;
ClearByteCodeCache;
Wait(160);
if(GetCommonData("Rank")=="E"){
CreateEnemyBossFromFile("script\Script-1Boss\Frolir-BossE.txt",0,0,0,0,0);
}else if(GetCommonData("Rank")=="N"){
CreateEnemyBossFromFile("script\Script-1Boss\Frolir-BossN.txt",0,0,0,0,0);
}else if(GetCommonData("Rank")=="H"){
CreateEnemyBossFromFile("script\Script-1Boss\Frolir-BossH.txt",0,0,0,0,0);
}else if(GetCommonData("Rank")=="L"){
CreateEnemyBossFromFile("script\Script-1Boss\Frolir-BossL.txt",0,0,0,0,0);
} 
WaitForZeroEnemy;
FadeOutMusic("script\BGM\No.03.mp3",30);
StageEnd;
Wait(60);
StageNo=2;
Wait(250);	
CompileEnemyFromFile(ENM21);
CompileEnemyFromFile(ENM22);
CompileEnemyFromFile(ENM23);
CompileEnemyFromFile(ENM24);
CompileEnemyFromFile(ENM25);
CompileEnemyFromFile(ENM26);
PlayMusic("script\BGM\No.04.mp3");
Wait(50);
CreateEnemyFromFile(ENM21,Cx-50,0,0,0,0);
Wait(20);
CreateEnemyFromFile(ENM21,Cx+50,0,0,0,0);
Wait(20);
CreateEnemyFromFile(ENM21,Cx,0,0,0,0);
Wait(20);
CreateEnemyFromFile(ENM21,Cx-100,0,0,0,0);
Wait(20);
CreateEnemyFromFile(ENM21,Cx+100,0,0,0,0);
Wait(20);
CreateEnemyFromFile(ENM21,rand(Cx-150,Cx+150),0,0,0,0);
Wait(20);
CreateEnemyFromFile(ENM21,rand(Cx-150,Cx+150),0,0,0,0);
Wait(20);
CreateEnemyFromFile(ENM21,rand(Cx-150,Cx+150),0,0,0,0);
Wait(20);
CreateEnemyFromFile(ENM21,rand(Cx-150,Cx+150),0,0,0,0);
Wait(20);
CreateEnemyFromFile(ENM21,rand(Cx-150,Cx+150),0,0,0,0);
WaitForZeroEnemy;
Wait(120);
StageTitle2;
Wait(700);
CreateEnemyFromFile(ENM22,rand(Cx-150,Cx+150),rand(-50,0),0,0,0);
Wait(40);
CreateEnemyFromFile(ENM22,rand(Cx-150,Cx+150),rand(-50,0),0,0,0);
Wait(40);
CreateEnemyFromFile(ENM22,rand(Cx-150,Cx+150),rand(-50,0),0,0,0);
Wait(40);
CreateEnemyFromFile(ENM22,rand(Cx-150,Cx+150),rand(-50,0),0,0,0);
Wait(40);
CreateEnemyFromFile(ENM22,rand(Cx-150,Cx+150),rand(-50,0),0,0,0);
Wait(40);
CreateEnemyFromFile(ENM22,rand(Cx-150,Cx+150),rand(-50,0),0,0,0);
Wait(40);
CreateEnemyFromFile(ENM22,rand(Cx-150,Cx+150),rand(-50,0),0,0,0);
Wait(40);
CreateEnemyFromFile(ENM22,rand(Cx-150,Cx+150),rand(-50,0),0,0,0);
Wait(60);
CreateEnemyFromFile(ENM21,Cx-50,0,0,0,0);
Wait(20);
CreateEnemyFromFile(ENM21,Cx+50,0,0,0,0);
Wait(20);
CreateEnemyFromFile(ENM21,Cx,0,0,0,0);
Wait(20);
CreateEnemyFromFile(ENM21,Cx-100,0,0,0,0);
Wait(20);
CreateEnemyFromFile(ENM21,Cx+100,0,0,0,0);
Wait(20);
CreateEnemyFromFile(ENM21,rand(Cx-150,Cx+150),0,0,0,0);
Wait(20);
CreateEnemyFromFile(ENM21,rand(Cx-150,Cx+150),0,0,0,0);
Wait(20);
CreateEnemyFromFile(ENM21,rand(Cx-150,Cx+150),0,0,0,0);
Wait(20);
CreateEnemyFromFile(ENM21,rand(Cx-150,Cx+150),0,0,0,0);
Wait(20);
CreateEnemyFromFile(ENM21,rand(Cx-150,Cx+150),0,0,0,0);
WaitForZeroEnemy;
Wait(120);
CreateEnemyFromFile(ENM23,Cx,0,0,0,0);
Wait(150);
CreateEnemyFromFile(ENM23,Cx-150,0,0,0,0);
Wait(150);
CreateEnemyFromFile(ENM23,Cx+150,0,0,0,0);
WaitForZeroEnemy;
Wait(120);
CreateEnemyFromFile(ENM21,rand(Cx-150,Cx+150),0,0,0,0);
CreateEnemyFromFile(ENM22,rand(Cx-150,Cx+150),rand(-50,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM21,rand(Cx-150,Cx+150),0,0,0,0);
CreateEnemyFromFile(ENM22,rand(Cx-150,Cx+150),rand(-50,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM21,rand(Cx-150,Cx+150),0,0,0,0);
CreateEnemyFromFile(ENM22,rand(Cx-150,Cx+150),rand(-50,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM21,rand(Cx-150,Cx+150),0,0,0,0);
CreateEnemyFromFile(ENM22,rand(Cx-150,Cx+150),rand(-50,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM21,rand(Cx-150,Cx+150),0,0,0,0);
CreateEnemyFromFile(ENM22,rand(Cx-150,Cx+150),rand(-50,0),0,0,0);
Wait(120);
CreateEnemyFromFile(ENM23,Cx-150,0,0,0,0);
Wait(150);
CreateEnemyFromFile(ENM23,Cx-100,0,0,0,0);
Wait(150);
CreateEnemyFromFile(ENM23,Cx-50,0,0,0,0);
Wait(150);
CreateEnemyFromFile(ENM23,Cx,0,0,0,0);
Wait(150);
CreateEnemyFromFile(ENM23,Cx+50,0,0,0,0);
Wait(150);
CreateEnemyFromFile(ENM23,Cx+100,0,0,0,0);
Wait(150);
CreateEnemyFromFile(ENM23,Cx+150,0,0,0,0);
WaitForZeroEnemy;
Wait(120);
CreateEnemyFromFile(ENM21,rand(Cx-150,Cx+150),0,0,0,0);
Wait(50);
CreateEnemyFromFile(ENM21,rand(Cx-150,Cx+150),0,0,0,0);
Wait(50);
CreateEnemyFromFile(ENM21,rand(Cx-150,Cx+150),0,0,0,0);
Wait(50);
CreateEnemyFromFile(ENM21,rand(Cx-150,Cx+150),0,0,0,0);
Wait(50);
CreateEnemyFromFile(ENM21,rand(Cx-150,Cx+150),0,0,0,0);
Wait(50);
CreateEnemyFromFile(ENM21,rand(Cx-150,Cx+150),0,0,0,0);
Wait(50);
CreateEnemyFromFile(ENM21,rand(Cx-150,Cx+150),0,0,0,0);
Wait(50);
CreateEnemyFromFile(ENM21,rand(Cx-150,Cx+150),0,0,0,0);
Wait(50);
CreateEnemyFromFile(ENM21,rand(Cx-150,Cx+150),0,0,0,0);
Wait(50);
CreateEnemyFromFile(ENM21,rand(Cx-150,Cx+150),0,0,0,0);
Wait(150);
CreateEnemyFromFile(ENM24,50,0,0,0,0);
Wait(60);
CreateEnemyFromFile(ENM24,100,0,0,0,0);
Wait(60);
CreateEnemyFromFile(ENM24,150,0,0,0,0);
Wait(60);
CreateEnemyFromFile(ENM24,200,0,0,0,0);
Wait(60);
CreateEnemyFromFile(ENM24,250,0,0,0,0);
Wait(60);
CreateEnemyFromFile(ENM24,300,0,0,0,0);
Wait(60);
CreateEnemyFromFile(ENM24,350,0,0,0,0);
WaitForZeroEnemy;
Wait(120);
CreateEnemyFromFile(ENM23,Cx-150,0,0,0,0);
Wait(150);
CreateEnemyFromFile(ENM23,Cx-100,0,0,0,0);
Wait(150);
CreateEnemyFromFile(ENM23,Cx-50,0,0,0,0);
Wait(150);
CreateEnemyFromFile(ENM23,Cx,0,0,0,0);
Wait(150);
CreateEnemyFromFile(ENM23,Cx+50,0,0,0,0);
Wait(150);
CreateEnemyFromFile(ENM23,Cx+100,0,0,0,0);
Wait(150);
CreateEnemyFromFile(ENM23,Cx+150,0,0,0,0);
WaitForZeroEnemy;
Wait(300);
if(GetCommonData("Rank")=="E"){
CreateEnemyBossFromFile("script\Script-2Boss\Cerla-MiddleBossE.txt",0,0,0,0,0);
}else if(GetCommonData("Rank")=="N"){
CreateEnemyBossFromFile("script\Script-2Boss\Cerla-MiddleBossN.txt",0,0,0,0,0);
}else if(GetCommonData("Rank")=="H"){
CreateEnemyBossFromFile("script\Script-2Boss\Cerla-MiddleBossH.txt",0,0,0,0,0);
}else if(GetCommonData("Rank")=="L"){
CreateEnemyBossFromFile("script\Script-2Boss\Cerla-MiddleBossL.txt",0,0,0,0,0);
} 
WaitForZeroEnemy;
Wait(120);
CreateEnemyFromFile(ENM21,Cx-50,0,0,0,0);
Wait(20);
CreateEnemyFromFile(ENM21,Cx+50,0,0,0,0);
Wait(20);
CreateEnemyFromFile(ENM21,Cx,0,0,0,0);
Wait(20);
CreateEnemyFromFile(ENM21,Cx-100,0,0,0,0);
Wait(20);
CreateEnemyFromFile(ENM21,Cx+100,0,0,0,0);
Wait(20);
CreateEnemyFromFile(ENM21,rand(Cx-150,Cx+150),0,0,0,0);
Wait(20);
CreateEnemyFromFile(ENM21,rand(Cx-150,Cx+150),0,0,0,0);
Wait(20);
CreateEnemyFromFile(ENM21,rand(Cx-150,Cx+150),0,0,0,0);
Wait(20);
CreateEnemyFromFile(ENM21,rand(Cx-150,Cx+150),0,0,0,0);
Wait(20);
CreateEnemyFromFile(ENM21,rand(Cx-150,Cx+150),0,0,0,0);
WaitForZeroEnemy;
CreateEnemyFromFile(ENM25,Cx-50,0,0,0,0);
Wait(40);
CreateEnemyFromFile(ENM25,Cx+50,0,0,0,0);
Wait(40);
CreateEnemyFromFile(ENM25,Cx,0,0,0,0);
Wait(40);
CreateEnemyFromFile(ENM25,Cx-100,0,0,0,0);
Wait(40);
CreateEnemyFromFile(ENM25,Cx+100,0,0,0,0);
Wait(40);
CreateEnemyFromFile(ENM25,rand(Cx-150,Cx+150),0,0,0,0);
Wait(40);
CreateEnemyFromFile(ENM25,rand(Cx-150,Cx+150),0,0,0,0);
Wait(40);
CreateEnemyFromFile(ENM25,rand(Cx-150,Cx+150),0,0,0,0);
Wait(40);
CreateEnemyFromFile(ENM25,rand(Cx-150,Cx+150),0,0,0,0);
Wait(40);
CreateEnemyFromFile(ENM25,rand(Cx-150,Cx+150),0,0,0,0);
WaitForZeroEnemy;
Wait(120);
CreateEnemyFromFile(ENM23,Cx,0,0,0,0);
Wait(150);
CreateEnemyFromFile(ENM23,Cx-150,0,0,0,0);
Wait(150);
CreateEnemyFromFile(ENM23,Cx+150,0,0,0,0);
WaitForZeroEnemy;
Wait(120);
CreateEnemyFromFile(ENM26,Cx-50,0,0,0,0);
Wait(80);
CreateEnemyFromFile(ENM26,Cx+50,0,0,0,0);
Wait(80);
CreateEnemyFromFile(ENM26,Cx,0,0,0,0);
Wait(80);
CreateEnemyFromFile(ENM26,Cx-100,0,0,0,0);
Wait(80);
CreateEnemyFromFile(ENM26,Cx+100,0,0,0,0);
Wait(120);
CreateEnemyFromFile(ENM21,rand(Cx-150,Cx+150),0,0,0,0);
Wait(150);
CreateEnemyFromFile(ENM24,50,0,0,0,0);
Wait(60);
CreateEnemyFromFile(ENM24,100,0,0,0,0);
Wait(60);
CreateEnemyFromFile(ENM24,150,0,0,0,0);
Wait(60);
CreateEnemyFromFile(ENM24,200,0,0,0,0);
Wait(60);
CreateEnemyFromFile(ENM24,250,0,0,0,0);
Wait(60);
CreateEnemyFromFile(ENM24,300,0,0,0,0);
Wait(60);
CreateEnemyFromFile(ENM24,350,0,0,0,0);
WaitForZeroEnemy;
CreateEnemyFromFile(ENM22,rand(Cx-150,Cx+150),rand(-50,0),0,0,0);
Wait(40);
CreateEnemyFromFile(ENM22,rand(Cx-150,Cx+150),rand(-50,0),0,0,0);
Wait(40);
CreateEnemyFromFile(ENM22,rand(Cx-150,Cx+150),rand(-50,0),0,0,0);
Wait(40);
CreateEnemyFromFile(ENM22,rand(Cx-150,Cx+150),rand(-50,0),0,0,0);
Wait(40);
CreateEnemyFromFile(ENM22,rand(Cx-150,Cx+150),rand(-50,0),0,0,0);
Wait(40);
CreateEnemyFromFile(ENM22,rand(Cx-150,Cx+150),rand(-50,0),0,0,0);
Wait(40);
CreateEnemyFromFile(ENM22,rand(Cx-150,Cx+150),rand(-50,0),0,0,0);
Wait(40);
CreateEnemyFromFile(ENM22,rand(Cx-150,Cx+150),rand(-50,0),0,0,0);
WaitForZeroEnemy;
Wait(120);
CreateEnemyFromFile(ENM23,Cx-150,0,0,0,0);
Wait(150);
CreateEnemyFromFile(ENM23,Cx-100,0,0,0,0);
Wait(150);
CreateEnemyFromFile(ENM23,Cx-50,0,0,0,0);
Wait(150);
CreateEnemyFromFile(ENM23,Cx,0,0,0,0);
Wait(150);
CreateEnemyFromFile(ENM23,Cx+50,0,0,0,0);
Wait(150);
CreateEnemyFromFile(ENM23,Cx+100,0,0,0,0);
Wait(150);
CreateEnemyFromFile(ENM23,Cx+150,0,0,0,0);
WaitForZeroEnemy;
ClearByteCodeCache;
Wait(260);
if(GetCommonData("Rank")=="E"){
CreateEnemyBossFromFile("script\Script-2Boss\Cerla-BossE.txt",0,0,0,0,0);
}else if(GetCommonData("Rank")=="N"){
CreateEnemyBossFromFile("script\Script-2Boss\Cerla-BossN.txt",0,0,0,0,0);
}else if(GetCommonData("Rank")=="H"){
CreateEnemyBossFromFile("script\Script-2Boss\Cerla-BossH.txt",0,0,0,0,0);
}else if(GetCommonData("Rank")=="L"){
CreateEnemyBossFromFile("script\Script-2Boss\Cerla-BossL.txt",0,0,0,0,0);
} 
WaitForZeroEnemy;
FadeOutMusic("script\BGM\No.05.mp3",30);
StageEnd;
Wait(60);
StageNo=3;
Wait(250);	

CompileEnemyFromFile(ENM31);
CompileEnemyFromFile(ENM32);
CompileEnemyFromFile(ENM33);
CompileEnemyFromFile(ENM34);
CompileEnemyFromFile(ENM35);
PlayMusic("script\BGM\No.06.mp3");
Wait(50);
CreateEnemyFromFile(ENM31,Cx-100,0,0,0,0);
CreateEnemyFromFile(ENM31,Cx+100,0,0,0,0);
Wait(160);
CreateEnemyFromFile(ENM31,Cx-50,0,0,0,0);
CreateEnemyFromFile(ENM31,Cx+50,0,0,0,0);
Wait(260);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
WaitForZeroEnemy;
Wait(200);
StageTitle3;
Wait(700);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(260);
CreateEnemyFromFile(ENM31,Cx-100,0,0,0,0);
CreateEnemyFromFile(ENM31,Cx+100,0,0,0,0);
Wait(160);
CreateEnemyFromFile(ENM31,Cx-50,0,0,0,0);
CreateEnemyFromFile(ENM31,Cx+50,0,0,0,0);
Wait(260);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(260);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
WaitForZeroEnemy;
Wait(160);
CreateEnemyFromFile(ENM31,Cx,0,0,0,0);
Wait(120);
CreateEnemyFromFile(ENM31,Cx-100,0,0,0,0);
CreateEnemyFromFile(ENM31,Cx+100,0,0,0,0);
Wait(120);
CreateEnemyFromFile(ENM31,Cx,0,0,0,0);
CreateEnemyFromFile(ENM31,Cx-100,0,0,0,0);
CreateEnemyFromFile(ENM31,Cx+100,0,0,0,0);
Wait(200);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(30);
CreateEnemyFromFile(ENM34,rand(32,400),rand(-40,0),0,0,0);
Wait(260);
CreateEnemyFromFile(ENM35,Cx,0,0,0,0);
WaitForZeroEnemy;
CreateEnemyFromFile(ENM35,Cx-100,0,0,0,0);
CreateEnemyFromFile(ENM35,Cx+100,0,0,0,0);
WaitForZeroEnemy;
CreateEnemyFromFile(ENM35,Cx,0,0,0,0);
CreateEnemyFromFile(ENM35,Cx-100,0,0,0,0);
CreateEnemyFromFile(ENM35,Cx+100,0,0,0,0);
WaitForZeroEnemy;
Wait(200);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
Wait(180);
CreateEnemyFromFile(ENM35,Cx-100,0,0,0,0);
CreateEnemyFromFile(ENM31,Cx+100,0,0,0,0);
Wait(200);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(180);
CreateEnemyFromFile(ENM35,Cx+100,0,0,0,0);
CreateEnemyFromFile(ENM31,Cx-100,0,0,0,0);
Wait(200);
CreateEnemyFromFile(ENM31,Cx-100,0,0,0,0);
CreateEnemyFromFile(ENM31,Cx+100,0,0,0,0);
Wait(160);
CreateEnemyFromFile(ENM31,Cx-50,0,0,0,0);
CreateEnemyFromFile(ENM31,Cx+50,0,0,0,0);
Wait(260);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
WaitForZeroEnemy;
Wait(260);
CreateEnemyFromFile(ENM31,Cx-100,0,0,0,0);
CreateEnemyFromFile(ENM31,Cx+100,0,0,0,0);
Wait(160);
CreateEnemyFromFile(ENM31,Cx-50,0,0,0,0);
CreateEnemyFromFile(ENM31,Cx+50,0,0,0,0);
Wait(160);
CreateEnemyFromFile(ENM31,Cx,0,0,0,0);
Wait(120);
CreateEnemyFromFile(ENM31,Cx-100,0,0,0,0);
CreateEnemyFromFile(ENM31,Cx+100,0,0,0,0);
Wait(120);
CreateEnemyFromFile(ENM31,Cx,0,0,0,0);
CreateEnemyFromFile(ENM31,Cx-100,0,0,0,0);
CreateEnemyFromFile(ENM31,Cx+100,0,0,0,0);
Wait(200);
CreateEnemyFromFile(ENM35,Cx,0,0,0,0);
WaitForZeroEnemy;
MoveMode=1;
CreateEnemyFromFile(ENM35,Cx-100,0,0,0,0);
CreateEnemyFromFile(ENM35,Cx+100,0,0,0,0);
WaitForZeroEnemy;
CreateEnemyFromFile(ENM35,Cx,0,0,0,0);
CreateEnemyFromFile(ENM35,Cx-100,0,0,0,0);
CreateEnemyFromFile(ENM35,Cx+100,0,0,0,0);
WaitForZeroEnemy;
Wait(200);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM33,0,100,0,0,0);
Wait(180);
CreateEnemyFromFile(ENM35,Cx-100,0,0,0,0);
CreateEnemyFromFile(ENM31,Cx+100,0,0,0,0);
Wait(200);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(25);
CreateEnemyFromFile(ENM32,420,100,0,0,0);
Wait(180);
CreateEnemyFromFile(ENM35,Cx+100,0,0,0,0);
CreateEnemyFromFile(ENM31,Cx-100,0,0,0,0);
WaitForZeroEnemy;
ClearByteCodeCache;
Wait(300);
if(GetCommonData("Rank")=="E"){
CreateEnemyBossFromFile("script\Script-3Boss\Merysil-BossE.txt",0,0,0,0,0);
}else if(GetCommonData("Rank")=="N"){
CreateEnemyBossFromFile("script\Script-3Boss\Merysil-BossN.txt",0,0,0,0,0);
}else if(GetCommonData("Rank")=="H"){
CreateEnemyBossFromFile("script\Script-3Boss\Merysil-BossH.txt",0,0,0,0,0);
}else if(GetCommonData("Rank")=="L"){
CreateEnemyBossFromFile("script\Script-3Boss\Merysil-BossL.txt",0,0,0,0,0);
} 
WaitForZeroEnemy;
FadeOutMusic("script\BGM\No.07.mp3",30);
StageEnd;
Wait(60);
StageNo=0;
Wait(60);
ClearStage;
Wait(99999999999999);
}