Jump to content

NPC "Auto Event" de Stolao, Versión 2.5A


KhrizPlayCL

Recommended Posts


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  17
  • Reputation:   1
  • Joined:  01/31/20
  • Last Seen:  

Estimados, colegas muy buenas tardes recurro a ustedes para poder ajustar el siguiente NPC de "Auto Event" a un emulador Rathena Actualizado, con una versión de cliente 2018 PRE-Renewal, en la siguiente version posteada e logrado corregir algunos errores como por ejemplo:

  1. Las Emociones de los NPC.
  2. Cambie los Item de premio por x50 Poring Coin y 1M de zeny.
  3. Quite el "Evento Shops" ya no se justificaba en mi servidor.
  4. Algunas correcciones de mapas.
  5. Solucionar problema de la función "dispell"

Pero aun no logro corregir algunos errores y es por eso que recurro a ustedes, para que me puedan ayudar

 

  1. El evento de Emp Breaker manda un error despues de agregar la instancia
    • [Info]: [Instance] Created map '0282#000003' (921) from 'sword_1-1' (282).
    • [Error]: status_calc_mob: No castle set at map 0282#000003
  2. El Evento "Poring Event" no se detiene automaticamente despues de tener un ganador.
  3. El Evento "Zombie Event" no termina si solo queda un jugador en pie.

 

//===== EinherjarRO Scripts ==================================
//= Auto Event
//===== By: ==================================================
//= Stolao
//===== Current Version: =====================================
//= 2.5A
//===== Compatible With: =====================================
//= rAthena SVN
//===== Description: =========================================
//= Auto Event
//===== Comments: ============================================
//= [Stolao]
//	db/import/instance_db.txt
//	30,Emp Breaker,900,300,sword_1-1,215,206
//
//	src/map/chat.h
//	#define MAX_CHAT_USERS 20
//		Increase as needed for your server size
//
//===== To Do: ===============================================
//= Make Rewards Editable in game
//= Add A Vote4Event(ingame) Feature
//= Add Events; Invasion, X-O Event, MVP Arena,
//=	Dead Branch, Wiki, Jumper, Fast Type, Safetywall
//= Add Other Requested Events
//= Fix Manually Removing Events Overflow Error (not game breaking)
//===== Additional Comments: =================================
//= 2.38 Added No_Trade flag to bomring and poring events
//= 2.39 Added Find th Baphomet
//= 2.3A Added Grab the Candy!
//= 2.3B Added Monsters Counting (requires the server to be compiled with regular expressions library enabled)
//= 2.3C Combined OnPCLogout Events
//= 2.3D Added Disgusie Event
//= 2.3E Replaced 'strnpcinfo()' type 0 and 1 with type 3
//= 2.3F Removed dependencey on regular expressions library for Disguise and Coutning
//= 2.40 Fixed Poring Event setting mapflags non-dynamic map
//= 2.41 Added Fabre Event
//= 2.42 Fixed Emp Event Failing to annouce not enough players
//= 2.43 Fixed Zombie Failing to start due to negative index
//= 2.44 Added Devil Square
//= 2.45 Certain mapflags no loger removed on events end
//= 2.46 Warp Players to Save instead of Prontera
//= 2.47 Made default time for emp event ~23 Days
//= 2.48 Added a player death check to zombie event
//= 2.49 Fixed a loop issue in PVP
//= 2.4A Players warp to prontera instead of save, apperenetly map warp doesnt support "Save"
//= 2.4B Fixed Lucky Pick
//= 2.4C Fixed a missing "" in maze event
//= 2.4D Added a check so Mushroom Event will always have at least 1 mushroom
//= 2.4E Fixed incorrect map index for Mushroom and Bapho events
//= 2.4F Fixed incorrect event index for Mushroom and Bapho events
//= 2.50 Added a Gm diplay count for mob counting event if Testmode is enabled
//= 2.51 Removed map warp from counting event
//= 2.52 Counting event now properly removes mobs at events end
//= 2.53 Removed SQL dependency from Fabre event
//= 2.54 Added Warp out for disgusie event
//= 2.55 Disabled Countdown timer in disguse event
//= 2.56 Fixed incorrect Rules check
//= 2.57 Added a Gm diplay mob name for disguise event for gm 99
//= 2.58 Fixed incorrect mapindex for disguise event
//= 2.59 Devil Square now rewards all players once last chest is killed
//= 2.5A Fabre event now propery kills monsters at end
//===== Contact Ifo: =========================================
//= [Stolao] 
//= Email: [email protected]
//============================================================

prontera,164,171,4	script	Event Information	835,{

	function Func_Countdown;
	function Func_Add_Time;
	function Func_Prizes;
	freeloop(1);

//==================================
		//-- Special Checks
//==================================

	if($@CurrentEvent == -14){
		if(getgmlevel() >= .GMAccess && .TestMode)
			dispbottom .MobCount[.@Target]+"";
		input .@i;
		if(.@i == .MobCount[.@Target])
			doevent strnpcinfo(3)+"::OnRight";
		else	doevent strnpcinfo(3)+"::OnSpam";
		end;
	}

//==================================
OnMenu:		//-- Click Menus
//==================================

	mes "[ Event Information ]";
	if($@CurrentEvent > 0)
		mes "Current Event: ",.ColorName$[$@CurrentEvent]," ";
	.@Time = gettime(4) * 24 + gettime(3);
	for(.@i = .@Time + ((gettime(2)>.StartTime?1:0)); .@i < .@Time + 168; .@i++){
		if($EVENT_CONTROL[.@i%168]){
			mes "Next Event:",.ColorName$[ $EVENT_CONTROL[ (.@i % 168) ] ] +" ~ "+ .Days$[ .@i % 168 / 24 ] +" - "+ Func_Add_Time( (.@i % 168) % 24);
			.@e += 1;
			break;
		}
	}
	if(!.@e) mes "Auto Events Disabled.";
	switch(select((($@CurrentEvent > 0)?" ~ Join event...:":":")+
			((.@e)?" ~ Check schedule...:":":")+
			((getgmlevel() < .GMAccess)?":":" ~ Manage events...:")+
			(($@EventRanking & 1)?" ~ Monthly Ranking:":":")+
			(($@EventRanking & 2)?" ~ Lifetime Ranking:":":")+
			": ~ ^777777Cancel^000000")) {
		case 2:
			for(.@i = 0; .@i < 168; .@i++){
				if( !( ( .@i ) % 24 )){
					next;
					mes "[ "+ .Days$[.@i / 24] +" Event Schedule ]";
				}
				if($EVENT_CONTROL[.@i])
					mes .ColorName$[$EVENT_CONTROL[.@i]] +" ~ "+ Func_Add_Time(.@i % 24);
			}	
			close;
		case 4:
			query_sql("SELECT char_id, CAST(`value` AS SIGNED) FROM `char_reg_num` WHERE `key` = 'MWonEvents' ORDER BY CAST(`value` AS SIGNED) DESC LIMIT 10",.@cid,.@value);
		case 5:
			if(!.@cid)
				query_sql("SELECT char_id, CAST(`value` AS SIGNED) FROM `char_reg_num` WHERE `key` = 'WonEvents' ORDER BY CAST(`value` AS SIGNED) DESC LIMIT 10",.@cid,.@value);
			for(.@x = 0; .@x < getarraysize(.@cid); .@x++) {
				query_sql("SELECT `name` FROM `char` WHERE char_id = "+.@cid[.@x]+";",.@j$);
				.@name$[.@x] = .@j$;
			}
			next;
			mes "~ ^990000"+((.@m)?"Monthly ":"") +"Event Ladder^000000 ~";
			if (!getarraysize(.@cid))
				mes "The rankings are empty.";
			else {
				for(.@i = 0; .@i < getarraysize(.@cid); .@i++)
					mes "#"+(.@i+1)+" ^0000FF"+.@name$[.@i]+"^000000 "+.@value[.@i];
			}
			close;
		case 3:
		while(1){
			switch(select(" ~ Add an event...: ~ Delete an event...: ~ End current event: ~ Randomize event list: ~ Add event type: ~ Remove event type: ~ Reset queue:~ ^777777Go back^000000")) {
				case 3:	next;
					goto OnEndEvent;
				case 4:	next;
					goto OnRandomize;
				case 5:	next;
					goto OnAddType;
				case 6:	next;
					goto OnRemoveType;
				case 7:	next;
					goto OnClear;
				case 8:	next;
					goto OnMenu;
				case 1:
					next;
					mes "[ Add Event ]";
					mes "Pick a Day.";
					.@Day = select(" ~ "+implode(.Days$,": ~ ")) - 1;
					next;
					mes "[ Add Event ]";
					mes "Pick a Time for ^0055FF"+.Days$[.@D / 24]+".";
					.@menu$ = "";
					.@e = 0;
					for(.@i = .@Day * 24; .@i < .@Day * 24 + 24; .@i++){
						if(!$EVENT_CONTROL[.@i]){
							.@menu$ = .@menu$ +" ~ "+ Func_Add_Time( .@i % 24 ) +":";
							.@e += 1;
						} else	.@menu$ = .@menu$ + ":";
					}
					if(!.@e){
						mes "No Events Times Remaining for "+ .Days$[ .@Day ] +".";
						close;
					}
					.@D = select(.@menu$) + .@Day * 24 - 1;
					next;
					mes "[ Add Event ]";
					mes "Select a event for ^0055FF"+ .Days$[.@D / 24] +" ~ "+ Func_Add_Time(.@D % 24) +"^000000.";
					next;
					.@Event = select(implode(.ColorName$,": ~ ")) - 1;
					mes "Are you sure you want to add "+ .ColorName$[.@Event] +",";
					mes "for ^0055FF"+ .Days$[.@D / 24] +" ~ "+ Func_Add_Time(.@D % 24) +"^000000?";
					next;
					.@A = (select(" ~ ^0000CCAdd event...^000000: ~ ^777777Cancel^000000"));
					mes "[ Add Event ]";
					if(.@A == 2)
						mes "Cancelled.";
					else {
						$EVENT_CONTROL[.@D] = .@Event;
						mes "Event Added.";
					}
					break;
				case 2:
					next;
					mes "[ Remove Event ]";
					mes "Which Event?";
					.@menu$ = "";
					for(.@i = .@e = 0; .@i < 168; .@i++){
						if($EVENT_CONTROL[.@i]){
							.@menu$ = .@menu$ + .Days$[ .@i / 24 ] +" - "+ Func_Add_Time( .@i % 24 ) +" ~ "+ .ColorName$[ $EVENT_CONTROL[ .@i ] ]+":";
							.@e += 1;
						} else	.@menu$ = .@menu$ + ":";
					}
					if(!.@e){
						mes "No Events Setup.";
						close;
					}
					.@D = select(.@menu$) - 1;
					next;
					mes "[ Remove Event ]";
					mes "Are you sure you want to add the "+ .ColorName$[.@D] +",";
					mes "for ^0055FF"+ .Days$[.@D % 168 / 24] +" ~ "+ Func_Add_Time(.@D % 168 / 24) +"^000000?";
					.@A = (select(" ~ ^FF0000Remove event...^000000: ~ ^777777Cancel^000000"));
					if(.@A == 2){
						mes "Cancelled.";
					} else {
						$EVENT_CONTROL[.@D] = 0;
						mes "Event Removed.";
					}
					break;
			}
		}
		case 6: close;
		case 1:
			next;
			break;
	}

//==================================
OnJoinEvent:	//-- Join Event
//==================================

	if($@CurrentEvent < 1)
		mes "[ Event Management ]","Sorry no event is running.";
	else {
		mes "[ "+ .EventName$[$@CurrentEvent] +" ]","Want to join the "+ .ColorName$[$@CurrentEvent] +"?";
		if($@CurrentEvent == 2)
			mes "[ "+ .EventName$[$@CurrentEvent] +" ]","Must be a Novice Level 10/10 or lower.";
		if($@CurrentEvent == 5 || $@CurrentEvent == 6 || $@CurrentEvent == 7)
			mes "[ "+ .EventName$[$@CurrentEvent] +" ]","Will have any Carts or Pets Removed.";
		if(select("Yes:No") == 2)
			mes "[ "+ .EventName$[$@CurrentEvent] +" ]","Ok come back later.",bc_self|bc_blue;
		else if((Baselevel > 10 || JobLevel > 10 || Class != Job_Novice ) && $@CurrentEvent == 2)
			mes "[ "+ .EventName$[$@CurrentEvent] +" ]","Sorry you must be a Novice Level 10/10 or lower.";
		else if($@CurrentEvent < 1)
			mes "[ Event Management ]","Sorry event closed before you hit yes.";
		else {
			if($@CurrentEvent == 5 || $@CurrentEvent == 6 || $@CurrentEvent == 7 || $@CurrentEvent == 13){
				setmadogear 0;
				setdragon 0;
				if (checkwug())
					setoption Option_Wugrider,0;
				if(ismounting())
					setmounting;
				setriding 0;
				setfalcon 0;
				setcart 0;
				callfunc("dispell");
			} else if($@CurrentEvent == 2)
				callfunc("dispell");
			if($@CurrentEvent == 13){
				.register_aid[ .register_count ] = getcharid(3);
				.register_count++;
				delitem .candy_id, countitem( .candy_id );
			}
			fabre = 0;
			warp .EnterMap$[$@CurrentEvent],.EnterX[$@CurrentEvent],.EnterY[$@CurrentEvent];
		}
	}
	close;

//==================================
OnRandomize:	//-- Randomize Event
//==================================

	mes "[ Randomize Event ]";
	mes "Chance of no event?";
	input(.@j,0,100);
	freeloop(1);
	for(.@i = 0; .@i < 168; .@i++){
		if(rand(100) < .@j){
			$EVENT_CONTROL[.@i] = 0;
			continue;
		}
		$EVENT_CONTROL[.@i] = rand(getarraysize(.EventName$));
		if($EVENT_CONTROL[.@i] == .@lastevent)
			$EVENT_CONTROL[.@i] = rand(getarraysize(.EventName$));
		.@lastevent = $EVENT_CONTROL[.@i];
	}
	freeloop(0);
	next;
	mes "[ Randomize Event ]";
	mes "Events set.";
	close;

//==================================
OnClear:	//-- Clear Event
//==================================

	mes "[ Clear Event Queue ]";
	mes "Wipe the event Queue?";
	if(select("No:Yes")== 1)
		close;
	freeloop(1);
	for(.@i = 0; .@i < 168; .@i++)
		$EVENT_CONTROL[.@i] = 0;
	freeloop(0);
	next;
	mes "[ Clear Event Queue ]";
	mes "Events Cleared.";
	close;

//==================================
OnRemoveType:	//-- Remove Event Type
//==================================

	mes "[ Remove Event Type ]";
	Mes "Which Event Would you Like to remove?";
	.@select = select(implode(.ColorName$,": ~ ")) - 1;
	next;
	mes "[ Remove Event Type ]";
	mes "Are you sure you want to remove all "+.ColorName$[.@select]+"?";
	if(select("No:Yes")== 1)
		close;
	freeloop(1);
	for(.@i = 0; .@i < 168; .@i++){
		if($EVENT_CONTROL[.@i] == .@select){
			$EVENT_CONTROL[.@i] = 0;
			continue;
		}
	}
	freeloop(0);
	next;
	mes "[ Remove Event Type ]";
	mes "All "+.ColorName$[.@select]+" Events Removed.";
	close;

//==================================
OnAddType:	//-- Add Event Type
//==================================

	mes "[ Add Event Type ]";
	Mes "Which Event Would you Like to add?";
	.@select = select(implode(.ColorName$,": ~ ")) - 1;
	next;
	mes "[ Add Event Type ]";
	mes "What chance would you like "+.ColorName$[.@select]+" to appear?";
	input(.@j,0,100);
	next;
	mes "[ Add Event Type ]";
	mes "Would you like "+.ColorName$[.@select]+" to overwrite other events?";
	.@Over = select("No:Yes") - 1;
	next;
	mes "[ Add Event Type ]";
	mes "Are you sure you want to add "+.ColorName$[.@select]+" at a "+.@j+"% chance"+((.@Over)?" overwriting other events":"")+"?";
	if(select("No:Yes")== 1)
		close;
	freeloop(1);
	for(.@i = 0; .@i < 168; .@i++){
		if(rand(100) > .@j || (!.@Over && $EVENT_CONTROL[.@i]))
			continue;
		else $EVENT_CONTROL[.@i] = .@select;
	}
	freeloop(0);
	next;
	mes "[ Add Event Type ]";
	mes .ColorName$[.@select]+" Added.";
	close;

//==================================
OnEndEvent:	//-- End Event
//==================================

	if($@CurrentEvent == 0){
		mes "[ Event Management ]","Sorry no event is running.";
		close;
	}
	if($@CurrentEvent < 0)
		$@CurrentEvent *= -1;
	switch($@CurrentEvent){
		default:
			mapwarp .EnterMap$[$@CurrentEvent],"prontera",155,172;
		case 1:	case 8:	case 7:
			break;
		case 11:
			killmonster .Map$[11],strnpcinfo(3)+"::OnShroomKilled";
			break;
		case 14:
			killmonster .Map$[14],strnpcinfo(3)+"::OnKilled";
			break;
	}
	Announce "Sorry a GM has stopped the "+ .EventName$[$@CurrentEvent] +".",bc_all|bc_blue;
	$@CurrentEvent = 0;
	delwaitingroom;
	end;

//==================================
OnRunEvent:	//-- GM Run
//==================================

	if($@CurrentEvent)
		mes "[ Event Management ]","Sorry an event is already running";
	else if(agitcheck() || agitcheck2())
		mes "[ Event Management ]","Sorry cannot run event during woe";
	else {
		mes "[ Event Management ]","Pick an Event.";
		.@i = select(implode(.ColorName$,": ~ ") +":Bug Test") - 1;
	} 
	switch(.@i){
		case 0:							break;
		case 1: donpcevent strnpcinfo(3)+"::OnEmpStart";	break;
		case 2: donpcevent strnpcinfo(3)+"::OnZombieStart";	break;
		case 3: donpcevent strnpcinfo(3)+"::OnDiceStart";	break;
		case 4: donpcevent strnpcinfo(3)+"::OnPvPStart";	break;
		case 5: donpcevent strnpcinfo(3)+"::OnMazeStart";	break;
		case 6: donpcevent strnpcinfo(3)+"::OnPoringStart";	break;
		case 7: donpcevent "Cluckers::OnEventStart";		break;
		case 8: donpcevent strnpcinfo(3)+"::OnLuckyStart";	break;
		case 9: donpcevent strnpcinfo(3)+"::OnBombStart";	break;
		case 10: donpcevent strnpcinfo(3)+"::OnHuntStart";	break;
		case 11: donpcevent strnpcinfo(3)+"::OnShroomStart";	break;
		case 12: donpcevent strnpcinfo(3)+"::OnBaphoStart";	break;
		case 13: donpcevent strnpcinfo(3)+"::OnCandyStart";	break;
		case 14: donpcevent strnpcinfo(3)+"::OnCountStart";	break;
		case 15: donpcevent strnpcinfo(3)+"::OnDisguiseStart";	break;
		case 16: donpcevent strnpcinfo(3)+"::OnFabreStart";	break;
		case 17: donpcevent strnpcinfo(3)+"::OnDevilStart";	break;


		default: Func_Prizes(getcharid(0),"Bug Test");		break;
	}
	close;

//==================================
		//-- Functions
//==================================

function Func_Add_Time {
	return ( ( (getarg(0) < 10)?"0":"" ) + getarg(0) + "." + ( (.StartTime < 10)?"0":"" ) + .StartTime );
}

function Func_Countdown {
	for(.@i = 5; .@i > 0; .@i--){
		announce .EventName$[$@CurrentEvent]+" will begin in "+ callfunc("F_InsertPlural",.@i,"minute") +"!",bc_all|bc_blue;
		Announce "Please type @joinevent to join",bc_all|bc_blue;
		if(.TestMode)
			sleep 6000;
		else	sleep 60000;
	}
	Announce .EventName$[$@CurrentEvent] +" Has Begun!",bc_all|bc_blue;
	return;
}

function Func_Prizes {
	announce "Congrats "+strcharinfo(0,getarg(0))+", a winner in the "+getarg(1)+" Event.",bc_all|bc_blue;
	WonEvents++;
	MWonEvents++;
	if($@Mail){
		mail getarg(0), "no-reply", getarg(1), "Congratulations!% You have won in the "+getarg(1)+" % % %[ Your reward is attached. ]", $@RewardZeny, $@RewardID, $@RewardQNT;
		query_sql("UPDATE `mail` SET message = REPLACE(message,'%',CHAR(13)) WHERE send_name = 'no-reply'");
	} else {
		getitem $@RewardID,$@RewardQNT;
		zeny += $@RewardZeny;
	}
	return;
}

//==================================
OnMinute00:	//- Start Events
//==================================

	if(gettime(DT_DAYOFMONTH) == 1 && gettime(DT_HOUR) == 0)
		query_sql("DELETE FROM `char_reg_num` WHERE `key` = 'MWonEvents'");
	if(agitcheck() || agitcheck2() || $@CurrentEvent) end;
	sleep .StartTime * 60000 + 1000;
	.@Time = gettime(4) * 24 + gettime(3);
	switch($EVENT_CONTROL[.@Time]){
		default:						break;
		case 1: donpcevent strnpcinfo(3)+"::OnEmpStart";	break;
		case 2: donpcevent strnpcinfo(3)+"::OnZombieStart";	break;
		case 3: donpcevent strnpcinfo(3)+"::OnDiceStart";	break;
		case 4: donpcevent strnpcinfo(3)+"::OnPvPStart";	break;
		case 5: donpcevent strnpcinfo(3)+"::OnMazeStart";	break;
		case 6: donpcevent strnpcinfo(3)+"::OnPoringStart";	break;
		case 7: donpcevent "Cluckers::OnEventStart";		break;
		case 8: donpcevent strnpcinfo(3)+"::OnLuckyStart";	break;
		case 9: donpcevent strnpcinfo(3)+"::OnBombStart";	break;
		case 10: donpcevent strnpcinfo(3)+"::OnHuntStart";	break;
		case 11: donpcevent strnpcinfo(3)+"::OnShroomStart";	break;
		case 12: donpcevent strnpcinfo(3)+"::OnBaphoStart";	break;
		case 13: donpcevent strnpcinfo(3)+"::OnCandyStart";	break;
		case 14: donpcevent strnpcinfo(3)+"::OnCountStart";	break;
		case 15: donpcevent strnpcinfo(3)+"::OnDisguiseStart";	break;
		case 16: donpcevent strnpcinfo(3)+"::OnFabreStart";	break;
		case 17: donpcevent strnpcinfo(3)+"::OnDevilStart";	break;
	}
	end;

//==================================
OnEmpStart:	//-- Emperium Event
//==================================

	$@CurrentEvent = 1;
	waitingroom "Emperium Event",99;
	Func_Countdown;
	$@CurrentEvent = -1;
	$@BestTime = 2000000000;
	$@BestCid = 0;
	getwaitingroomusers strnpcinfo(3);
	if(.@waitingroom_usercount >= .MinPlayers[1]){
		freeloop(1);
		for(.@i = 0; .@i < .@waitingroom_usercount; .@i++){
			attachrid(.@waitingroom_users[.@i]);
			callfunc("dispell");
			if(instance_id())
				instance_destroy;
			instance_create("Emp Breaker",IM_CHAR);
			instance_enter("Emp Breaker");
		}
		freeloop(0);
		delwaitingroom;
		sleep 905000;	// 15 mins should be enough?
	} else {
		delwaitingroom;
		announce .EventName$[1]+" Stopped! Not Enough Players Joined the "+.EventName$[1]+"!",bc_blue|bc_area|bc_npc;
	}
	if($@BestCid && $@CurrentEvent == -1)
		Func_Prizes($@BestCid,.EventName$[1]);
	$@CurrentEvent = 0;
	end;

//==================================
OnZombieStart:	//-- Zombie Event
//==================================

	mapwarp .EnterMap$[2],"prontera",155,172;
	$@CurrentEvent = 2;
	Func_Countdown;
	$@CurrentEvent = -2;
	if(getmapusers(.EnterMap$[2]) < .MinPlayers[2]){
		mapannounce .EnterMap$[2],.EventName$[2]+" Stopped! Not Enough Players Joined the "+.EventName$[2]+"!",bc_blue;
		mapwarp .EnterMap$[2],"prontera",155,172;
	} else {
		mapannounce .EnterMap$[2],"Rules are simple, don't die before the end of round 10!",bc_blue;
		sleep 25000;
		for(.@wave = 1; .@wave < 11; .@wave++){
			if(.@wave < 10)
				mapannounce .EnterMap$[2],"Wave "+.@wave+"!",bc_blue;
			else	mapannounce .EnterMap$[2],"FINAL WAVE!",bc_blue;
			sleep 1000;
			for(.@i = 5; .@i > 0; .@i--){
				mapannounce .EnterMap$[2],""+.@i+"...",bc_blue;
				sleep 1000;
			}
			mapannounce .EnterMap$[2],"Begin Wave!",bc_blue;
			for(.@i = 0; (.@i < getarraysize(.Zombies)); .@i += 2)
				monster .EnterMap$[2],0,0,"--ja--",.Zombies[.@i], .@wave * .Zombies[.@i+1],strnpcinfo(3)+"::OnKillZombie";
			if(!getmapusers(.EnterMap$[2])){
				.@wave += 255;
			} else {
				mapannounce .EnterMap$[2],"There "+((getmapusers(.EnterMap$[2])>1)?"are":"is")+" "+callfunc("F_InsertPlural",getmapusers(.EnterMap$[2]),"player")+" left",bc_blue;
				sleep 55000;
			}
		}
		killmonsterall .EnterMap$[2];
		if(getmapusers(.EnterMap$[2])){
			addrid(5,0,.EnterMap$[2]);
			if(HP > 0 && strcharinfo(3) == .EnterMap$[2])
				Func_Prizes(getcharid(0),.EventName$[2]);
		}
	}
	$@CurrentEvent = 0;
	mapwarp .EnterMap$[2],"prontera",155,172;
	end;

OnKillZombie:
	dispbottom "Don't do that",0xCC0000;
	sc_start SC_DECREASEAGI,30000,10;
	percentheal -20,-100;
	heal -5,0;
	end;

//==================================
OnDiceStart:	//-- Dice Event 
//==================================

	mapwarp .EnterMap$[3],"prontera",155,172;
	$@CurrentEvent = 3;
	Func_Countdown;
	$@CurrentEvent = -3;
	if(getmapusers(.EnterMap$[3]) < .MinPlayers[3]){
		mapannounce .EnterMap$[3],"Event Stopped! Not Enough Players Joined the "+.EventName$[3]+"!",bc_blue;
		mapwarp .EnterMap$[3],"prontera",155,172;
		$@CurrentEvent = 0;
		end;
	} else {
		mapannounce .EnterMap$[3],"Ok the rules of "+.EventName$[3]+" are as follows",bc_blue;
		sleep 5000;
		mapannounce .EnterMap$[3],"Each player picks a box 1, 2, 3 or 4",bc_blue;
		sleep 5000;
		mapannounce .EnterMap$[3],"There will be a count down from 10 to 0",bc_blue;
		sleep 5000;
		mapannounce .EnterMap$[3],"at 0 a four sided die will be rolled",bc_blue;
		sleep 5000;
		mapannounce .EnterMap$[3],"Anyone in the box of the number rolled will be warped to town",bc_blue;
		sleep 5000;
		mapannounce .EnterMap$[3],"as well as anyone on the stairs or outside the box",bc_blue;
		sleep 5000;
		mapannounce .EnterMap$[3],"the number of players remaining will be announced",bc_blue;
		sleep 5000;
		mapannounce .EnterMap$[3],"this prosses will repeat till only one player remains",bc_blue;
		sleep 5000;
		mapannounce .EnterMap$[3],"take a few moments to fnd a box",bc_blue;
		sleep 15000;
		mapannounce .EnterMap$[3],"we will now begin, please find a box",bc_blue;
		sleep 5000;
		for(.@1234 = 0; .@1234 < 100; .@1234++){
			for(.@i = 10; .@i > 0; .@i--){
				mapannounce .EnterMap$[3],.@i+"...",bc_blue;
				sleep 1000;
			}
			.@i = rand(1,4);
			mapannounce .EnterMap$[3],"0... Good Bye Box "+.@i,bc_blue;
			switch(.@i){
				case 1:	areawarp .EnterMap$[3],183,81,191,59,"prontera",155,172;	break;
				case 2:	areawarp .EnterMap$[3],195,81,203,59,"prontera",155,172;	break;
				case 3:	areawarp .EnterMap$[3],207,81,215,59,"prontera",155,172;	break;
				case 4:	areawarp .EnterMap$[3],219,81,227,59,"prontera",155,172;	break;
			}
			areawarp .EnterMap$[3],182,94,228,88,"prontera",155,172;	//Upper Area
			areawarp .EnterMap$[3],185,87,188,82,"prontera",155,172;	//Stairs 1
			areawarp .EnterMap$[3],197,87,200,82,"prontera",155,172;	//Stairs 2
			areawarp .EnterMap$[3],209,87,212,82,"prontera",155,172;	//Stairs 3
			areawarp .EnterMap$[3],221,87,224,82,"prontera",155,172;	//Stairs 4
			if(getmapusers(.EnterMap$[3]) <= 1){
				.@1234 += 100;
			} else {
				mapannounce .EnterMap$[3],"There are "+getmapusers(.EnterMap$[3])+" Players Remaining.",bc_blue;
				mapannounce .EnterMap$[3],"Take a few moments if you want to change boxes.",bc_blue;
				sleep 20000;
			}
		}
		if(getmapusers(.EnterMap$[3])){
			addrid(5,0,.EnterMap$[3]);
			if(HP > 0 && strcharinfo(3) == .EnterMap$[3])
				Func_Prizes(getcharid(0),.EventName$[3]);
		}
		$@CurrentEvent = 0;
		mapwarp .EnterMap$[3],"prontera",155,172;
		end;
	}

//==================================
OnPvPStart:	//-- PvP Event
//==================================

	mapwarp .EnterMap$[4],"prontera",155,172;
	pvpoff .EnterMap$[4];
	$@CurrentEvent = 4;
	Func_Countdown;
	$@CurrentEvent = -4;
	.@count = getmapusers(.EnterMap$[4]);
	if(.@count < .MinPlayers[4]){
		mapannounce .EnterMap$[4],"Event Stopped! Not Enough Players Joined the "+.EventName$[4]+"!",bc_blue;
	} else {
		mapannounce .EnterMap$[4],"The Rules of "+.EventName$[4]+" are as follows",bc_blue;
		sleep 5000;
		mapannounce .EnterMap$[4],"This is a Free for all Last man Standing",bc_blue;
		sleep 5000;
		mapannounce .EnterMap$[4],"There is a 20 min time limit in place if there is no clear winner within 20 mins the Event ends",bc_blue;
		sleep 5000;
		mapannounce .EnterMap$[4],"Everyone has 1 Life so Res, Ygg Leafs and Kazail don't work",bc_blue;
		sleep 5000;
		mapannounce .EnterMap$[4],"Spread out PVP will begin in 10...",bc_blue;
		sleep 1000;
		for(.@i = 9; .@i > 0; .@i--){
			mapannounce .EnterMap$[4],.@i+"...",bc_blue;
			sleep 1000;
		}
		pvpon .EnterMap$[4];
		mapannounce .EnterMap$[4],"Begin",bc_blue;
		sleep 5000;
		freeloop(1);
		for(.@i = 1; .@i <= 360; .@i++){
			.@count[.@i] = getmapusers(.EnterMap$[4]);
			if(.@count[.@i] != .@count[.@i - 1]){
				if(.@count[.@i] < 2){
					.@i += 10000;
				} else	mapannounce .EnterMap$[4],"There are "+getmapusers(.EnterMap$[4])+" Players Remaining",bc_blue;
			}	
			sleep 5000;
		}
		freeloop(0);	
		if(getmapusers(.EnterMap$[4]) == 1){
			addrid(5,0,.EnterMap$[4]);
			if(HP > 0 && strcharinfo(3) == .EnterMap$[4])
				Func_Prizes(getcharid(0),.EventName$[4]);
		} else	mapannounce .EnterMap$[4],"Time Is up",bc_blue;
	}
	pvpoff .EnterMap$[4];
	$@CurrentEvent = 0;
	mapwarp .EnterMap$[4],"prontera",155,172;
	end;

//==================================
OnMazeStart:	//-- Maze Event
//==================================

	mapwarp .EnterMap$[5],"prontera",155,172;
	enablenpc "mazeroadblock";
	disablenpc "Event_Agent#Maze";
	$@CurrentEvent = 5;
	for ( .@i = 0; .@i < getarraysize( .bombflag ); .@i++ )
		setmapflag .EnterMap$[5], .bombflag[.@i];
	Func_Countdown;
	$@CurrentEvent = -5;
	sleep 9000;
	if(getmapusers(.EnterMap$[5]) < .MinPlayers[5])
		mapannounce .EnterMap$[5],"Event Stopped! Not Enough Players Joined the "+.EventName$[5]+"!",bc_blue;
	else {
		mapannounce .EnterMap$[5],"Rules are simple first to get to end of maze wins, so begin~",bc_blue;
		disablenpc "mazeroadblock";
		enablenpc "Event_Agent#Maze";
		for(.@maze = 40; .@maze > 0; .@maze--){
			if(getmapusers(.EnterMap$[5])<1) .@maze = 0;
			mapannounce .EnterMap$[5],"There are "+(.@maze)+" Minuets Remaining",bc_blue;
			sleep 60000;
		}
		mapannounce .EnterMap$[5],"Time Is up",bc_blue;
	}
	for ( .@i = 6; .@i < getarraysize( .bombflag ); .@i++ )
		removemapflag .EnterMap$[5], .bombflag[.@i];
	disablenpc "Event_Agent#Maze";
	sleep 5000;
	mapwarp .EnterMap$[5],"prontera",155,172;
	$@CurrentEvent = 0;
	end;

//==================================
OnPoringStart:	//-- Poring Event
//==================================

	mapwarp .EnterMap$[6],"prontera",155,172;
	$@CurrentEvent = 6;
	pvpoff .EnterMap$[6];
	for ( .@i = 0; .@i < getarraysize( .bombflag ); .@i++ )
		setmapflag .EnterMap$[6], .bombflag[.@i];
	Func_Countdown;
	$@CurrentEvent = -6;
	if(getmapusers(.EnterMap$[6]) < .MinPlayers[6]){
		mapannounce .EnterMap$[6],"Event Stopped! Not Enough Players Joined the "+.EventName$[6]+"!",bc_blue;
	} else {
		mapannounce .EnterMap$[6],"Rules are simple",bc_blue;
		sleep 3000;
		mapannounce .EnterMap$[6],"Kill the 'Poring' with the correct name, and get a warped to town with a prize.",bc_blue;
		sleep 4000;
		mapannounce .EnterMap$[6],"Kill the wrong one and get warped to town with nothing.",bc_blue;
		sleep 4000;
		mapannounce .EnterMap$[6],"There are 2 right poring and a 30 min timer.",bc_blue;
		sleep 4000;
		mapannounce .EnterMap$[6],"Event will now Begin~",bc_blue;
		for(.@i = 0; .@i < getarraysize(.Poring$); .@i++)
			monster .EnterMap$[6],0,0,.Poring$[.@i],1725,5,strnpcinfo(3)+"::OnKillWrong";
		monster .EnterMap$[6],0,0,"--ja--",1725,.PoringSpawn,strnpcinfo(3)+"::OnKillRight";
		.PoringSpawn = 2;
 		for(.@poring = 30; .@poring > 0; .@poring--){
			if(getmapusers(.EnterMap$[6]) < 1) .@poring = 0;
			mapannounce .EnterMap$[6],callfunc("F_InsertPlural",.@poring,"Minute")+" Remaining.",bc_blue;
			sleep 60000;
		}
	}
	if(!.PoringLeft){
		mapannounce .EnterMap$[6],"Time Is up",bc_blue;
		killmonsterall .EnterMap$[6];
		for ( .@i = 6; .@i < getarraysize( .bombflag ); .@i++ )
			removemapflag .EnterMap$[6], .bombflag[.@i];
		$@CurrentEvent = 0;
		sleep 5000;
		mapwarp .EnterMap$[6],"prontera",155,172;
	}
	end;

OnKillWrong:
	monster .EnterMap$[6],0,0,.Poring$[rand(1,getarraysize($@Mobs))],1725,1,strnpcinfo(3)+"::OnKillWrong";
	warp "prontera",155,172;
	end;

OnKillRight:
	Func_Prizes(getcharid(0),.EventName$[6]);
	warp "prontera",155,172;
	.PoringLeft--;
	if(!.PoringLeft){
		mapannounce .EnterMap$[6],"Time Is up",bc_blue;
		killmonsterall .EnterMap$[6];
		for ( .@i = 6; .@i < getarraysize( .bombflag ); .@i++ )
			removemapflag .EnterMap$[6], .bombflag[.@i];
		$@CurrentEvent = 0;
		sleep 5000;
		mapwarp .EnterMap$[6],"prontera",155,172;
	}
	end;

//==================================
OnLuckyStart:	//-- Lucky Event
//==================================

	$@CurrentEvent = 8;
	.luckywinner = 0;
	waitingroom "Lucky Event",99;
	Func_Countdown;
	getwaitingroomusers strnpcinfo(3);
	.luckywinner = .@waitingroom_users[rand(.@waitingroom_usercount)];
	$@CurrentEvent = -8;
	if(.@waitingroom_usercount >= .MinPlayers[8]){
		attachrid(.luckywinner);
		Func_Prizes(getcharid(0),.EventName$[8]);
	} else	announce .EventName$[8]+" Stopped! Not Enough Players Joined the "+.EventName$[8]+"!",bc_blue|bc_area|bc_npc;
	delwaitingroom;
	$@CurrentEvent = 0;
	.luckywinner = 0;
	end;

//==================================
OnBombStart:	//-- Bombring Event
//==================================

	mapwarp .EnterMap$[9],"prontera",155,172;
	$@CurrentEvent = 9;
	Func_Countdown;
	$@CurrentEvent = -9;
	.@totalplayers = getmapusers(.EnterMap$[9]);
	if(.@totalplayers < .MinPlayers[9]){
		mapannounce .EnterMap$[9],"Event Stopped! Not Enough Players Joined the "+.EventName$[9]+"!",bc_blue;
		mapwarp .EnterMap$[9],"prontera",155,172;
	} else {
		for ( .@i = 0; .@i < getarraysize( .bombflag ); .@i++ )
			setmapflag .EnterMap$[9], .bombflag[.@i];
		mapannounce .EnterMap$[9],"Okay listen up, this is how it works.",bc_blue;
		sleep 2000;
		mapannounce .EnterMap$[9],"Bombrings will run rampant in this area.",bc_blue;
		sleep 2000;
		mapannounce .EnterMap$[9],"and all of them will go booooooom!",bc_blue;
		sleep 2000;
		mapannounce .EnterMap$[9],"all you have to do is avoid them and stay alive :P",bc_blue;
		sleep 2000;
		mapannounce .EnterMap$[9],"This will run for 30 seconds for 5 total rounds.",bc_blue;
		sleep 2000;
		mapannounce .EnterMap$[9],"Sooooooooooo, ready or not here they come!!!",bc_blue;
		sleep 10000;
		for(.@wave = 1; .@wave <= .Bombwaves; .@wave++){
			if(.@wave < .Bombwaves){
				mapannounce .EnterMap$[9],"Wave "+.@wave+"!",bc_blue;
			} else	mapannounce .EnterMap$[9],"FIANL WAVE!",bc_blue;
			if (.@wave * .@totalplayers < 60)
				areamonster .EnterMap$[9],48,334,71,357,"Run for you life!",1904,.@wave * .@totalplayers;
			else	areamonster .EnterMap$[9],48,334,71,357,"Run for you life!",1904,60;
			if(!getmapusers(.EnterMap$[9]))
				.@wave += 5;
			else	sleep 1500 * .Bombwaves / .@wave;
		}
		sleep 10000;
		if(getmapusers(.EnterMap$[9])){
			addrid(5,0,.EnterMap$[9]);
			if(HP > 0 && strcharinfo(3) == .EnterMap$[9])
				Func_Prizes(getcharid(0),.EventName$[9]);
		}
		for ( .@i = 6; .@i < getarraysize( .bombflag ); .@i++ )
			removemapflag .EnterMap$[9], .bombflag[.@i];
	}
	$@CurrentEvent = 0;
	mapwarp .EnterMap$[9],"prontera",155,172;
	end;

//==================================
OnHuntStart:	//-- Man Hunt Event
//==================================

	mapwarp .EnterMap$[10],"prontera",155,172;
	$@CurrentEvent = 10;
	Func_Countdown;
	$@CurrentEvent = -10;
	if(getmapusers(.EnterMap$[10]) < .MinPlayers[10]){
		mapannounce .EnterMap$[10],"Event Stopped! Not Enough Players Joined the "+.EventName$[10]+"!",bc_blue;
	} else {
		mapannounce .EnterMap$[10],"The goal is this event is to kill the target within 60 seconds.",bc_blue;
		sleep 5000;
		mapannounce .EnterMap$[10],"The one who managed to kill the target will gain a prize",bc_blue;
		sleep 5000;
		mapannounce .EnterMap$[10],"But if the target surivived, the target will gain the prize",bc_blue;
		sleep 5000;
		mapannounce .EnterMap$[10],"Man-Hunt Event start!",bc_blue;
		for(.@round = 1; .@round <= 10; .@round++){
			if(getmapusers(.EnterMap$[10]) < 3){
				mapannounce .EnterMap$[10],"Sorry there are no longer enough players for another round",bc_blue;
			} else {
				if(.@round < 10)
				mapannounce .EnterMap$[10],"Next Round will begin in 10 seconds!",bc_blue;
				deletearray .@AID[0],getarraysize(.@AID);
				addrid(5,0,.EnterMap$[10]);
				.@AID[getarraysize(.@AID)] = getcharid(3);
				$@Target = rand(getarraysize(.@AID));
				sleep 10000;
				mapannounce .EnterMap$[10],"[Round "+.@round+"] Our target is "+rid2name($@Target)+"!",bc_blue;
				charcommand "killable "+rid2name($@Target);
				charcommand "size "+rid2name($@Target)+" 2";
				sleep 60000;
				if($@Target != -1){
					if(attachrid($@Target) && strcharinfo(3) == .EnterMap$[10])
						Func_Prizes(getcharid(0),.EventName$[10]);
				}
				charcommand "alive "+rid2name($@Target);
				charcommand "killable "+rid2name($@Target);
				charcommand "size "+rid2name($@Target)+" 0";
			}
		}
	}
	sleep 5000;
	mapwarp .EnterMap$[10],"prontera",155,172;
	$@CurrentEvent = 0;
	end;

//==================================
OnShroomStart:	//-- Mushroom Event
//==================================

	.Map$ = .ShroomMaps$[rand(getarraysize(.ShroomMaps$))];
	killmonster .Map$,strnpcinfo(3)+"::OnShroomKilled";
	$@CurrentEvent = 11;
	.EnterMap$[$@CurrentEvent] = .Map$;
	Func_Countdown;
	$@CurrentEvent = -11;
	.@Spawn = .Spawn = max(1,rand(getusers(1) / 10));
	if(1 > .Spawn) .@Spawn = .Spawn = 1;
	monster .Map$,0,0,"Please don't kill me!",1084,.Spawn,strnpcinfo(3)+"::OnShroomKilled";
	announce "Find the Mushroom : Total of "+.Spawn+" Mushrooms have been spawned in "+.Map$+"!",bc_blue;
	sleep 60000 * 45;
	if(.Spawn == .@Spawn) Announce .EventName$[11]+" Has Ended with No Winner!",bc_blue;
	killmonster .Map$,strnpcinfo(3)+"::OnShroomKilled";
	$@CurrentEvent = 0;
	end;

OnShroomKilled:
	if($@CurrentEvent == -11){
		.Spawn--;
		Func_Prizes(getcharid(0),.EventName$[11]);
		if (.Spawn)
			announce "[ "+strcharinfo(0)+" ] has killed a Mushroom. There are now "+.Spawn+" Mushroom(s) left.",bc_map|bc_blue;
		else {
			announce .EventName$[11]+" has ended. All the Mushrooms have been killed.",bc_blue;
			$@CurrentEvent = 0;
		}
	}
	end;

//==================================
OnBaphoStart:	//-- Find the Baphomet
//==================================

	.Map$ = .BaphoMaps$[rand(getarraysize(.BaphoMaps$))];
	killmonster .Map$,strnpcinfo(3)+"::OnBaphoKilled";
	$@CurrentEvent = 12;
	.EnterMap$[$@CurrentEvent] = .Map$;
	Func_Countdown;
	$@CurrentEvent = -12;
	.@Spawn = .Spawn = max(1,rand(getusers(1) / 10));
	monster .Map$,0,0,"Please don't kill me!",1039,.Spawn,strnpcinfo(3)+"::OnBaphoKilled";
	announce "Find the Baphomet: Total of "+.Spawn+" Baphomets have been spawned in "+.Map$+"!",bc_blue;
	sleep 60000 * 45;
	if(.Spawn == .@Spawn) Announce .EventName$[12]+" Has Ended with No Winner!",bc_blue;
	killmonster .Map$,strnpcinfo(3)+"::OnBaphoKilled";
	$@CurrentEvent = 0;
	end;

OnBaphoKilled:
	if($@CurrentEvent == -12){
		.Spawn--;
		Func_Prizes(getcharid(0),.EventName$[12]);
		if (.Spawn)
			announce "[ "+strcharinfo(0)+" ] has killed a Baphomet. There are now "+.Spawn+" Baphomet(s) left.",bc_map|bc_blue;
		else {
			announce .EventName$[-$@CurrentEvent]+" has ended. All the Baphomets have been killed.",bc_blue;
			$@CurrentEvent = 0;
		}
	}
	end;

//==================================
OnCandyStart:	//-- Grab the Candy
//==================================

	mapwarp .EnterMap$[13],"prontera",155,172;
	$@CurrentEvent = 13;
	Func_Countdown;
	$@CurrentEvent = -13;
	if(getmapusers(.EnterMap$[13]) < .MinPlayers[13]){
		mapannounce .EnterMap$[13],"Event Stopped! Not Enough Players Joined the "+.EventName$[13]+"!",bc_blue;
	} else {
		sleep 3000;
		mapannounce .EnterMap$[13],"The goal is this event is to pick up as many "+getitemname(.candy_id)+".",bc_blue;
		sleep 1000;
		for ( .@i = 5; .@i >= 0; .@i-- ) {
			mapannounce .EnterMap$[13], "["+ .@i +"]", 0;
			sleep 1000;
		}
		.@drop_candy_amount = .register_count * 12; // drop the amount of candies equal to no. of participants x 12
		freeloop 1;
		while ( .@i < .@drop_candy_amount ) {
			while ( checkcell( .EnterMap$[13], .@x = rand(450), .@y = rand(450), cell_chknopass ) );
			makeitem .candy_id, 1, .EnterMap$[13], .@x, .@y;
			.@i++;
		}
		freeloop 0;
		sleep 60000;
		for ( .@i = 0; .@i < .register_count; .@i++ ) {
			if ( attachrid( .register_aid[.@i] ) ) {
				.@amount = countitem( .candy_id );
				if ( .@amount >= .@highest ) {
					setd ".@count"+ .@amount +"["+ getarraysize( getd( ".@count"+ .@amount ) ) +"]", getcharid(3);
					.@highest = .@amount;
				}
				delitem .candy_id, countitem( .candy_id );
			}
		}
		cleanmap .EnterMap$[13];
		if ( .@size = getarraysize( getd( ".@count"+ .@highest ) ) ) {
			for ( .@i = 0; .@i < .@size; .@i++ ) {
				attachrid getd( ".@count"+ .@highest +"["+ .@i +"]" );
				Func_Prizes(getcharid(0),.EventName$[13]);
			}
			mapannounce .EnterMap$[13], "Event end, there are "+ .@size +" player having most "+ getitemname( .candy_id ) +" ! "+ .@name$, 0;
		} else	mapannounce .EnterMap$[13], "Event end, nobody is a winner ... too bad", 0;
	}
	sleep 5000;
	mapwarp .EnterMap$[13],"prontera",155,172;
	deletearray .register_aid;
	.register_count = 0;
	$@CurrentEvent = 0;
	end;

//==================================
OnCountStart:	//-- Monsters Counting
//==================================

	killmonster .EnterMap$[14],strnpcinfo(3)+"::OnKilled";
	$@CurrentEvent = 14;
	Func_Countdown;
	.Round = .CountRound;

OnStartGame:
	deletearray .MobCount[0],getarraysize( .MobCount );
	for( .@x = .CountXY[0]; .@x <= .CountXY[2]; .@x++ ){
		for( .@y = .CountXY[1]; .@y <= .CountXY[3]; .@y++ ){
			.@Summon = rand( getarraysize( .CountMonster ) );
			monster .EnterMap$[14],.@x,.@y,"Count Me",.CountMonster[.@Summon],1,strnpcinfo(3)+"::OnKilled";
			.GID = $@mobid;
			setunitdata .GID,UMOB_DMGIMMUNE,1;
			.MobCount[.@Summon] = .MobCount[.@Summon] + 1;
			sleep 1;
		}
	}
	.@Target = rand( getarraysize( .CountMonster ) );
	deletepset 1;
	defpattern 1, "([^:]+): (\\|\\d{2})?"+.MobCount[.@Target]+ ".$", "OnRight";
	defpattern 1,"([^:]+):.*.*", "OnSpam";
	activatepset 1;
	delwaitingroom;
	waitingroom getmonsterinfo( .CountMonster[.@Target],0 ),0;
	npctalk "Count for the Targeted Monster's Amount to Win the Game.";
	$@CurrentEvent = -14;
	end;

OnSpammed:
	@Spam = 0;
	end;

OnSpam:
	if( getgmlevel() > 90 ) end;
	@Spam++;
	if( @Spam >= .Spam ){	// 3 Continuos Answer will trigger...
		@SpamDelay = gettimetick(2) + .Spam;
		dispbottom "SPAM Detected, your answer within next "+.Spam+" Seconds will be Ignored.";
	}
	deltimer strnpcinfo(3)+"::OnSpammed";
	addtimer ( .Spam * 1000 ),strnpcinfo(3)+"::OnSpammed";
	end;

OnRight:
	@Spam = 0;
	deltimer strnpcinfo(3)+"::OnSpammed";
	if( $@CurrentEvent != -14 ){
		message strcharinfo(0),"Sorry, there is no Event right now.";
	} else if( @SpamDelay > gettimetick(2) ){
		message strcharinfo(0),"SPAM Protection : Remain "+( @SpamDelay - gettimetick(2) )+" seconds.";
	} else if( getcharid(0) == .Winner[0] && gettimetick(2) < .Winner[1] ){
		message strcharinfo(0),"Sorry, Winner Time Penalty : Remain "+( .Winner[1] - gettimetick(2) )+" seconds.";
	} else {
		delwaitingroom;
		$@CurrentEvent = 14;
		.Round--;
		.Winner[0] = getcharid(0);
		.Winner[1] = gettimetick(2) + .Delay;
		deletepset 1;
		Func_Prizes(getcharid(0),.EventName$[14]);
		killmonster .EnterMap$[14],strnpcinfo(3)+"::OnKilled";
		if( .Round )
			donpcevent strnpcinfo(3)+"::OnStartGame";
		else	$@CurrentEvent = 0;

	}
	end;

OnKilled:
	end;

//==================================
OnDisguiseStart: //-- Disguise
//==================================

	mapwarp .EnterMap$[15],"prontera",155,172;
	$@CurrentEvent = 15;
	Func_Countdown;
	$@CurrentEvent = -15;
	.Round = .DisguiseRound;
	sleep 9000;
	if(getmapusers(.EnterMap$[15]) < .MinPlayers[15])
		mapannounce .EnterMap$[15],"Event Stopped! Not Enough Players Joined the "+.EventName$[15]+"!",bc_blue;
	else {
		enablenpc "Disguise Event";
		sleep 100;
		donpcevent "Disguise Event::OnStart";
		for(.@dis = 30; .@dis > 0; .@dis--){
			if(!getmapusers(.EnterMap$[15]))
				.@dis = 0;
			// mapannounce .EnterMap$[15],"There are "+(.@dis)+" Minuets Remaining",bc_blue;
			sleep 60000;
		}
		mapannounce .EnterMap$[15],"Time Is up",bc_blue;
	}
	disablenpc "Disguise Event";
	sleep 5000;
	mapwarp .EnterMap$[15],"prontera",155,172;
	$@CurrentEvent = 0;
	end;

//==================================
OnFabreStart:	//-- Fabre Event
//==================================

	killmonsterall .EnterMap$[16];
	query_sql("DELETE FROM `char_reg_num` WHERE `key` = 'fabre'");
	mapwarp .EnterMap$[16],"prontera",155,172;
	$@CurrentEvent = 16;
	pvpoff .EnterMap$[16];
	for ( .@i = 0; .@i < getarraysize( .bombflag ); .@i++ )
		setmapflag .EnterMap$[16], .bombflag[.@i];
	Func_Countdown;
	$@CurrentEvent = -16;
	if(getmapusers(.EnterMap$[16]) < .MinPlayers[16]){
		mapannounce .EnterMap$[16],"Event Stopped! Not Enough Players Joined the "+.EventName$[16]+"!",bc_blue;
		for ( .@i = 6; .@i < getarraysize( .bombflag ); .@i++ )
			removemapflag .EnterMap$[16], .bombflag[.@i];
		$@CurrentEvent = 0;
	} else {
		mapannounce .EnterMap$[16],"Rules are simple",bc_blue;
		sleep 5000;
		mapannounce .EnterMap$[16],"Kill the monsters to recive points.",bc_blue;
		sleep 5000;
		mapannounce .EnterMap$[16],"Player with the most points at the end wins.",bc_blue;
		sleep 5000;
		mapannounce .EnterMap$[16],"Event will now Begin~",bc_blue;
		monster .EnterMap$[16],0,0,"1 Point",1007,60,strnpcinfo(3)+"::OnKill_1";
		monster .EnterMap$[16],0,0,"10 Point",1008,30,strnpcinfo(3)+"::OnKill_2";
		monster .EnterMap$[16],0,0,"-20 Point",1002,50,strnpcinfo(3)+"::OnKill_3";
 		for(.@fabre = 5; .@fabre > 0; .@fabre--){
			if(getmapusers(.EnterMap$[16]) < 1) .@poring = 0;
			mapannounce .EnterMap$[16],callfunc("F_InsertPlural",.@fabre,"Minute")+" Remaining.",bc_blue;
			sleep 60000;
		}
		killmonsterall .EnterMap$[16];
		for ( .@i = 6; .@i < getarraysize( .bombflag ); .@i++ )
			removemapflag .EnterMap$[16], .bombflag[.@i];
		$@CurrentEvent = 0;
		query_sql("SELECT `char_reg_num`.`value`,`char`.`name`,`char`.`char_id` FROM `char` INNER JOIN `char_reg_num` ON `char_reg_num`.`char_id`=`char`.`char_id` WHERE `char_reg_num`.`key`='fabre' ORDER BY `char_reg_num`.`value` DESC LIMIT 50",.@value,.@name$,.@cid);
		.@size = getarraysize( .@cid );
		for ( .@i = 0; .@i < .@size; .@i++ ){
			if(.@value == .@value[.@i])
				Func_Prizes(.@cid[.@i],.EventName$[16]);
			else	break;
		}
		mapannounce .EnterMap$[16],.EventName$[16]+" ended with a total  of "+(.@i+1)+" winners.",bc_all;
	}
	sleep 5000;
	mapwarp .EnterMap$[16],"prontera",155,172;
	end;
		
OnKill_1:
	monster .EnterMap$[16],0,0,"1 Point",1007,1,strnpcinfo(3)+"::OnKill_1";
	fabre += 1;
	end;
		
OnKill_2:
	monster .EnterMap$[16],0,0,"10 Points",1008,1,strnpcinfo(3)+"::OnKill_2";
	fabre += 10;
	end;
		
OnKill_3:
	monster .EnterMap$[16],0,0,"-20 Points",1002,1,strnpcinfo(3)+"::OnKill_3";
	fabre -= 20;
	end;

//==================================
OnDevilStart:	//-- Devil Square
//==================================

	mapwarp .EnterMap$[17],"prontera",155,172;
	for ( .@i = 0; .@i < getarraysize( .devilflag ); .@i++ )
		setmapflag .EnterMap$[17], .devilflag[.@i];
	$@CurrentEvent = 17;
	Func_Countdown;
	$@CurrentEvent = -17;
	$MVPdefeat = 0;
	killmonsterall .EnterMap$[17];
	sleep 9000;
	if(getmapusers(.EnterMap$[17]) < .MinPlayers[17])
		mapannounce .EnterMap$[17],"Event Stopped! Not Enough Players Joined the "+.EventName$[17]+"!",bc_blue;
	else {
		mapannounce .EnterMap$[17],"[Devil Square]: You will encounter 3 waves of monsters. The monsters will grow stronger with each wave.",bc_blue;
		mapannounce .EnterMap$[17],"[Devil Square]: If you defeat all the enemies, you will be given the opportunity to open 10 Treasure Chests with items, equipment, and rare cards inside!",bc_blue;
		mapannounce .EnterMap$[17],"[Devil Square]: Event has started!",bc_blue;
		.round = 1;
		.mob =  0;
		set .monsterset, query_sql("SELECT id, iname, hp FROM `mob_db` where LV <= 70 and LV >= 60 and hp < 99999999 and MEXP = 0 and not iName='Treasure Chest' ORDER BY RAND() LIMIT 100", .monsterid, .monstername$, .monsterhp);
		for (.@x = 0; .@x < getmapusers(.EnterMap$[17]); .@x++){
			.monstercount = 3;
			for (.@y = 0; .@y < .monstercount; .@y++) {
				.monster = rand(0,.monsterset-1);
				monster .EnterMap$[17],0,0,"[Devil Square]: "+.monstername$[.monster],.monsterid[.monster],.monstercount,strnpcinfo(3)+"::OnDevilDead";	 
				.mob += .monstercount;
			}
		}
		for(.devil = 50; .devil > 0; .devil--){
			if(getmapusers(.EnterMap$[17]) < 1)
				.devil = 0;
			mapannounce .EnterMap$[17],"There are "+(.devil)+" Minuets Remaining",bc_blue;
			sleep 60000;
		}
		mapannounce .EnterMap$[17],"Time Is up",bc_blue;
	}
	.round = .mob = $@CurrentEvent = 0;
	killmonsterall .EnterMap$[17];
	for ( .@i = 6; .@i < getarraysize( .devilflag ); .@i++ )
		removemapflag .EnterMap$[17], .devilflag[.@i];
	sleep 5000;
	mapwarp .EnterMap$[17],"prontera",155,172;
	end;
 
OnDevilDead:
	if(.round > 3){
		$MVPDefeat += 5;
		if (rand(1,.2 + $MVPDefeat) == 1) { 
			mapannounce .EnterMap$[17],"[Devil Square]: It's not over yet! Another MVP Has entered the realm!!", bc_map;
			set.mob, 0;
			if (getmapusers(.EnterMap$[17]) <= 5)
				set .monsterset, query_sql("SELECT id, iname FROM `mob_db` where LV <= 99 and LV >= 1 and MEXP>1", .monsterid, .monstername$);
			else	set .monsterset, query_sql("SELECT id, iname FROM `mob_db` where LV <= 99 and LV >= 85 and MEXP>1", .monsterid, .monstername$);
			.monstercount = 1;
			.monster = rand(0,.monsterset-1);
			monster .EnterMap$[17],0,0,"[Devil Square]: "+.monstername$[.monster],.monsterid[.monster],1,strnpcinfo(3)+"::OnDevilDead";
		} else {
			mapannounce .EnterMap$[17],"The Devil Square has been eradicated!", bc_map;
			mapannounce .EnterMap$[17],"Treasure chests have appeared across the map!", bc_map;
			.round++;
			set .monsterset, query_sql("SELECT id FROM `mob_db`  where iName='Treasure Chest';", .monsterid);
			for(.@x = 0; .@x < getmapusers(.EnterMap$[17]); .@x++){
				monster .EnterMap$[17],0,0,"[Devil Square]: "+.monstername$[.monster],.monsterid[.monster],1,strnpcinfo(3)+"::OnTreasureDead";	 
				.mob++;
			}
		}
		end; 
	} else {
		.mob--;
		if ( .mob <= 10 && .mob >= 1)
			announce "Devil Square : "+ .mob +" monsters remaining in round "+.round+".", bc_map;
		else if ( .mob <= 0 ) {
			if(.round == 3){
				mapannounce .EnterMap$[17],"[Devil Square]: Watchout!! An MVP Has entered the realm!!", bc_map;	
				set.mob, 0;
				if (getmapusers(.EnterMap$[17]) <= 5)
					set .monsterset, query_sql("SELECT id, iname FROM `mob_db` where LV <= 99 and LV >= 1 and MEXP>1", .monsterid, .monstername$);
				else	set .monsterset, query_sql("SELECT id, iname FROM `mob_db` where LV <= 99 and LV >= 85 and MEXP>1", .monsterid, .monstername$);
				.monstercount = 1;
				.monster = rand(0,.monsterset-1);
				monster .EnterMap$[17],0,0,"[Devil Square]: "+.monstername$[.monster],.monsterid[.monster],1,strnpcinfo(3)+"::OnDevilDead";
				.round++;
			} else {
				mapannounce .EnterMap$[17],"[Devil Square]: Entering round "+(.round + 1)+" in 30 seconds", bc_map;
				sleep 20000;
				mapannounce .EnterMap$[17],"[Devil Square]: Entering round "+(.round + 1)+" in 10 seconds.", bc_map;
				sleep 5000;
				mapannounce .EnterMap$[17],"[Devil Square]: Entering round "+(.round + 1)+" in 5 seconds.", bc_map;
				sleep 5000;		    
				.round++;
				.mob = 0;
				.@lvmin = 65 + .round * 5;
				.@lvmax = .@lvmin + 5;
				set .monsterset, query_sql("SELECT id, iname, hp FROM `mob_db` where LV <= "+.@lvmax+" and LV >= "+.@lvmin+" and hp < 99999999 and MEXP = 0 and not iName='Treasure Chest' ORDER BY RAND() LIMIT 100", .monsterid, .monstername$, .monsterhp);
				for(.@x = 0; .@x < getmapusers(.EnterMap$[17]); .@x++){
					.monstercount = 3;
					for(.@y = 0; .@y < .monstercount; .@y++) {
						.monster = rand(0,.monsterset-1);
						monster .EnterMap$[17],0,0,"[Devil Square]: "+.monstername$[.monster],.monsterid[.monster],.monstercount,strnpcinfo(3)+"::OnDevilDead";	 
						.mob += .monstercount;
					}
				}
			}
		}
	}
	end;
 
OnTreasureDead:
	.mob--;
	if (.mob < 1){
		.round = .mob = .devil = 0;
		addrid(5,0,.EnterMap$[17]);
		Func_Prizes(getcharid(0),.EventName$[17]);
		sleep2 10000;
		warp "prontera",155,172;
	}
	end;

//==================================
OnPCLogOutEvent:	//-- On Logout
//==================================

	if($@CurrentEvent == -10 && getcharid(3) == $@Target){
		mapannounce .EnterMap$[10],"The target has logged out of this game. This round will be nulled.",bc_blue;
		$@Target = -1;
	} else if($@CurrentEvent == -13 || $@CurrentEvent == 13){
		for(.@i = 0; .@i < .register_count; .@i++)
			if(getcharid(3) == .register_aid[.@i])
				deletearray .register_aid[.@i], 1;
	}
	end;

//==================================
OnPCDieEvent:	//-- On player death
//==================================

	if(($@CurrentEvent == -4 && strcharinfo(3) == .EnterMap$[4]) || ($@CurrentEvent == -2 && strcharinfo(3) == .EnterMap$[2]))
		warp "prontera",155,172;
	if($@CurrentEvent == -10 && getcharid(3) == $@Target ){
		Func_Prizes(killerrid,.EventName$[10]);
		$@Target = -1;
	}
	end;

//==================================
OnInit:		//-- Config
//==================================

// -------------------
//  Rewards
// -------------------

	// Recive rewards via
	// [0] = Direct to inv
	// [1] = Mail / RoDex
	$@Mail = 1;	

	// Does not support multiple item rewards
	// Rewards are Mailed to winners
	// Ro Dex Supports 5 Items
	// Old Mail & Direct DO NOT support multiple items
	setarray $@RewardID	,7539,0,0,0,0;
	setarray $@RewardQNT	,    50,0,0,0,0;
	$@RewardZeny = 1000000;

	// Not Adding Card / Random Bonus Support Yet, bug me if you really want it.

// -------------------
//  Ranking
// -------------------

	// Enable Event Ranking
	// Bitwise
	// [1] = Liftime
	// [2] = Mothly
	// [3] = Both
	$@EventRanking = 3;

// -------------------
//  At Commands
// -------------------

	// Run Event Command to manually run event
	bindatcmd("runevent",strnpcinfo(3)+"::OnRunEvent",60,99);

	// End Event Command to manually end event
	bindatcmd("stopevent",strnpcinfo(3)+"::OnEndEvent",60,99);

	// Randomize Event Command to randomize event scedule
	bindatcmd("randevent",strnpcinfo(3)+"::OnRandomize",60,99);

	// Clear Event Command to wipe event scedule
	bindatcmd("wipeevent",strnpcinfo(3)+"::OnClear",60,99);

	// Remove Event Command to wipe event scedule
	bindatcmd("removeevent",strnpcinfo(3)+"::OnRemoveType",60,99);

	// Add Event Command to wipe event scedule
	bindatcmd("addevent",strnpcinfo(3)+"::OnRemoveType",60,99);

	// Join Event Command
	bindatcmd("joinevent",strnpcinfo(3)+"::OnJoinEvent",0,99);

// -------------------
//  Event Data
// -------------------

	// Gm Level to access GM Menus
	.GMAccess = 99;

	// How Many Mins after the hour till event starts
	// Don't forget 5 mins for Func_Countdown
	.StartTime = 25;

	// Event Names
	setarray .EventName$[1],
		"Emperium Event","Zombie Survival","Dice Event","PvP Event","Maze Event",
		"Find The Poring","Cluckers","Lucky Pick","Bombring Event","Manhunt",
		"Find The Mushroom","Find The Baphomet","Grab the Candy!","Monsters Counting","Disguise Event",
		"Fabre Event","Devil Square";

	// Colored Event Names
	setarray .ColorName$[1],
		"^00CCCC"+.EventName$[1]+"^000000",	"^CC00CC"+.EventName$[2]+"^000000",	"^00CC00"+.EventName$[3]+"^000000",	"^CC0000"+.EventName$[4]+"^000000",	"^00CC00"+.EventName$[5]+"^000000",
		"^00CCCC"+.EventName$[6]+"^000000",	"^00CC00"+.EventName$[7]+"^000000",	"^00CC00"+.EventName$[8]+"^000000",	"^CC00CC"+.EventName$[9]+"^000000",	"^CC0000"+.EventName$[10]+"^000000",
		"^00CCCC"+.EventName$[11]+"^000000",	"^00CCCC"+.EventName$[12]+"^000000",	"^00CC00"+.EventName$[13]+"^000000",	"^00CC00"+.EventName$[14]+"^000000",	"^00CC00"+.EventName$[15]+"^000000",
		"^00CCCC"+.EventName$[16]+"^000000",	"^CC00CC"+.EventName$[17]+"^000000";

	// Min Players
	//	Cluckers, Mushroom & Monter Counting don't check
	setarray .MinPlayers[1],
		2,1,2,3,2,
		1,0,3,1,99,
		0,0,2,0,3,
		3,3;

	// @JoinEvent warp points
	setarray .EnterMap$[1],
		"prontera","1@zombie","quiz_01","guild_vs2","maze",
		"guild_vs2","prontera","prontera","quiz_02","guild_vs2",//"pvp_n_1-5" needs a fix
		"prontera","prontera","guild_vs2","prontera","guild_vs2",
		"guild_vs2","guild_vs2";

	setarray .EnterX[1],
		161,  0,205,  0,371,
		  0,155,161, 59,  0,
		  0,  0,  0,156,  0,
		  0, 50;

	setarray .EnterY[1],
		168,  0, 92,  0,143,
		  0,227,168,345,  0,
		  0,  0,  0,164,  0,
		  0, 50;

	// Zombies Spawned per Wave
	// MobID1,Quantity1{,MobID2,Quantity2{,{....}}
	//	Quantity is multiplied by number of waves
	//	so 10 will become 100 in last wave
	//	and mobs are not killed between
	//	so 10 will have 550 spawned in last wave
	setarray .Zombies,1394,10,1423,5,1298,1;

	// Fake Poring Names
	setarray .Poring$,"Porjng","P0ring","Porlng","Porimg","Porinq",
				"Poporing","This One","Right","Kill Me","Poning",
				"qoring","Pooring","Pouring","Polling","~Poring~",
				"Winner","Prize","Porirg","Paring","Notice Me Senpai",
				"Pickle","Puring","Ponirg","Poning","P o r i n g";

	// Number of poring to Spawn in Find the poring Event
	.PoringSpawn = 2;

	// Poring and Bombring and Grab the Candy Mapflags
	setarray .bombflag,mf_nosave,mf_nowarp,mf_nowarpto,mf_nomemo,mf_noteleport,mf_noreturn,mf_nobranch,mf_nomobloot,mf_nomvploot,mf_noskill,mf_noitemconsumption,mf_nodrop,mf_notrade,mf_nopenalty;


	// Devil Square Mapflags
	setarray .devilflag,mf_nosave,mf_nowarp,mf_nowarpto,mf_nomemo,mf_noteleport,mf_noreturn,mf_notrade,mf_nopenalty;

	// Mushroom Event Possible Maps
	setarray .ShroomMaps$,"izlude","geffen","morocc","prontera";

	// Baphomet Event Possible Maps
	setarray .BaphoMaps$,"splendide","hugel","yuno","comodo","xmas","aldebaran","izlude","payon","geffen","morocc","prontera";

	// Number of waves in Bombporing Event
	.Bombwaves = 5;

	// Item ID used in the Grab the Candy! event
	// Best to use a custom ID
	.candy_id = 529;

	// Monster Counting
	setarray .CountMonster,1084,1085;

	// Number of rounds for Monster Counting
	.CountRound = 1;
	
	// Monster Coutning Mob Spawn area
	setarray .CountXY,152,160,159,167;

	// Winners Answer Delay for Monster Counting
	set .Delay,10;

	// Spam Prevention for Monster Counting
	set .Spam,3;

	// Test mode, Shortens Coutdown timer to 30 seconds for faster testing
	// [0] = Off
	// [1] = On
	.TestMode = 0;
	
// -------------------
//  Don't Touch Ever
// -------------------
	
	disablenpc "Disguise Event";
	$@CurrentEvent = 0;
	if( .StartTime > 59 ) .StartTime = 59;
	if( .StartTime < 0 ) .StartTime = 0;
	setarray .Days$[0],"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday";
	end;
}

//==================================
//-- Emperium Event Extras
//==================================

sword_1-1,216,208,4	script	Emp_Break	-1,{
OnBreak:
	stopnpctimer;
	.@Time = getnpctimer(0);
	.@m = .@Time / 60000;
	.@s = (.@Time - .@m * 60000) / 1000;
	.@ms = .@Time % 1000;
	if(.@Time < BestTime || !BestTime)
		BestTime = .@Time;
	if(.@Time < $@BestTime){
		$@BestTime = .@Time;
		$@BestCid = getcharid(0);
		announce "[Emperium Event]: "+strcharinfo(0)+" now holds the top time of "+((.@m)?callfunc("F_InsertPlural",.@i,"minute")+" ":"")+""+((.@s)?.@s+""+((.@ms)?"."+.@ms:"")+" seconds":"")+".",bc_all|bc_blue;
	}
	mapannounce .Map$,"You have a "+((.@Time == BestTime)?"new personal best ":"")+"time of "+((.@m)?callfunc("F_InsertPlural",.@i,"minute")+" ":"")+""+((.@s)?.@s+""+((.@ms)?"."+.@ms:"")+" seconds":"")+".",bc_area|bc_blue;
	sleep2 2500;
	instance_destroy;
	end;

OnInstanceInit:
	initnpctimer;
	stopnpctimer;
	setnpctimer 0,strnpcinfo(3);
	.Map$ = strnpcinfo(4);
	monster .Map$,223,206,"Emperium",1288,1,strnpcinfo(3)+"::OnBreak";
	.GID = $@mobid;
	setunitdata .GID,UMOB_DMGIMMUNE,1;
	sleep 2000;
	mapannounce .Map$,"[Emperium Event]: Goal is simple, kill the Emperium as fast as you can~",bc_map|bc_blue;
	sleep 1000;
	mapannounce .Map$,"[Emperium Event]: Once Countdown is done have at it.",bc_map|bc_blue;
	sleep 2000;
	mapannounce .Map$,"5",bc_map|bc_blue;
	sleep 1000;
	mapannounce .Map$,"4",bc_map|bc_blue;
	sleep 1000;
	mapannounce .Map$,"3",bc_map|bc_blue;
	sleep 1000;
	mapannounce .Map$,"2",bc_map|bc_blue;
	sleep 1000;
	mapannounce .Map$,"1",bc_map|bc_blue;
	sleep 1000;
	mapannounce .Map$,"Go~",bc_map|bc_blue;
	startnpctimer strnpcinfo(3);
	setunitdata .GID,UMOB_DMGIMMUNE,0;
	end;
}

//==================================
//-- Maze Event Extras
//==================================

maze,358,148,0	warp	mazeroadblock	2,2,maze,371,149

maze,369,162,4	script	Event_Agent#Maze	405,4,4,{
	mes "[Event Agent]";
	mes "Walk up to me to claim prize~";
	close;

OnTouch_:
	if($@CurrentEvent == -5){
		$@CurrentEvent = 0;
		announce "Congrats "+strcharinfo(0)+", a winner in the Maze Event.",bc_all|bc_blue;
		WonEvents++;
		MWonEvents++;
		if($@Mail){
			mail getcharid(0), "no-reply", "Maze Event", "Congratulations!% You have won in the Maze Event % % %[ Your reward is attached. ]", $@RewardZeny, $@RewardID, $@RewardQNT;
			query_sql("UPDATE `mail` SET message = REPLACE(message,'%',CHAR(13)) WHERE send_name = 'no-reply'");
		} else {
			getitem $@RewardID,$@RewardQNT;
			zeny += $@RewardZeny;
		}
		mapwarp "maze","prontera",155,172;
	}
	warp "prontera",155,172;
	end;
}

//==================================
//-- Cluckers Event 
//==================================

prontera,155,227,4	script	Cluckers	800,{
	if ($@CurrentEvent == -7) {
		specialeffect2 EF_HIT3;
		switch(rand(16)) {
			case 0: npctalk "CLUUUUUUCK!!!"; unitkill getcharid(3); skilleffect "NPC_SELFDESTRUCTION",1; emotion ET_HUK; break;
			case 1: npctalk "Cluuuuuck!~"; break;
			case 2: unitkill getcharid(3); skilleffect "NPC_SELFDESTRUCTION",1; break;
			case 3: sc_start SC_Freeze,10000,0; break;
			case 4: npctalk "CLUUUUUUUUUCK!!!"; unitkill getcharid(3); skilleffect "NPC_SELFDESTRUCTION",1; emotion ET_HUK; break;
			case 5: sc_start SC_Sleep,10000,0; break;
			case 6: sc_start SC_Stone,10000,0; emotion ET_KIK; break;
			case 7: npctalk "CLUUUUUUCK!!!"; unitkill getcharid(3); skilleffect "NPC_SELFDESTRUCTION",1; emotion ET_HUK; break;
			case 8: npctalk "Cluck! CLUUUCK!!"; unitkill getcharid(3); skilleffect "NPC_SELFDESTRUCTION",1; emotion ET_HUK; break;
			case 9: sc_start SC_Stun,10000,0; break;
			case 10: sc_start SC_Sleep,10000,0; emotion ET_KIK; break;
			case 11: npctalk "Cluck! Cluck!"; break;
			case 12: sc_start SC_Stun,10000,0; break;
			case 13: unitkill getcharid(3); skilleffect "NPC_SELFDESTRUCTION",1; break;
			default:
				if (!rand(7)) {
					npctalk "WOOF!...........";
					specialeffect2 EF_SPHERE;
					announce "Congrats "+strcharinfo(0)+", a winner in the Cluckers Event.",bc_all|bc_blue;
					WonEvents++;
					MWonEvents++;
					if($@Mail){
						mail getcharid(0), "no-reply", "Cluckers Event", "Congratulations!% You have won in the Cluckers Event % % %[ Your reward is attached. ]", $@RewardZeny, $@RewardID, $@RewardQNT;
						query_sql("UPDATE `mail` SET message = REPLACE(message,'%',CHAR(13)) WHERE send_name = 'no-reply'");
					} else {
						getitem $@RewardID,$@RewardQNT;
						zeny += $@RewardZeny;
					}
					$@CurrentEvent = 0;
				} else {
					npctalk "Cluck! CLUUUCK!!";
					unitkill getcharid(3); skilleffect "NPC_SELFDESTRUCTION",1;
					npcwalkto rand(152,159),rand(234,241);
				}
				break;
		}
		end;
	}
	mes "Cluck cluck! Cluuuuuck?";
	mes "Cluck....";
	close;

OnTimer15000:
	npcwalkto 70+rand(17),135+rand(16);
	setnpctimer 0;
	end;

OnInit:
	npcspeed 75;
	npcwalkto rand(152,159),rand(234,241);
 	initnpctimer;
	end;

OnEventStart:
	$@CurrentEvent = 7;
	for(.@i = 5; .@i > 0; .@i--){
		Announce "Cluckers Event Will begin in "+callfunc("F_InsertPlural",.@i,"minute")+"!",bc_blue;
		Announce "Please type @joinevent to join",bc_blue;
		sleep 60000;
	}
	Announce "Cluckers Event Has Begun!",bc_blue;
	$@CurrentEvent = -7;
	sleep 60000 * 45;
	if($@CurrentEvent == -7){
		$@CurrentEvent = 0;
		Announce "Cluckers Event Has Ended with No Winner!",bc_blue|bc_area|bc_npc;
	}
	end;
}

guild_vs2,50,50,4	script	Disguise Event	795,{
	if($@CurrentEvent == -15){
		if(getgmlevel() == 99)
			dispbottom $MonsterName$+"";
		input .@input$;
		if(.@input$ == $MonsterName$)
			doevent strnpcinfo(3)+"::OnCorrect";
	}
	end;

OnStart:
	.EventON = .Wait = 1;
	setnpctimer 0;
	initnpctimer;
	end;

OnTimer10000:
	if (.Change) end;
	.Wait = 0;

OnDisguise:
	if (.MVPRule) {
		.Winner = 0;
		.Monster = rand(getarraysize(.MVP));
		$MonsterName$ = getmonsterinfo(.MVP[.Monster],0);
	} else {
		.Winner = 0;
		.Monster = 1000+rand(1000,1995);
		if (compare(","+.BlackList$+"," , ","+.Monster+",") || .Monster == .LastMonster)
			goto OnDisguise;
		.LastMonster = .Monster;
		$MonsterName$ = getmonsterinfo(.Monster,0);
	}
	deletepset 1;
	defpattern 1,"([^:]+):.\\s*"+$MonsterName$+".*", "OnCorrect";
	activatepset 1;
	if (.MVPRule)
		setnpcdisplay "Disguise Event",.MVP[.Monster];
	else	setnpcdisplay "Disguise Event",.Monster;
	.Change = 1;
	setnpctimer 0;
	end;

OnTimer30000:
	.Change = 0;
	setnpcdisplay "Disguise Event",795;
	npctalk "Disguise Event : You took too long to guess what I was. Please wait 10 seconds while I disguise again.";
	specialeffect EF_DETECT2;
	set $MonsterName$,"";
	deletepset 1;
	stopnpctimer;
	setnpctimer 0;
	initnpctimer;
	end;

OnCorrect:
	if (.Winner) {
		dispbottom "Someone has already won this round.";
		end;
	}
	set .Winner,1;
	set .RoundCount,.RoundCount+1;
	deletepset 1;
	activatepset 1;
	specialeffect2 EF_SPHERE;
	announce "Congrats "+strcharinfo(0)+", a winner in the Disguise Event.",bc_all|bc_blue;
	WonEvents++;
	MWonEvents++;
	if($@Mail){
		mail getcharid(0), "no-reply", "Disguise Event", "Congratulations!% You have won in the Disguise Event % % %[ Your reward is attached. ]", $@RewardZeny, $@RewardID, $@RewardQNT;
		query_sql("UPDATE `mail` SET message = REPLACE(message,'%',CHAR(13)) WHERE send_name = 'no-reply'");
	} else {
		getitem $@RewardID,$@RewardQNT;
		zeny += $@RewardZeny;
	}
	if (.RoundCount >= .Rounds) {
		setnpcdisplay "Disguise Event",795;
		.RoundCount = .Change = .EventON = 0;
		setnpctimer 0;
		stopnpctimer;
		npctalk "Disguise Event : Thank you all for playing. That was the last round of the Disguise Event. Come play again later.";
		mapwarp "guild_vs2","prontera",155,172;
		end;
	}
	setnpcdisplay "Disguise Event",795;
	.Change = 0;
	setnpctimer 0;
	end;

OnInit:
	// Npc Name
	.n$ = "[^0000FFDisguise NPC^000000]";

	// Disguise Event MVP Ruleset
	// Toggle 1/0
	// [0] Normal monsters, except blacklist
	// [1] MVPs from list
	.MVPRule = 1;

	// Number of rounds for Disguise Event
	.DisguiseRound = 5;

	// MVP List
	setarray .MVP[0],1038,1039,1046,1059,1086,1087,1112,1115,1147,1150,1157,1159,1190,1251,1252,1272,1312,1373,
			1389,1399,1418,1492,1502,1511,1583,1623,1630,1646,1647,1648,1649,1650,1651,1658,1685,1688,
			1708,1719,1734,1751,1768,1779,1785,1802,1832,1871,1874,1885,1917,1980,2022,2068,2087,2131,
			2156,2165;

	// Blacklist
	set .BlackList$, "1003,1006,1017,1021,1022,1027,1043,1075,1136,1137,1168," + 
		"1171,1172,1173,1181,1187,1210,1217,1218,1222,1223,1224,1225,1226,1227,1228," + 
		"1233,1284,1407,1411,1414,1495,1501,1900,1996,2000,2001,2002,2003,2004," + 
		"2005,2006,2007,2011,2012,2025,2028,2029,2030,2031,2032,2033,2034,2035," + 
		"2036,2037,2038,2039,2040,2041,2042,2043,2044,2045,2046,2047,2048,2049," + 
		"2050,2051,2052,2053,2054,2055,2056,2057,2058,2059,2060,2061,2062,2063," + 
		"2064,2065,2066,2067,2075,2076,2077,2078,2079,2080,2081,2083,2084,2085," + 
		"2086,2087,2088,2089,2090,2091,2092,2093,2094,2095,2096,2097,2098,2099," + 
		"2100,2101,2012,2103,2104,2105,2106,2107,2108,2109,2110,2111,2112,2113," + 
		"2114,2115,2116,2117,2118,2119,2120,2121,2123,2124,2125,1496,";
}

//==================================
//-- Event Shops
//==================================

//prontera,164,175,3	itemshop	Event Headgear Shop	877,33001,5381:50,5391:50,5462:50,5463:75,5596:75,5214:100,5380:100,5210:100,5226:100,5227:100,5228:100,5229:100,5230:100,5231:100,5232:100,5233:100,5234:100,5235:100,5236:100,5237:100,5283:100,5288:100,5293:100,5313:100,5314:100,5315:100,5324:100,5372:100,5376:100,5377:100,5378:100,5503:100,5505:100,5529:100,5286:125,5263:125,5098:125,5382:125,5238:175,5239:175,5240:175,5241:175,5242:175,5374:500
//prontera,164,173,3	itemshop	Event Rental Shop	877,33001,36502:7,35504:10,35505:10,35503:20
//prontera,164,169,3	itemshop	Event Shop	877,33001,12209:1,12211:2,604:3,7621:3,12299:5,12212:5,12311:5,12221:7,608:10,607:15,12208:15,14592:15,12210:15,12214:20,7776:20,35501:25,35502:25
//prontera,164,167,3	itemshop	Event Food Shop	877,33001,12041:10,12042:20,12043:30,12044:40,12045:50,12046:10,12047:20,12048:30,12049:40,12050:50,12051:10,12052:20,12053:30,12054:40,12055:50,12056:10,12057:20,12058:30,12059:40,12060:50,12061:10,12062:20,12063:30,12064:40,12065:50,12066:10,12067:20,12068:30,12069:40,12070:50

desde ya muchas gracias

saludos,

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...