Jump to content
KhrizPlayCL

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

Recommended Posts

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([email protected] == -14){
		if(getgmlevel() >= .GMAccess && .TestMode)
			dispbottom .MobCount[[email protected]]+"";
		input [email protected];
		if([email protected] == .MobCount[[email protected]])
			doevent strnpcinfo(3)+"::OnRight";
		else	doevent strnpcinfo(3)+"::OnSpam";
		end;
	}

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

	mes "[ Event Information ]";
	if([email protected] > 0)
		mes "Current Event: ",.ColorName$[[email protected]]," ";
	[email protected] = gettime(4) * 24 + gettime(3);
	for([email protected] = [email protected] + ((gettime(2)>.StartTime?1:0)); [email protected] < [email protected] + 168; [email protected]++){
		if($EVENT_CONTROL[[email protected]%168]){
			mes "Next Event:",.ColorName$[ $EVENT_CONTROL[ ([email protected] % 168) ] ] +" ~ "+ .Days$[ [email protected] % 168 / 24 ] +" - "+ Func_Add_Time( ([email protected] % 168) % 24);
			[email protected] += 1;
			break;
		}
	}
	if([email protected]) mes "Auto Events Disabled.";
	switch(select((([email protected] > 0)?" ~ Join event...:":":")+
			(([email protected])?" ~ Check schedule...:":":")+
			((getgmlevel() < .GMAccess)?":":" ~ Manage events...:")+
			(([email protected] & 1)?" ~ Monthly Ranking:":":")+
			(([email protected] & 2)?" ~ Lifetime Ranking:":":")+
			": ~ ^777777Cancel^000000")) {
		case 2:
			for([email protected] = 0; [email protected] < 168; [email protected]++){
				if( !( ( [email protected] ) % 24 )){
					next;
					mes "[ "+ .Days$[[email protected] / 24] +" Event Schedule ]";
				}
				if($EVENT_CONTROL[[email protected]])
					mes .ColorName$[$EVENT_CONTROL[[email protected]]] +" ~ "+ Func_Add_Time([email protected] % 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",[email protected],[email protected]);
		case 5:
			if([email protected])
				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",[email protected],[email protected]);
			for([email protected] = 0; [email protected] < getarraysize([email protected]); [email protected]++) {
				query_sql("SELECT `name` FROM `char` WHERE char_id = "[email protected][[email protected]]+";",[email protected]$);
				[email protected]$[[email protected]] = [email protected]$;
			}
			next;
			mes "~ ^990000"+(([email protected])?"Monthly ":"") +"Event Ladder^000000 ~";
			if (!getarraysize([email protected]))
				mes "The rankings are empty.";
			else {
				for([email protected] = 0; [email protected] < getarraysize([email protected]); [email protected]++)
					mes "#"+([email protected]+1)+" ^0000FF"[email protected]$[[email protected]]+"^000000 "[email protected][[email protected]];
			}
			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.";
					[email protected] = select(" ~ "+implode(.Days$,": ~ ")) - 1;
					next;
					mes "[ Add Event ]";
					mes "Pick a Time for ^0055FF"+.Days$[[email protected] / 24]+".";
					[email protected]$ = "";
					[email protected] = 0;
					for([email protected] = [email protected] * 24; [email protected] < [email protected] * 24 + 24; [email protected]++){
						if(!$EVENT_CONTROL[[email protected]]){
							[email protected]$ = [email protected]$ +" ~ "+ Func_Add_Time( [email protected] % 24 ) +":";
							[email protected] += 1;
						} else	[email protected]$ = [email protected]$ + ":";
					}
					if([email protected]){
						mes "No Events Times Remaining for "+ .Days$[ [email protected] ] +".";
						close;
					}
					[email protected] = select([email protected]$) + [email protected] * 24 - 1;
					next;
					mes "[ Add Event ]";
					mes "Select a event for ^0055FF"+ .Days$[[email protected] / 24] +" ~ "+ Func_Add_Time([email protected] % 24) +"^000000.";
					next;
					[email protected] = select(implode(.ColorName$,": ~ ")) - 1;
					mes "Are you sure you want to add "+ .ColorName$[[email protected]] +",";
					mes "for ^0055FF"+ .Days$[[email protected] / 24] +" ~ "+ Func_Add_Time([email protected] % 24) +"^000000?";
					next;
					[email protected] = (select(" ~ ^0000CCAdd event...^000000: ~ ^777777Cancel^000000"));
					mes "[ Add Event ]";
					if([email protected] == 2)
						mes "Cancelled.";
					else {
						$EVENT_CONTROL[[email protected]] = [email protected];
						mes "Event Added.";
					}
					break;
				case 2:
					next;
					mes "[ Remove Event ]";
					mes "Which Event?";
					[email protected]$ = "";
					for([email protected] = [email protected] = 0; [email protected] < 168; [email protected]++){
						if($EVENT_CONTROL[[email protected]]){
							[email protected]$ = [email protected]$ + .Days$[ [email protected] / 24 ] +" - "+ Func_Add_Time( [email protected] % 24 ) +" ~ "+ .ColorName$[ $EVENT_CONTROL[ [email protected] ] ]+":";
							[email protected] += 1;
						} else	[email protected]$ = [email protected]$ + ":";
					}
					if([email protected]){
						mes "No Events Setup.";
						close;
					}
					[email protected] = select([email protected]$) - 1;
					next;
					mes "[ Remove Event ]";
					mes "Are you sure you want to add the "+ .ColorName$[[email protected]] +",";
					mes "for ^0055FF"+ .Days$[[email protected] % 168 / 24] +" ~ "+ Func_Add_Time([email protected] % 168 / 24) +"^000000?";
					[email protected] = (select(" ~ ^FF0000Remove event...^000000: ~ ^777777Cancel^000000"));
					if([email protected] == 2){
						mes "Cancelled.";
					} else {
						$EVENT_CONTROL[[email protected]] = 0;
						mes "Event Removed.";
					}
					break;
			}
		}
		case 6: close;
		case 1:
			next;
			break;
	}

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

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

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

	mes "[ Randomize Event ]";
	mes "Chance of no event?";
	input([email protected],0,100);
	freeloop(1);
	for([email protected] = 0; [email protected] < 168; [email protected]++){
		if(rand(100) < [email protected]){
			$EVENT_CONTROL[[email protected]] = 0;
			continue;
		}
		$EVENT_CONTROL[[email protected]] = rand(getarraysize(.EventName$));
		if($EVENT_CONTROL[[email protected]] == [email protected])
			$EVENT_CONTROL[[email protected]] = rand(getarraysize(.EventName$));
		[email protected] = $EVENT_CONTROL[[email protected]];
	}
	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([email protected] = 0; [email protected] < 168; [email protected]++)
		$EVENT_CONTROL[[email protected]] = 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?";
	[email protected] = select(implode(.ColorName$,": ~ ")) - 1;
	next;
	mes "[ Remove Event Type ]";
	mes "Are you sure you want to remove all "+.ColorName$[[email protected]]+"?";
	if(select("No:Yes")== 1)
		close;
	freeloop(1);
	for([email protected] = 0; [email protected] < 168; [email protected]++){
		if($EVENT_CONTROL[[email protected]] == [email protected]){
			$EVENT_CONTROL[[email protected]] = 0;
			continue;
		}
	}
	freeloop(0);
	next;
	mes "[ Remove Event Type ]";
	mes "All "+.ColorName$[[email protected]]+" Events Removed.";
	close;

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

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

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

	if([email protected] == 0){
		mes "[ Event Management ]","Sorry no event is running.";
		close;
	}
	if([email protected] < 0)
		[email protected] *= -1;
	switch([email protected]){
		default:
			mapwarp .EnterMap$[[email protected]],"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$[[email protected]] +".",bc_all|bc_blue;
	[email protected] = 0;
	delwaitingroom;
	end;

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

	if([email protected])
		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.";
		[email protected] = select(implode(.ColorName$,": ~ ") +":Bug Test") - 1;
	} 
	switch([email protected]){
		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([email protected] = 5; [email protected] > 0; [email protected]){
		announce .EventName$[[email protected]]+" will begin in "+ callfunc("F_InsertPlural",[email protected],"minute") +"!",bc_all|bc_blue;
		Announce "Please type @joinevent to join",bc_all|bc_blue;
		if(.TestMode)
			sleep 6000;
		else	sleep 60000;
	}
	Announce .EventName$[[email protected]] +" 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([email protected]){
		mail getarg(0), "no-reply", getarg(1), "Congratulations!% You have won in the "+getarg(1)+" % % %[ Your reward is attached. ]", [email protected], [email protected], [email protected];
		query_sql("UPDATE `mail` SET message = REPLACE(message,'%',CHAR(13)) WHERE send_name = 'no-reply'");
	} else {
		getitem [email protected],[email protected];
		zeny += [email protected];
	}
	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() || [email protected]) end;
	sleep .StartTime * 60000 + 1000;
	[email protected] = gettime(4) * 24 + gettime(3);
	switch($EVENT_CONTROL[[email protected]]){
		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
//==================================

	[email protected] = 1;
	waitingroom "Emperium Event",99;
	Func_Countdown;
	[email protected] = -1;
	[email protected] = 2000000000;
	[email protected] = 0;
	getwaitingroomusers strnpcinfo(3);
	if([email protected]_usercount >= .MinPlayers[1]){
		freeloop(1);
		for([email protected] = 0; [email protected] < [email protected]_usercount; [email protected]++){
			attachrid([email protected]_users[[email protected]]);
			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([email protected] && [email protected] == -1)
		Func_Prizes([email protected],.EventName$[1]);
	[email protected] = 0;
	end;

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

	mapwarp .EnterMap$[2],"prontera",155,172;
	[email protected] = 2;
	Func_Countdown;
	[email protected] = -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([email protected] = 1; [email protected] < 11; [email protected]++){
			if([email protected] < 10)
				mapannounce .EnterMap$[2],"Wave "[email protected]+"!",bc_blue;
			else	mapannounce .EnterMap$[2],"FINAL WAVE!",bc_blue;
			sleep 1000;
			for([email protected] = 5; [email protected] > 0; [email protected]){
				mapannounce .EnterMap$[2],""[email protected]+"...",bc_blue;
				sleep 1000;
			}
			mapannounce .EnterMap$[2],"Begin Wave!",bc_blue;
			for([email protected] = 0; ([email protected] < getarraysize(.Zombies)); [email protected] += 2)
				monster .EnterMap$[2],0,0,"--ja--",.Zombies[[email protected]], [email protected] * .Zombies[[email protected]+1],strnpcinfo(3)+"::OnKillZombie";
			if(!getmapusers(.EnterMap$[2])){
				[email protected] += 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]);
		}
	}
	[email protected] = 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;
	[email protected] = 3;
	Func_Countdown;
	[email protected] = -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;
		[email protected] = 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([email protected] = 0; [email protected] < 100; [email protected]++){
			for([email protected] = 10; [email protected] > 0; [email protected]){
				mapannounce .EnterMap$[3],[email protected]+"...",bc_blue;
				sleep 1000;
			}
			[email protected] = rand(1,4);
			mapannounce .EnterMap$[3],"0... Good Bye Box "[email protected],bc_blue;
			switch([email protected]){
				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){
				[email protected] += 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]);
		}
		[email protected] = 0;
		mapwarp .EnterMap$[3],"prontera",155,172;
		end;
	}

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

	mapwarp .EnterMap$[4],"prontera",155,172;
	pvpoff .EnterMap$[4];
	[email protected] = 4;
	Func_Countdown;
	[email protected] = -4;
	[email protected] = getmapusers(.EnterMap$[4]);
	if([email protected] < .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([email protected] = 9; [email protected] > 0; [email protected]){
			mapannounce .EnterMap$[4],[email protected]+"...",bc_blue;
			sleep 1000;
		}
		pvpon .EnterMap$[4];
		mapannounce .EnterMap$[4],"Begin",bc_blue;
		sleep 5000;
		freeloop(1);
		for([email protected] = 1; [email protected] <= 360; [email protected]++){
			[email protected][[email protected]] = getmapusers(.EnterMap$[4]);
			if([email protected][[email protected]] != [email protected][[email protected] - 1]){
				if([email protected][[email protected]] < 2){
					[email protected] += 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];
	[email protected] = 0;
	mapwarp .EnterMap$[4],"prontera",155,172;
	end;

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

	mapwarp .EnterMap$[5],"prontera",155,172;
	enablenpc "mazeroadblock";
	disablenpc "Event_Agent#Maze";
	[email protected] = 5;
	for ( [email protected] = 0; [email protected] < getarraysize( .bombflag ); [email protected]++ )
		setmapflag .EnterMap$[5], .bombflag[[email protected]];
	Func_Countdown;
	[email protected] = -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([email protected] = 40; [email protected] > 0; [email protected]){
			if(getmapusers(.EnterMap$[5])<1) [email protected] = 0;
			mapannounce .EnterMap$[5],"There are "+([email protected])+" Minuets Remaining",bc_blue;
			sleep 60000;
		}
		mapannounce .EnterMap$[5],"Time Is up",bc_blue;
	}
	for ( [email protected] = 6; [email protected] < getarraysize( .bombflag ); [email protected]++ )
		removemapflag .EnterMap$[5], .bombflag[[email protected]];
	disablenpc "Event_Agent#Maze";
	sleep 5000;
	mapwarp .EnterMap$[5],"prontera",155,172;
	[email protected] = 0;
	end;

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

	mapwarp .EnterMap$[6],"prontera",155,172;
	[email protected] = 6;
	pvpoff .EnterMap$[6];
	for ( [email protected] = 0; [email protected] < getarraysize( .bombflag ); [email protected]++ )
		setmapflag .EnterMap$[6], .bombflag[[email protected]];
	Func_Countdown;
	[email protected] = -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([email protected] = 0; [email protected] < getarraysize(.Poring$); [email protected]++)
			monster .EnterMap$[6],0,0,.Poring$[[email protected]],1725,5,strnpcinfo(3)+"::OnKillWrong";
		monster .EnterMap$[6],0,0,"--ja--",1725,.PoringSpawn,strnpcinfo(3)+"::OnKillRight";
		.PoringSpawn = 2;
 		for([email protected] = 30; [email protected] > 0; [email protected]){
			if(getmapusers(.EnterMap$[6]) < 1) [email protected] = 0;
			mapannounce .EnterMap$[6],callfunc("F_InsertPlural",[email protected],"Minute")+" Remaining.",bc_blue;
			sleep 60000;
		}
	}
	if(!.PoringLeft){
		mapannounce .EnterMap$[6],"Time Is up",bc_blue;
		killmonsterall .EnterMap$[6];
		for ( [email protected] = 6; [email protected] < getarraysize( .bombflag ); [email protected]++ )
			removemapflag .EnterMap$[6], .bombflag[[email protected]];
		[email protected] = 0;
		sleep 5000;
		mapwarp .EnterMap$[6],"prontera",155,172;
	}
	end;

OnKillWrong:
	monster .EnterMap$[6],0,0,.Poring$[rand(1,getarraysize([email protected]))],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 ( [email protected] = 6; [email protected] < getarraysize( .bombflag ); [email protected]++ )
			removemapflag .EnterMap$[6], .bombflag[[email protected]];
		[email protected] = 0;
		sleep 5000;
		mapwarp .EnterMap$[6],"prontera",155,172;
	}
	end;

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

	[email protected] = 8;
	.luckywinner = 0;
	waitingroom "Lucky Event",99;
	Func_Countdown;
	getwaitingroomusers strnpcinfo(3);
	.luckywinner = [email protected]_users[rand([email protected]_usercount)];
	[email protected] = -8;
	if([email protected]_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;
	[email protected] = 0;
	.luckywinner = 0;
	end;

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

	mapwarp .EnterMap$[9],"prontera",155,172;
	[email protected] = 9;
	Func_Countdown;
	[email protected] = -9;
	[email protected] = getmapusers(.EnterMap$[9]);
	if([email protected] < .MinPlayers[9]){
		mapannounce .EnterMap$[9],"Event Stopped! Not Enough Players Joined the "+.EventName$[9]+"!",bc_blue;
		mapwarp .EnterMap$[9],"prontera",155,172;
	} else {
		for ( [email protected] = 0; [email protected] < getarraysize( .bombflag ); [email protected]++ )
			setmapflag .EnterMap$[9], .bombflag[[email protected]];
		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([email protected] = 1; [email protected] <= .Bombwaves; [email protected]++){
			if([email protected] < .Bombwaves){
				mapannounce .EnterMap$[9],"Wave "[email protected]+"!",bc_blue;
			} else	mapannounce .EnterMap$[9],"FIANL WAVE!",bc_blue;
			if ([email protected] * [email protected] < 60)
				areamonster .EnterMap$[9],48,334,71,357,"Run for you life!",1904,[email protected] * [email protected];
			else	areamonster .EnterMap$[9],48,334,71,357,"Run for you life!",1904,60;
			if(!getmapusers(.EnterMap$[9]))
				[email protected] += 5;
			else	sleep 1500 * .Bombwaves / [email protected];
		}
		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 ( [email protected] = 6; [email protected] < getarraysize( .bombflag ); [email protected]++ )
			removemapflag .EnterMap$[9], .bombflag[[email protected]];
	}
	[email protected] = 0;
	mapwarp .EnterMap$[9],"prontera",155,172;
	end;

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

	mapwarp .EnterMap$[10],"prontera",155,172;
	[email protected] = 10;
	Func_Countdown;
	[email protected] = -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([email protected] = 1; [email protected] <= 10; [email protected]++){
			if(getmapusers(.EnterMap$[10]) < 3){
				mapannounce .EnterMap$[10],"Sorry there are no longer enough players for another round",bc_blue;
			} else {
				if([email protected] < 10)
				mapannounce .EnterMap$[10],"Next Round will begin in 10 seconds!",bc_blue;
				deletearray [email protected][0],getarraysize([email protected]);
				addrid(5,0,.EnterMap$[10]);
				[email protected][getarraysize([email protected])] = getcharid(3);
				[email protected] = rand(getarraysize([email protected]));
				sleep 10000;
				mapannounce .EnterMap$[10],"[Round "[email protected]+"] Our target is "+rid2name([email protected])+"!",bc_blue;
				charcommand "killable "+rid2name([email protected]);
				charcommand "size "+rid2name([email protected])+" 2";
				sleep 60000;
				if([email protected] != -1){
					if(attachrid([email protected]) && strcharinfo(3) == .EnterMap$[10])
						Func_Prizes(getcharid(0),.EventName$[10]);
				}
				charcommand "alive "+rid2name([email protected]);
				charcommand "killable "+rid2name([email protected]);
				charcommand "size "+rid2name([email protected])+" 0";
			}
		}
	}
	sleep 5000;
	mapwarp .EnterMap$[10],"prontera",155,172;
	[email protected] = 0;
	end;

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

	.Map$ = .ShroomMaps$[rand(getarraysize(.ShroomMaps$))];
	killmonster .Map$,strnpcinfo(3)+"::OnShroomKilled";
	[email protected] = 11;
	.EnterMap$[[email protected]] = .Map$;
	Func_Countdown;
	[email protected] = -11;
	[email protected] = .Spawn = max(1,rand(getusers(1) / 10));
	if(1 > .Spawn) [email protected] = .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 == [email protected]) Announce .EventName$[11]+" Has Ended with No Winner!",bc_blue;
	killmonster .Map$,strnpcinfo(3)+"::OnShroomKilled";
	[email protected] = 0;
	end;

OnShroomKilled:
	if([email protected] == -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;
			[email protected] = 0;
		}
	}
	end;

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

	.Map$ = .BaphoMaps$[rand(getarraysize(.BaphoMaps$))];
	killmonster .Map$,strnpcinfo(3)+"::OnBaphoKilled";
	[email protected] = 12;
	.EnterMap$[[email protected]] = .Map$;
	Func_Countdown;
	[email protected] = -12;
	[email protected] = .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 == [email protected]) Announce .EventName$[12]+" Has Ended with No Winner!",bc_blue;
	killmonster .Map$,strnpcinfo(3)+"::OnBaphoKilled";
	[email protected] = 0;
	end;

OnBaphoKilled:
	if([email protected] == -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$[[email protected]]+" has ended. All the Baphomets have been killed.",bc_blue;
			[email protected] = 0;
		}
	}
	end;

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

	mapwarp .EnterMap$[13],"prontera",155,172;
	[email protected] = 13;
	Func_Countdown;
	[email protected] = -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 ( [email protected] = 5; [email protected] >= 0; [email protected] ) {
			mapannounce .EnterMap$[13], "["+ [email protected] +"]", 0;
			sleep 1000;
		}
		[email protected]_candy_amount = .register_count * 12; // drop the amount of candies equal to no. of participants x 12
		freeloop 1;
		while ( [email protected] < [email protected]_candy_amount ) {
			while ( checkcell( .EnterMap$[13], [email protected] = rand(450), [email protected] = rand(450), cell_chknopass ) );
			makeitem .candy_id, 1, .EnterMap$[13], [email protected], [email protected];
			[email protected]++;
		}
		freeloop 0;
		sleep 60000;
		for ( [email protected] = 0; [email protected] < .register_count; [email protected]++ ) {
			if ( attachrid( .register_aid[[email protected]] ) ) {
				[email protected] = countitem( .candy_id );
				if ( [email protected] >= [email protected] ) {
					setd "[email protected]"+ [email protected] +"["+ getarraysize( getd( "[email protected]"+ [email protected] ) ) +"]", getcharid(3);
					[email protected] = [email protected];
				}
				delitem .candy_id, countitem( .candy_id );
			}
		}
		cleanmap .EnterMap$[13];
		if ( [email protected] = getarraysize( getd( "[email protected]"+ [email protected] ) ) ) {
			for ( [email protected] = 0; [email protected] < [email protected]; [email protected]++ ) {
				attachrid getd( "[email protected]"+ [email protected] +"["+ [email protected] +"]" );
				Func_Prizes(getcharid(0),.EventName$[13]);
			}
			mapannounce .EnterMap$[13], "Event end, there are "+ [email protected] +" player having most "+ getitemname( .candy_id ) +" ! "+ [email protected]$, 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;
	[email protected] = 0;
	end;

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

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

OnStartGame:
	deletearray .MobCount[0],getarraysize( .MobCount );
	for( [email protected] = .CountXY[0]; [email protected] <= .CountXY[2]; [email protected]++ ){
		for( [email protected] = .CountXY[1]; [email protected] <= .CountXY[3]; [email protected]++ ){
			[email protected] = rand( getarraysize( .CountMonster ) );
			monster .EnterMap$[14],[email protected],[email protected],"Count Me",.CountMonster[[email protected]],1,strnpcinfo(3)+"::OnKilled";
			.GID = [email protected];
			setunitdata .GID,UMOB_DMGIMMUNE,1;
			.MobCount[[email protected]] = .MobCount[[email protected]] + 1;
			sleep 1;
		}
	}
	[email protected] = rand( getarraysize( .CountMonster ) );
	deletepset 1;
	defpattern 1, "([^:]+): (\\|\\d{2})?"+.MobCount[[email protected]]+ ".$", "OnRight";
	defpattern 1,"([^:]+):.*.*", "OnSpam";
	activatepset 1;
	delwaitingroom;
	waitingroom getmonsterinfo( .CountMonster[[email protected]],0 ),0;
	npctalk "Count for the Targeted Monster's Amount to Win the Game.";
	[email protected] = -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( [email protected] != -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;
		[email protected] = 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	[email protected] = 0;

	}
	end;

OnKilled:
	end;

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

	mapwarp .EnterMap$[15],"prontera",155,172;
	[email protected] = 15;
	Func_Countdown;
	[email protected] = -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([email protected] = 30; [email protected] > 0; [email protected]){
			if(!getmapusers(.EnterMap$[15]))
				[email protected] = 0;
			// mapannounce .EnterMap$[15],"There are "+([email protected])+" 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;
	[email protected] = 0;
	end;

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

	killmonsterall .EnterMap$[16];
	query_sql("DELETE FROM `char_reg_num` WHERE `key` = 'fabre'");
	mapwarp .EnterMap$[16],"prontera",155,172;
	[email protected] = 16;
	pvpoff .EnterMap$[16];
	for ( [email protected] = 0; [email protected] < getarraysize( .bombflag ); [email protected]++ )
		setmapflag .EnterMap$[16], .bombflag[[email protected]];
	Func_Countdown;
	[email protected] = -16;
	if(getmapusers(.EnterMap$[16]) < .MinPlayers[16]){
		mapannounce .EnterMap$[16],"Event Stopped! Not Enough Players Joined the "+.EventName$[16]+"!",bc_blue;
		for ( [email protected] = 6; [email protected] < getarraysize( .bombflag ); [email protected]++ )
			removemapflag .EnterMap$[16], .bombflag[[email protected]];
		[email protected] = 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([email protected] = 5; [email protected] > 0; [email protected]){
			if(getmapusers(.EnterMap$[16]) < 1) [email protected] = 0;
			mapannounce .EnterMap$[16],callfunc("F_InsertPlural",[email protected],"Minute")+" Remaining.",bc_blue;
			sleep 60000;
		}
		killmonsterall .EnterMap$[16];
		for ( [email protected] = 6; [email protected] < getarraysize( .bombflag ); [email protected]++ )
			removemapflag .EnterMap$[16], .bombflag[[email protected]];
		[email protected] = 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",[email protected],[email protected]$,[email protected]);
		[email protected] = getarraysize( [email protected] );
		for ( [email protected] = 0; [email protected] < [email protected]; [email protected]++ ){
			if([email protected] == [email protected][[email protected]])
				Func_Prizes([email protected][[email protected]],.EventName$[16]);
			else	break;
		}
		mapannounce .EnterMap$[16],.EventName$[16]+" ended with a total  of "+([email protected]+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 ( [email protected] = 0; [email protected] < getarraysize( .devilflag ); [email protected]++ )
		setmapflag .EnterMap$[17], .devilflag[[email protected]];
	[email protected] = 17;
	Func_Countdown;
	[email protected] = -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 ([email protected] = 0; [email protected] < getmapusers(.EnterMap$[17]); [email protected]++){
			.monstercount = 3;
			for ([email protected] = 0; [email protected] < .monstercount; [email protected]++) {
				.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 = [email protected] = 0;
	killmonsterall .EnterMap$[17];
	for ( [email protected] = 6; [email protected] < getarraysize( .devilflag ); [email protected]++ )
		removemapflag .EnterMap$[17], .devilflag[[email protected]];
	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([email protected] = 0; [email protected] < getmapusers(.EnterMap$[17]); [email protected]++){
				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;
				[email protected] = 65 + .round * 5;
				[email protected] = [email protected] + 5;
				set .monsterset, query_sql("SELECT id, iname, hp FROM `mob_db` where LV <= "[email protected]+" and LV >= "[email protected]+" and hp < 99999999 and MEXP = 0 and not iName='Treasure Chest' ORDER BY RAND() LIMIT 100", .monsterid, .monstername$, .monsterhp);
				for([email protected] = 0; [email protected] < getmapusers(.EnterMap$[17]); [email protected]++){
					.monstercount = 3;
					for([email protected] = 0; [email protected] < .monstercount; [email protected]++) {
						.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([email protected] == -10 && getcharid(3) == [email protected]){
		mapannounce .EnterMap$[10],"The target has logged out of this game. This round will be nulled.",bc_blue;
		[email protected] = -1;
	} else if([email protected] == -13 || [email protected] == 13){
		for([email protected] = 0; [email protected] < .register_count; [email protected]++)
			if(getcharid(3) == .register_aid[[email protected]])
				deletearray .register_aid[[email protected]], 1;
	}
	end;

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

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

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

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

	// Recive rewards via
	// [0] = Direct to inv
	// [1] = Mail / RoDex
	[email protected] = 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 [email protected]	,7539,0,0,0,0;
	setarray [email protected]	,    50,0,0,0,0;
	[email protected] = 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
	[email protected] = 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","[email protected]","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";
	[email protected] = 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;
	[email protected] = getnpctimer(0);
	[email protected] = [email protected] / 60000;
	[email protected] = ([email protected] - [email protected] * 60000) / 1000;
	[email protected] = [email protected] % 1000;
	if([email protected] < BestTime || !BestTime)
		BestTime = [email protected];
	if([email protected] < [email protected]){
		[email protected] = [email protected];
		[email protected] = getcharid(0);
		announce "[Emperium Event]: "+strcharinfo(0)+" now holds the top time of "+(([email protected])?callfunc("F_InsertPlural",[email protected],"minute")+" ":"")+""+(([email protected])[email protected]+""+(([email protected])?"."[email protected]:"")+" seconds":"")+".",bc_all|bc_blue;
	}
	mapannounce .Map$,"You have a "+(([email protected] == BestTime)?"new personal best ":"")+"time of "+(([email protected])?callfunc("F_InsertPlural",[email protected],"minute")+" ":"")+""+(([email protected])[email protected]+""+(([email protected])?"."[email protected]:"")+" 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 = [email protected];
	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([email protected] == -5){
		[email protected] = 0;
		announce "Congrats "+strcharinfo(0)+", a winner in the Maze Event.",bc_all|bc_blue;
		WonEvents++;
		MWonEvents++;
		if([email protected]){
			mail getcharid(0), "no-reply", "Maze Event", "Congratulations!% You have won in the Maze Event % % %[ Your reward is attached. ]", [email protected], [email protected], [email protected];
			query_sql("UPDATE `mail` SET message = REPLACE(message,'%',CHAR(13)) WHERE send_name = 'no-reply'");
		} else {
			getitem [email protected],[email protected];
			zeny += [email protected];
		}
		mapwarp "maze","prontera",155,172;
	}
	warp "prontera",155,172;
	end;
}

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

prontera,155,227,4	script	Cluckers	800,{
	if ([email protected] == -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([email protected]){
						mail getcharid(0), "no-reply", "Cluckers Event", "Congratulations!% You have won in the Cluckers Event % % %[ Your reward is attached. ]", [email protected], [email protected], [email protected];
						query_sql("UPDATE `mail` SET message = REPLACE(message,'%',CHAR(13)) WHERE send_name = 'no-reply'");
					} else {
						getitem [email protected],[email protected];
						zeny += [email protected];
					}
					[email protected] = 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:
	[email protected] = 7;
	for([email protected] = 5; [email protected] > 0; [email protected]){
		Announce "Cluckers Event Will begin in "+callfunc("F_InsertPlural",[email protected],"minute")+"!",bc_blue;
		Announce "Please type @joinevent to join",bc_blue;
		sleep 60000;
	}
	Announce "Cluckers Event Has Begun!",bc_blue;
	[email protected] = -7;
	sleep 60000 * 45;
	if([email protected] == -7){
		[email protected] = 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([email protected] == -15){
		if(getgmlevel() == 99)
			dispbottom $MonsterName$+"";
		input [email protected]$;
		if([email protected]$ == $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([email protected]){
		mail getcharid(0), "no-reply", "Disguise Event", "Congratulations!% You have won in the Disguise Event % % %[ Your reward is attached. ]", [email protected], [email protected], [email protected];
		query_sql("UPDATE `mail` SET message = REPLACE(message,'%',CHAR(13)) WHERE send_name = 'no-reply'");
	} else {
		getitem [email protected],[email protected];
		zeny += [email protected];
	}
	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...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.