//===== Athena Script =====================================
//= Zombie Invasion v2.0
//===== By Keale of VoidRO ================================
//= http://voidro.com
//===== Description =======================================
//= A Zombie invasion that takes place in a chosen map. 
//= There are 10 prizes that drop from certain mobs, 
//= edit the script to fit your own needs. 
//= NOTE: A LOT of mobs are summoned, (5197) it's
//= recommended for mid to high rate servers.
//===== Version ===========================================
//= v2.0
//=========================================================
//= v1.0 - First release, seems to work ok.
//= v1.1 - Fixed some bugs and changed the treasure amount 
//=        to 10.
//= v2.0 - Pretty much re-wrote the whole thing. I added
//=        an option to choose which map the invasion will
//=        take place on for more variation. (any mapname
//=        you input will work. gef_fild04 Invasion ohno!)
//= v2.1 - Fixed night effect in script conflicting with
//=        server natural day/night cycle (Spunkie)
//=========================================================

rachel,108,148,5	script	Undead Minion	537,{

set .@npc$,"[^FF0000Undead Minion^000000]";

	if ((getgmlevel() >= 40) && ($@MonstersAlive >=1)) goto L_GM2; 
	if (getgmlevel() >= 40) goto L_GM;
	
		mes .@npc$;
		mes "The underworld is currently at rest...";
		next;
		switch(select("Uh.. See ya!:What are you talking about?")) {

	case 1:
		mes .@npc$;
		mes "Farewell.... heh heh heh.";
		emotion 29;
		close;

	case 2:
		mes .@npc$;
		mes "The time will come, the underworld will rise!";
		mes "Which town will be our target?... heh heh.";
		mes "Be prepared, " + strcharinfo(0) + "...";
		emotion 29;
		close;
		}

L_GM:
	mes .@npc$;
	mes "Would you like me to call upon the undead?";
	next;
	mes .@npc$;
	mes "Beware, the town you choose will be overtaken!";
	emotion 29;
	next;
	switch(select("Summon!:Not this time...")) {
	
	case 1:
		mes .@npc$;
		mes "YES! I shall call upon them!!";
		mes "Please choose an area to be invaded!!";
		mes "Make sure you write the mapname correctly.";
		next;
		
		menu "Select Map",SELECT_TOWN,"I changed my mind..",EXIT_1;

		SELECT_TOWN:
			mes .@npc$;
			mes "Which map shall it be? kekeke...";
			emotion 29;
			input $InvasionTown$;
			next;
			mes .@npc$;
			mes "So, you have selected ^008000"+ $InvasionTown$ +"^000000 to be taken over by the underworld?";
			mes "Are you, sure?";
			next;
			switch(select("YES, DO IT!:Choose Again")) {
			
				case 1:
					mes .@npc$;
					mes "Very well... behold the tragedy you have set upon this land!";
					emotion 29;
					goto SUMMON_MOBS;
					break;
					
				case 2:
					goto SELECT_TOWN;
					break;
				}
				
		EXIT_1:
			mes .@npc$;
			mes "You disappoint me!";
			emotion 23;
			close;
		
	case 2:
		mes .@npc$;
		mes "heh heh! One of these days...";
		emotion 29;
		close;
		}
		
L_GM2:
	mes .@npc$;
	mes "Heh heh... What did I tell you?";
	emotion 29;
	next;
	mes .@npc$;
	mes "Would you like me to recall the undead?";
	next;
	switch(select("Stop at once!:No")) {

	case 1:
		mes .@npc$;
		mes "Bah! very well, but our day shall come!";
		emotion 23;
		next;
		killmonster "" + $InvasionTown$ + ".gat","All";
		set $@MonstersAlive,0;
		announce "Some unknown force has sent the undead running for their graves, the attack has ended.",0;
		close;
		
	case 2:
		mes .@npc$;
		mes "Kekeke...";
		emotion 29;
		close;
		}

SUMMON_MOBS:
close2;
set $@Treasures,10;
set $@MonstersAlive,5197;
if(isday())	{
night;
set .@temp_night,1;	}
monster "" + $InvasionTown$ + ".gat",0,0,"Ragged Zombie",1865,300,"zombielose::OnMobKilled";
monster "" + $InvasionTown$ + ".gat",0,0,"Zombie",1015,1000,"zombielose::OnMobKilled";
monster "" + $InvasionTown$ + ".gat",0,0,"Zombie Master",1298,300,"zombielose::OnMobKilled";
monster "" + $InvasionTown$ + ".gat",0,0,"Zombie Prisoner",1197,300,"zombielose::OnMobKilled";
monster "" + $InvasionTown$ + ".gat",0,0,"Zombie Slaughter",1864,300,"zombielose::OnMobKilled";
monster "" + $InvasionTown$ + ".gat",0,0,"Ragged Zombie",1865,300,"zombielose::OnMobKilled";
monster "" + $InvasionTown$ + ".gat",0,0,"Firelock Soldier",1403,200,"zombielose::OnMobKilled";
monster "" + $InvasionTown$ + ".gat",0,0,"Ghoul",1036,1000,"zombielose::OnMobKilled";
monster "" + $InvasionTown$ + ".gat",0,0,"Osiris",1038,1,"zombielose::OnMobKilled";
monster "" + $InvasionTown$ + ".gat",0,0,"Drake",1112,1,"zombielose::OnMobKilled";
monster "" + $InvasionTown$ + ".gat",0,0,"Dark Lord",1272,1,"zombielose::OnMobKilled";
monster "" + $InvasionTown$ + ".gat",0,0,"Dracula",1389,1,"zombielose::OnMobKilled";
monster "" + $InvasionTown$ + ".gat",0,0,"Incantation Samurai",1492,1,"zombielose::OnMobKilled";
monster "" + $InvasionTown$ + ".gat",0,0,"Kiel D-01",1734,1,"zombielose::OnMobKilled";
monster "" + $InvasionTown$ + ".gat",0,0,"Ghoul",1036,500,"zombielose::OnMobKilled";
monster "" + $InvasionTown$ + ".gat",0,0,"Zombie",1015,500,"zombielose::OnMobKilled";
monster "" + $InvasionTown$ + ".gat",0,0,"Zombie Slaughter",1864,100,"zombielose::OnMobKilled";
monster "" + $InvasionTown$ + ".gat",0,0,"Ragged Zombie",1865,200,"zombielose::OnMobKilled";
monster "" + $InvasionTown$ + ".gat",0,0,"Necromancer",1870,25,"zombielose::OnMobKilled";
monster "" + $InvasionTown$ + ".gat",0,0,"Skeleton Worker",1169,150,"zombielose::OnMobKilled";
monster "" + $InvasionTown$ + ".gat",0,0,"Assassin Cross Eremes",1647,2,"zombielose::OnMobKilled";
monster "" + $InvasionTown$ + ".gat",0,0,"Fallen Bishop",1871,1,"zombielose::OnMobKilled";
monster "" + $InvasionTown$ + ".gat",0,0,"Gloom Under Night",1768,1,"zombielose::OnMobKilled";
monster "" + $InvasionTown$ + ".gat",0,0,"High Priest Margaretha",1649,1,"zombielose::OnMobKilled";
monster "" + $InvasionTown$ + ".gat",0,0,"Thanatos",1708,1,"zombielose::OnMobKilled";
//Winning Mobs Below
monster "" + $InvasionTown$ + ".gat",0,0,"Zombie",1015,1,"zombiewin1::OnMobKilled";
monster "" + $InvasionTown$ + ".gat",0,0,"Ragged Zombie",1865,1,"zombiewin2::OnMobKilled";
monster "" + $InvasionTown$ + ".gat",0,0,"Ghoul",1036,1,"zombiewin3::OnMobKilled";
monster "" + $InvasionTown$ + ".gat",0,0,"Zombie Slaughter",1864,1,"zombiewin4::OnMobKilled";
monster "" + $InvasionTown$ + ".gat",0,0,"Zombie",1015,1,"zombiewin5::OnMobKilled";
monster "" + $InvasionTown$ + ".gat",0,0,"High Wizard Kathryn",1651,1,"zombiewin6::OnMobKilled";
monster "" + $InvasionTown$ + ".gat",0,0,"Lord Knight Seyren",1646,1,"zombiewin7::OnMobKilled";
monster "" + $InvasionTown$ + ".gat",0,0,"Zombie",1015,1,"zombiewin8::OnMobKilled";
monster "" + $InvasionTown$ + ".gat",0,0,"Zombie",1015,1,"zombiewin9::OnMobKilled";
monster "" + $InvasionTown$ + ".gat",0,0,"Zombie",1015,1,"zombiewin10::OnMobKilled";

announce "Clouds sweep the skies of Midgard, darkness has risen from the depths of Nifelhiem.",0;
sleep2 5000;
announce "Prontera Guard: Oh no! It's "+ $InvasionTown$ +"! Everyone quick, defend our ally!!",0;
sleep2 5000;
announce "Old Man: Please, heroes! Save us! Pleeeeease!!",0;
sleep2 15000;
announce "Prontera Guard: Everyone advance! Defend "+ $InvasionTown$ +" now!",0;
sleep2 15000;
announce "Rich Man: Ack! Those cursed zombies stole TEN of my treasures!!",0;
end;
}

-	script	zombiewin1	-1,{

OnMobKilled:
	announce "" + strcharinfo(0) + " has recovered one of the ten treasures!",bc_blue;
	set $@MonstersAlive,$@MonstersAlive - 1;
	set $@Treasures,$@Treasures - 1;
	set .attainitem,callfunc("F_RandMes",20,2356,2377,2381,2382,2376,2372,2360,2379,5226,5132,5270,5174,5254,5292,5198,5210,2410,2431,2630,2629);
	getitem .attainitem,1;
	if ($@Treasures>0) end;
	announce "All the treasure has been recovered, but is the town still in need?",0;
	sleep2 25000;
	announce "Lord of "+ $InvasionTown$ +": Please save us from the zombies, please! have a heart!",0;
	end;
	}

-	script	zombiewin2	-1,{

OnMobKilled:
	announce "" + strcharinfo(0) + " has recovered one of the ten treasures!",bc_blue;
	set $@MonstersAlive,$@MonstersAlive - 1;
	set $@Treasures,$@Treasures - 1;
	set .attainitem,callfunc("F_RandMes",20,2356,2377,2381,2382,2376,2372,2360,2379,5226,5132,5270,5174,5254,5292,5198,5210,2410,2431,2630,2629);
	getitem .attainitem,1;
	if ($@Treasures>0) end;
	announce "All the treasure has been recovered, but is the town still in need?",0;
	sleep2 25000;
	announce "Lord of "+ $InvasionTown$ +": Please save us from the zombies, please! have a heart!",0;
	end;
	}

-	script	zombiewin3	-1,{

OnMobKilled:
	announce "" + strcharinfo(0) + " has recovered one of the ten treasures!",bc_blue;
	set $@MonstersAlive,$@MonstersAlive - 1;
	set $@Treasures,$@Treasures - 1;
	set .attainitem,callfunc("F_RandMes",20,2356,2377,2381,2382,2376,2372,2360,2379,5226,5132,5270,5174,5254,5292,5198,5210,2410,2431,2630,2629);
	getitem .attainitem,1;
	if ($@Treasures>0) end;
	announce "All the treasure has been recovered, but is the town still in need?",0;
	sleep2 25000;
	announce "Lord of "+ $InvasionTown$ +": Please save us from the zombies, please! have a heart!",0;
	end;
	}

-	script	zombiewin4	-1,{

OnMobKilled:
	announce "" + strcharinfo(0) + " has recovered one of the ten treasures!",bc_blue;
	set $@MonstersAlive,$@MonstersAlive - 1;
	set $@Treasures,$@Treasures - 1;
	set .attainitem,callfunc("F_RandMes",20,2356,2377,2381,2382,2376,2372,2360,2379,5226,5132,5270,5174,5254,5292,5198,5210,2410,2431,2630,2629);
	getitem .attainitem,1;
	if ($@Treasures>0) end;
	announce "All the treasure has been recovered, but is the town still in need?",0;
	sleep2 25000;
	announce "Lord of "+ $InvasionTown$ +": Please save us from the zombies, please! have a heart!",0;
	end;
	}

-	script	zombiewin5	-1,{

OnMobKilled:
	announce "" + strcharinfo(0) + " has recovered one of the ten treasures!",bc_blue;
	set $@MonstersAlive,$@MonstersAlive - 1;
	set $@Treasures,$@Treasures - 1;
	set .attainitem,callfunc("F_RandMes",20,2356,2377,2381,2382,2376,2372,2360,2379,5226,5132,5270,5174,5254,5292,5198,5210,2410,2431,2630,2629);
	getitem .attainitem,1;
	if ($@Treasures>0) end;
	announce "All the treasure has been recovered, but is the town still in need?",0;
	sleep2 25000;
	announce "Lord of "+ $InvasionTown$ +": Please save us from the zombies, please! have a heart!",0;
	end;
	}

-	script	zombiewin6	-1,{

OnMobKilled:
	announce "" + strcharinfo(0) + " has recovered one of the ten treasures!",bc_blue;
	set $@MonstersAlive,$@MonstersAlive - 1;
	set $@Treasures,$@Treasures - 1;
	set .attainitem,callfunc("F_RandMes",20,2356,2377,2381,2382,2376,2372,2360,2379,5226,5132,5270,5174,5254,5292,5198,5210,2410,2431,2630,2629);
	getitem .attainitem,1;
	if ($@Treasures>0) end;
	announce "All the treasure has been recovered, but is the town still in need?",0;
	sleep2 25000;
	announce "Lord of "+ $InvasionTown$ +": Please save us from the zombies, please! have a heart!",0;
	end;
	}

-	script	zombiewin7	-1,{

OnMobKilled:
	announce "" + strcharinfo(0) + " has recovered one of the ten treasures!",bc_blue;
	set $@MonstersAlive,$@MonstersAlive - 1;
	set $@Treasures,$@Treasures - 1;
	set .attainitem,callfunc("F_RandMes",20,2356,2377,2381,2382,2376,2372,2360,2379,5226,5132,5270,5174,5254,5292,5198,5210,2410,2431,2630,2629);
	getitem .attainitem,1;
	if ($@Treasures>0) end;
	announce "All the treasure has been recovered, but is the town still in need?",0;
	sleep2 25000;
	announce "Lord of "+ $InvasionTown$ +": Please save us from the zombies, please! have a heart!",0;
	end;
	}

-	script	zombiewin8	-1,{

OnMobKilled:
	announce "" + strcharinfo(0) + " has recovered one of the ten treasures!",bc_blue;
	set $@MonstersAlive,$@MonstersAlive - 1;
	set $@Treasures,$@Treasures - 1;
	set .attainitem,callfunc("F_RandMes",20,2356,2377,2381,2382,2376,2372,2360,2379,5226,5132,5270,5174,5254,5292,5198,5210,2410,2431,2630,2629);
	getitem .attainitem,1;
	if ($@Treasures>0) end;
	announce "All the treasure has been recovered, but is the town still in need?",0;
	sleep2 25000;
	announce "Lord of "+ $InvasionTown$ +": Please save us from the zombies, please! have a heart!",0;
	end;
	}

-	script	zombiewin9	-1,{

OnMobKilled:
	announce "" + strcharinfo(0) + " has recovered one of the ten treasures!",bc_blue;
	set $@MonstersAlive,$@MonstersAlive - 1;
	set $@Treasures,$@Treasures - 1;
	set .attainitem,callfunc("F_RandMes",20,2356,2377,2381,2382,2376,2372,2360,2379,5226,5132,5270,5174,5254,5292,5198,5210,2410,2431,2630,2629);
	getitem .attainitem,1;
	if ($@Treasures>0) end;
	announce "All the treasure has been recovered, but is the town still in need?",0;
	sleep2 25000;
	announce "Lord of "+ $InvasionTown$ +": Please save us from the zombies, please! have a heart!",0;
	end;
	}

-	script	zombiewin10	-1,{

OnMobKilled:
	announce "" + strcharinfo(0) + " has recovered one of the ten treasures!",bc_blue;
	set $@MonstersAlive,$@MonstersAlive - 1;
	set $@Treasures,$@Treasures - 1;
	set .attainitem,callfunc("F_RandMes",20,2356,2377,2381,2382,2376,2372,2360,2379,5226,5132,5270,5174,5254,5292,5198,5210,2410,2431,2630,2629);
	getitem .attainitem,1;
	if ($@Treasures>0) end;
	announce "All the treasure has been recovered, but is the town still in need?",0;
	sleep2 25000;
	announce "Lord of "+ $InvasionTown$ +": Please save us from the zombies, please! have a heart!",0;
	end;
	}

-	script	zombielose	-1,{

OnMobKilled:
	set $@MonstersAlive,$@MonstersAlive - 1;
	if ($@MonstersAlive>150) end;
	killmonster "" + $InvasionTown$ + ".gat","All";
	set $@MonstersAlive,0;
	if(isnight() && .@temp_night){
	day;
	set .@temp_night,0;	}
	announce "Lord of "+ $InvasionTown$ +": They're retreating! THANKYOU!! We're saved!!! Thankyou so much!",0;
	end;
	}