Jump to content
  • 0

BG Common of Easycore


Eross

Question


  • Group:  Members
  • Topic Count:  155
  • Topics Per Day:  0.11
  • Content Count:  349
  • Reputation:   12
  • Joined:  04/05/20
  • Last Seen:  

I need a small help for Easycores bg_common npc on BG 2.0 guys ... How can I make it disable on reload or OnInit ? and Start on my set hour ? like I tried adding OnClock below OnBGStartCommand: but nothing happen ..I want to schedule Normal bg on 12pm to 3pm and Happy hours schedule is different ...I keeps on announcing after I reload hehehe .... And also where can I set rewards or make it usable items ? I tried to reach out on @Easycore but I think he's busy. Thankyou 

//===== rAthena Script =======================================
//    Extended Battleground
//= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
// Date:
//  10-10-2019
// By:
//  Easycore         (Zephyrus, original author)
//
// Contact:
//    - Facebook: https://www.facebook.com/EasycoreRo/
//    - rAthena:  https://rathena.org/board/profile/16425-easycore/
//    - Discord:  Easycore#3412
//= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 

// ==============================================================================
// BattleGround System - Common NPCs
// ==============================================================================

// MapFlags
// *********************************************************************

bat_room	mapflag	nomemo
bat_room	mapflag	nowarpto
bat_room	mapflag	nobranch
bat_room	mapflag	nopenalty
bat_room	mapflag	noteleport
bat_room	mapflag	nosave	SavePoint
//bat_room	mapflag	allow_bg_items // Funcion no agregada [Easycore]
// Mapflag Town is required to Join BG Queues
bat_room	mapflag	town

// Battleground Queue Handler
// *********************************************************************
-	script	BG_Queue_Join	-1,{
	end;

OnInit:
	// Configuration
	// *****************************************************
	// Battleground Rotation - Main NPC name
	setarray .BG_Arenas$[0],		"Conquest";
	// Battleground Arena Name - for announcements
	setarray .BG_Names$[0],		"Conquest";
	// Minimum Players to start the BG
	setarray .BG_Min[0],	              1;
	// Maximum Players per Team
	setarray .BG_Max[0],	             50;
	// BG Message Colors
	setarray .BG_Color$[0],	                "0xFFA500";
	setarray .BG_Color2[0],	                0xFFA500;
	// Team Building Mode : 0 = Lineal | 1 = Random | 2 = Class Priority | 3 = Faction Mode | 4 = Team Color (by script set Bat_Team,N;)
	set .TeamMode, 2;
	// Happy Hour - 1: Enabled | 0: Disabled
	set .HappyHour, 1; 
	// Happy Hour - Reward rates %
	set .HappyHourRates, 100 + 20; // +20%
	// Main Code
	// *****************************************************
	set .BG_Count, getarraysize(.BG_Arenas$);
	set .BG_Queue, bg_queue_create("Battleground Arena","BG_Queue_Join::OnJoinEvent",80);
	set .VS_Queue, bg_queue_create("Free For All Arena","BG_Queue_Join::OnVersusJoin",80);
	set .HWE, 0;
	// Move to Next Arena
	if ($BG_Index >= .BG_Count) set $BG_Index,0; // Restart Rotation
	set .TotalArenas, getarraysize(.BG_Arenas$);
	set .BG_Arena$,.BG_Arenas$[$BG_Index];
	set .Ready, 1;
	initnpctimer; // Rotation if BG don't start... Comment if you don't want to use this method
	/* Commands */
	// Admin/GM Commands
	bindatcmd "bgstart","BG_Queue_Join::OnBGStartCommand",99,99;
	bindatcmd "bgstop","BG_Queue_Join::OnBGStopCommand",99,99;
	bindatcmd "bgmode","BG_Queue_Join::OnBGModeCommand",99,99;		// [Easycore]
	bindatcmd "bgsize","BG_Queue_Join::OnBGSizeCommand",99,99;		// [Easycore]
	bindatcmd "bghappyhour","BG_Queue_Join::OnBGHHCommand",99,99;	// [Easycore]
	// Player Commands
	bindatcmd "joinbg","BG_Queue_Join::OnDoJoin",0,99;
	bindatcmd "leavebg","BG_Queue_Join::OnDoLeave",0,99;
	end;

OnDoJoin: // @joinbg
	if (getbattleflag("bg_eAmod_mode") == 0) {
		message strcharinfo(0),"Battlegrounds are currently disabled.";
		end;
	} else if (agitcheck() || agitcheck2()) {
		dispbottom "[Battleground is currently disabled for this moment due to War of Emperium.]";
		end;
	} else if (checkquest(8600,PLAYTIME) == 2) {
		erasequest 8600;
	} else if (checkquest(8600,PLAYTIME) == 0) {
		dispbottom "[You are a Deserter. You can't participate until the indicator goes off]";
		end;
	}

	bg_queue_join .BG_Queue;
	end;

OnDoLeave: // @leavebg
	bg_queue_leave .BG_Queue;
	end;
// Easycore
// @bgmode <1-10>
OnBGModeCommand:
	.@x = atoi(.@atcmd_parameters$[0]);
	if (.@x <= .TotalArenas+1 && .@x > 0) {
		if (.@x == 1)
			set $BG_Index, rand(.TotalArenas)-1;
		else
			set $BG_Index, .@x-3;
		message strcharinfo(0),"["+.BG_Names$[$BG_Index+1]+"] has been set.";
		donpcevent "BG_Queue_Join::OnRotate";
		end;
	} else {
		message strcharinfo(0), "Usage: @bgmode <1-"+(.TotalArenas+1)+">";
		dispbottom "#1 - Random",0xFFFFFF;
		for (.@i = 0; .@i<.TotalArenas; .@i++)
			dispbottom "#"+(.@i+2)+" - "+.BG_Names$[.@i],.BG_Color2[.@i];			
		end;
	}
		
// @bgsize <1-10> <min> <max>
OnBGSizeCommand:
	.@x = atoi(.@atcmd_parameters$[0]);
	.@x2 = atoi(.@atcmd_parameters$[1]);
	.@x3 = atoi(.@atcmd_parameters$[2]);
	if (.@x2 == 0 || .@x3 == 0) {
		message strcharinfo(0), "Usage: @bgsize <0-"+.TotalArenas+"> <min players> <max players>";
		dispbottom "#0 - All Arenas",0xFFFFFF;
		for (.@i = 0; .@i<.TotalArenas; .@i++)
			dispbottom "#"+(.@i+1)+" - "+.BG_Names$[.@i],.BG_Color2[.@i];			
		end;
	} else if (.@x2 > .@x3) {
		message strcharinfo(0), "@bgsize failed: min players is higher than max players. ";
		end;
	}	
	if (.@x <= .TotalArenas && .@x > 0) {
		message strcharinfo(0),"["+.BG_Names$[.@x-1]+"] min players is <"+.@x2+"> and max players is <"+.@x3+">.";
		setarray .BG_Min[.@x-1],.@x2;
		setarray .BG_Max[.@x-1],.@x3;
	} else {
		message strcharinfo(0),"[All Arenas] min players is <"+.@x2+"> and max players is <"+.@x3+">.";
		setarray .BG_Min[0],.@x2,.@x2,.@x2,.@x2,.@x2,.@x2,.@x2,.@x2,.@x2;
		setarray .BG_Max[0],.@x3,.@x3,.@x3,.@x3,.@x3,.@x3,.@x3,.@x3,.@x3;
	}
	end;
// @bghappyhour
OnBGHHCommand:
	if (.HappyHour == 0) {
		message strcharinfo(0),"Happy Hour is currently disabled.";
		end;
	}
	if (getbattleflag("bg_eAmod_mode") == 0) {
		message strcharinfo(0),"Battlegrounds are currently disabled.";
		end;
	}
	if (!.HWE)
		donpcevent "BG_Queue_Join::OnDoHappyHour";
	else
		donpcevent "BG_Queue_Join::OnEndHappyHour";
	end;
OnBGStartCommand:
	if (getbattleflag("bg_eAmod_mode") == 1) {
		message strcharinfo(0),"Battlegrounds is already enabled.";
		end;
	}
	setbattleflag "bg_eAmod_mode", 1;
	message strcharinfo(0),"Battlegrounds have been enabled.";
	donpcevent "BG_Queue_Join::OnRotate";
	callsub OnEndArena;
OnBGStopCommand:
	setbattleflag "bg_eAmod_mode", 0;
	set .HWE, 0;
	setbattleflag "bg_reward_rates",100; // Normal Rates
	message strcharinfo(0),"Battlegrounds have been disabled.";
	.@msg$ = "[Battlegrounds] Arenas and Queuing have been disabled by a Game Master.";
	announce .@msg$, 0, 0x00FFFF, 0x190, 12, 100, 100;
	if ($@BG_Status != 0)
		donpcevent .BG_Arena$+"::OnMatchEnd";
	callsub OnEndArena;
OnEndArena:
	set $@BG_Status, 0;
	if ($@BG_Team1 == 0 && $@BG_Team2 == 0 && $@BG_Team3 == 0)
		end;
	// Warps Teams
	bg_warp $@BG_Team1,"bat_room",155,150;
	bg_warp $@BG_Team2,"bat_room",155,150;
	bg_warp $@BG_Team3,"bat_room",155,150;
	// Destroy Teams
	bg_destroy $@BG_Team1; set $@BG_Team1, 0;
	bg_destroy $@BG_Team2; set $@BG_Team2, 0;
	bg_destroy $@BG_Team3; set $@BG_Team3, 0;
OnRotate:
OnTimer10000: // Rotation if BG don't start... Comment if you don't want to use this method. 120 = 2 Minutes
	// Check if BG is enabled/disabled [Easycore]
	if (getbattleflag("bg_eAmod_mode") == 0) end;

	// Move to Next Arena
	if (set($BG_Index,$BG_Index + 1) >= .BG_Count)
		set $BG_Index,0; // Restart Rotation

	set .BG_Arena$,.BG_Arenas$[$BG_Index];
	initnpctimer; // Rotation if BG don't start... Comment if you don't want to use this method

OnJoinEvent:
	if ($@BG_Status == 2)
		end; // BG Ending... Must wait until OnRotate is called

	set .@Queue_Count, bg_queue_data(.BG_Queue,0);
	switch($@BG_Status) {
		case 0: // Idle - Ready to Start
			if (.BG_Arena$ == "Tierra_TI")
				set .@Req, .BG_Min[$BG_Index] * 3;
			else
				set .@Req, .BG_Min[$BG_Index] * 2;

			if (bg_queue_checkstart(.BG_Queue,.TeamMode,((.BG_Arena$ == "Tierra_TI") ? 3 : 2),.BG_Min[$BG_Index])) {
				donpcevent .BG_Arena$ + "::OnBuildTeams";

				// Fill Teams with Queue Members			
				if (.BG_Arenas$[$BG_Index] == "Tierra_TI")
					bg_queue2teams .BG_Queue,.BG_Min[$BG_Index],.BG_Max[$BG_Index],.TeamMode,$@BG_Team1,$@BG_Team2,$@BG_Team3;
				else
					bg_queue2teams .BG_Queue,.BG_Min[$BG_Index],.BG_Max[$BG_Index],.TeamMode,$@BG_Team1,$@BG_Team2;

				stopnpctimer; // Rotation if BG don't start... Comment if you don't want to use this method

				set $@BG_Status,1;
				set .@msg$, "Battleground -- " + .BG_Names$[$BG_Index] + " -- Begining";
				bgannounce .@msg$,.BG_Color$[$BG_Index];

				donpcevent .BG_Arena$ + "::OnReady";
			} else {
				set .@msg$, "Battleground -- " + .BG_Names$[$BG_Index] + " -- " + (.@Req - .@Queue_Count) + " more players to start.";
				bgannounce .@msg$,.BG_Color$[$BG_Index];
			}
			break;
		case 1: // Running - Others can join
			if (.@Queue_Count > 0) {
				if (.BG_Arena$ == "Tierra_TI") {
					bg_balance_teams .BG_Queue,.BG_Max[$BG_Index],.TeamMode,$@BG_Team1,$@BG_Team2,$@BG_Team3;
					set .@BG_Count1, bg_get_data($@BG_Team1,0);
					set .@BG_Count2, bg_get_data($@BG_Team2,0);
					set .@BG_Count3, bg_get_data($@BG_Team3,0);
					set .@msg$, "Battleground -- " + .BG_Names$[$BG_Index] + " -- B: " + .@BG_Count1 + "/" + .BG_Max[$BG_Index] + ", R: " + .@BG_Count2 + "/" + .BG_Max[$BG_Index] + ", G: " + .@BG_Count3 + "/" + .BG_Max[$BG_Index] + " (Playing)";
				} else {
					bg_balance_teams .BG_Queue,.BG_Max[$BG_Index],.TeamMode,$@BG_Team1,$@BG_Team2;
					set .@BG_Count1, bg_get_data($@BG_Team1,0);
					set .@BG_Count2, bg_get_data($@BG_Team2,0);
					set .@msg$, "Battleground -- " + .BG_Names$[$BG_Index] + " -- B: " + .@BG_Count1 + "/" + .BG_Max[$BG_Index] + ", R: " + .@BG_Count2 + "/" + .BG_Max[$BG_Index] + " (Playing)";
				}

				bgannounce .@msg$,.BG_Color$[$BG_Index];
			}
			break;
	}
	end;

OnVersusJoin:
	if ($@VS_Status != 0)
		end;

	set .@Queue_Count, bg_queue_data(.VS_Queue,0);
	if (.@Queue_Count >= 10) {
		donpcevent "FFA_Arena::OnBuildTeams";
		bg_queue2teams .VS_Queue,1,1,0,$@VS_Team[0],$@VS_Team[1],$@VS_Team[2],$@VS_Team[3],$@VS_Team[4],$@VS_Team[5],$@VS_Team[6],$@VS_Team[7],$@VS_Team[8],$@VS_Team[9];
		set $@VS_Status,1;
		announce "Battleground -- Free For All -- Begining",0,0x483D8B;
		donpcevent "FFA_Arena::OnReady";
	}
	else
		announce "Battleground -- Free For All -- " + (10 - .@Queue_Count) + " more players to start",0,0x483D8B;
	end;

OnFri0600: // Friday, 6 a.m.
	//rankreset 1; // Ranking Reset
	end;

// BattleGround Happy Hour
OnDoHappyHour:
OnClock1600:
OnClock2000:
	if (getbattleflag("bg_eAmod_mode") == 0 || .HappyHour == 0) end;
	set .HWE, 1;
	announce "-- Battleground Happy Hour has begun --",0,0x00FF00;
	setbattleflag "bg_reward_rates",.HappyHourRates; // +20% Reward Rates
	end;
OnEndHappyHour:
OnClock1800:
OnClock2200:
	if (getbattleflag("bg_eAmod_mode") == 0 || .HappyHour == 0) end;
	set .HWE, 0;
	announce "-- Battleground Happy Hour is over --",0,0x00BFFF;
	setbattleflag "bg_reward_rates",100; // Normal Rates
	end;
}

// Registration NPC
// *********************************************************************
-	script	BG_Register	FAKE_NPC,{

	if (getvariableofnpc(.Ready,"BG_Queue_Join") == 0)
		donpcevent "BG_Queue_Join::OnInit";

	mes "[^FFA500Battle Recruiter^000000]";
	mes "This is the Battleground Information and Registration service.";
	mes "What do you want to do?";
	next;
	switch(select("^FFA500Battleground Arenas^000000:^0000FFFree For All Arena^000000:Warp to Battle Room")) {
	case 1:
		mes "[^FFA500Battle Recruiter^000000]";
		mes "Battlegrounds Arena are different kinds of games where Teams fight for victory.";
		mes "What do you want to do?";
		next;
		switch(select("Register:Party Register:Leave Queue:Battleground Help")) {
		case 1:
			if (BaseLevel < 80)
			{
				mes "[^FFA500Battle Recruiter^000000]";
				mes "Min required level to join a battleground is 80.";
				close;
			}
			if (checkquest(8600,PLAYTIME) == 2)
				erasequest 8600;
			if (checkquest(8600,PLAYTIME) == 1)
			{
				mes "[^FFA500Battle Recruiter^000000]";
				mes "You are a Deserter. You can't participate until the indicator goes off";
				close;
			}

			mes "[^FFA500Battle Recruiter^000000]";
			mes "Let's proceed with the registration...";
			mes "You must wait on any City until BG starts.";
			mes "Close this window to continue...";
			close2;
			bg_queue_join getvariableofnpc(.BG_Queue,"BG_Queue_Join");
			end;
		case 2:
			if (getcharid(1) == 0)
			{
				mes "[^FFA500Battle Recruiter^000000]";
				mes "You are not on a Party.";
				close;
			}

			mes "[^FFA500Battle Recruiter^000000]";
			mes "Let's proceed with the registration...";
			mes "You must wait on any City until BG starts.";
			mes "Close this window to continue...";
			close2;
			bg_queue_partyjoin getcharid(1),getvariableofnpc(.BG_Queue,"BG_Queue_Join");
			end;
		case 3:
			mes "[^FFA500Battle Recruiter^000000]";
			mes "If you are registered, you will be removed.";
			mes "Are you sure?";
			next;
			if (select("Yes, leave queue:No, I will stay") == 2)
			{
				mes "[^FFA500Battle Recruiter^000000]";
				mes "Ok, nothing to change.";
				close;
			}

			mes "[^FFA500Battle Recruiter^000000]";
			mes "Close this window to continue...";
			close2;
			bg_queue_leave getvariableofnpc(.BG_Queue,"BG_Queue_Join");
			end;
		case 4:
			mes "[^FFA500Battle Recruiter^000000]";
			mes "Tell me... what battleground you don't understand?";
			next;
			switch(select("Capture the Flag:Team DeathMatch:Stone Control:Eye of Storm:Bossnia:Domination:Triple Inferno:Conquest:Rush"))
			{
			case 1:
				mes "[^FFA500Battle Recruiter^000000]";
				mes "The objective of the Flavius Battle CTF is to score 3 points before your enemy, by capture their Flag.";
				next;
				mes "[^FFA500Battle Recruiter^000000]";
				mes "To capture a Flag you need to take the enemy flag, and bring it to your base flag.";
				next;
				mes "[^FFA500Battle Recruiter^000000]";
				mes "If your base flag is captured too, you need to kill the flag carrier and take the flag back to your base.";
				break;
			case 2:
				mes "[^FFA500Battle Recruiter^000000]";
				mes "Kill all the enemy players to let their Team without points.";
				mes "Protect our army.";
				break;
			case 3:
				mes "[^FFA500Battle Recruiter^000000]";
				mes "Take the Stones in the middle of the battlefield and put in on your base, in the Stone Points.";
				next;
				mes "[^FFA500Battle Recruiter^000000]";
				mes "Each Stone will give points to your team. First team reach 99 points wins the game.";
				next;
				mes "[^FFA500Battle Recruiter^000000]";
				mes "Protect your stones from to be captured by the enemy.";
				break;
			case 4:
				mes "[^FFA500Battle Recruiter^000000]";
				mes "There are two bases, North and South which teams can capture by holding position on the Base more than the other team.";
				next;
				mes "[^FFA500Battle Recruiter^000000]";
				mes "Each base will give you points each 5 seconds of Domination. If your Team control both bases the amount of points increases.";
				next;
				mes "[^FFA500Battle Recruiter^000000]";
				mes "To get aditional points, in the middle there is a Flag spawn, capture it and put it on any of your team Bases.";
				next;
				mes "[^FFA500Battle Recruiter^000000]";
				mes "The first Team reach 99 points wins the match.";
				break;
			case 5:
				mes "[^FFA500Battle Recruiter^000000]";
				mes "Attack the enemy base and destroy each MVP Guardian. To do damage to the guardian your team must capture the Balance Flag in the middle base.";
				next;
				mes "[^FFA500Battle Recruiter^000000]";
				mes "Each team have 5 guardian to be protected or killed.";
				break;
			case 6:
				mes "[^FFA500Battle Recruiter^000000]";
				mes "There are three bases, North, Center and South which teams can capture by holding position on the Base more than the other team.";
				next;
				mes "[^FFA500Battle Recruiter^000000]";
				mes "Each base will give you points each 5 seconds of Domination.";
				next;
				mes "[^FFA500Battle Recruiter^000000]";
				mes "The first Team reach 99 points wins the match.";
				break;
			case 7:
				mes "[^FFA500Battle Recruiter^000000]";
				mes "There are 3 teams in the battlefield, your team and other 2 enemies.";
				next;
				mes "[^FFA500Battle Recruiter^000000]";
				mes "Kill the enemy players, collect the skulls and bring then to the Sacrifice Totem to win points.";
				next;
				mes "[^FFA500Battle Recruiter^000000]";
				mes "You can collect your own team skulls and bring then to your Sacrifice Totem to avoid other teams to score.";
				next;
				mes "[^FFA500Battle Recruiter^000000]";
				mes "If you get killed all your skulls will be drop to the floor, including your own skull. First Team to get 80 points wins the battle.";
				break;
			case 8:
				mes "[^FFA500Battle Recruiter^000000]";
				mes "If you are Attacking, destroy the enemy defenses and it's Flag.";
				next;
				mes "[^FFA500Battle Recruiter^000000]";
				mes "If you are Defending, protect your castle defenses and the Flag.";
				break;
			case 9:
				mes "[^FFA500Battle Recruiter^000000]";
				mes "Fight to capture the Castle and organize your team to defend it.";
				next;
				mes "[^FFA500Battle Recruiter^000000]";
				mes "If you fail on the first capture, kill the defender and take it for your team.";
				break;
			}
			break;
		}
		close;
	case 2:
		mes "[^FFA500Battle Recruiter^000000]";
		mes "Free For All Arena is a Duel between 10 players with No Teams.";
		mes "The target is to kill 25 players.";
		mes "What do you want to do?";
		next;
		switch(select("Register:Leave Queue")) {
		case 1:
			if (BaseLevel < 80)
			{
				mes "[^FFA500Battle Recruiter^000000]";
				mes "Min required level to join a battleground is 80.";
				close;
			}
			if (checkquest(8600,PLAYTIME) == 2)
				erasequest 8600;
			if (checkquest(8600,PLAYTIME) == 1)
			{
				mes "[^FFA500Battle Recruiter^000000]";
				mes "You are a Deserter. You can't participate until the indicator goes off";
				close;
			}

			mes "[^FFA500Battle Recruiter^000000]";
			mes "Let's proceed with the registration...";
			mes "You must wait on any City until BG starts.";
			mes "Close this window to continue...";
			close2;
			bg_queue_join getvariableofnpc(.VS_Queue,"BG_Queue_Join");
			end;
		case 2:
			mes "[^FFA500Battle Recruiter^000000]";
			mes "If you are registered, you will be removed.";
			mes "Are you sure?";
			next;
			if (select("Yes, leave queue:No, I will stay") == 2)
			{
				mes "[^FFA500Battle Recruiter^000000]";
				mes "Ok, nothing to change.";
				close;
			}

			mes "[^FFA500Battle Recruiter^000000]";
			mes "Close this window to continue...";
			close2;
			bg_queue_leave getvariableofnpc(.VS_Queue,"BG_Queue_Join");
			end;
		}
		break;
	case 3:
		mes "[^FFA500Battle Recruiter^000000]";
		mes "May the War God bless you.";
		close2;
		warp "bat_room",155,150;
		end;
	}
	end;
}

//bat_room,160,150,3	duplicate(BG_Register)	Battle Recruiter#bat	4_F_JOB_KNIGHT
prontera,123,83,3	duplicate(BG_Register)	Battle Recruiter#prt	4_F_JOB_KNIGHT

// General Guillaume
// *********************************************************************
bat_room,160,159,3	script	General Guillaume	4_M_KY_KIYOM,{
	cutin "bat_kiyom2",2;
	mes "[General Guillaume]";
	mes "Hot-blooded adventurer, we need your ability to win this battle.";
	next;
	cutin "bat_kiyom1",2;
	mes "[General Guillaume]";
	mes "Our great king, Marcel Marollo VII, is very sick lately. His Majesty has declared that he chosen either me or Prince Croix as the next king amongst his 9 sons.";
	next;
	mes "[General Guillaume]";
	mes "Two kings can't share a nation!";
	mes "Only the one victorious from His Majesty's appointed battle will be enthroned.";
	next;
	mes "[General Guillaume]";
	mes "This is however, not just a battle between us. This battle will determine the future of this country. I pledge on my honor to prove that I'm the one who can protect this Maroll from outside threats.";
	next;
	switch(select("Join the Blue Team","Join the Green Team","End Conversation")) {
		case 1:
			cutin "bat_kiyom2",2;
			mes "[General Guillaume]";
			mes "Welcome to my army, comrade.";
			mes "Your eyes tell me that you're a soldier that I can trust.";
			set Bat_Team,1;
			next;
			mes "[General Guillaume]";
			mes "Now, go upstairs and apply for battle with your comrades. I'm sure they'll welcome you whole-heartedly!";
			break;
		case 2:
			cutin "bat_kiyom2",2;
			mes "[General Guillaume]";
			mes "So you will take this fight as your own...";
			mes "Then you are my enemy.";
			set Bat_Team,0;
			next;
			mes "[General Guillaume]";
			mes "Go now, We will meet again in the Battlefield.";
			break;
		case 3:
			mes "[General Guillaume]";
			mes "I'll be the one who will capture the flag!";
			break;
	}

	close2;
	cutin "",255;
	end;
}

// General Croix
// *********************************************************************
bat_room,160,140,3	script	Prince Croix	4_M_CRU_CRUA,{
	cutin "bat_crua1",2;
	mes "[Prince Croix]";
	mes "Wise adventurer, why don't you lend us your power for victory?";
	next;
	cutin "bat_crua2",2;
	mes "[Prince Croix]";
	mes "I do not wish to shed blood, but I have no choice but to fight for the possibility of peace and for the sake of my people.";
	next;
	mes "[Prince Croix]";
	mes "General Guillaume may have an advantage in this battle as he is the great general of Maroll, but that doesn't automatically mean he'll win. I want to win this battle so that I can grant a better future for my people.";
	next;
	
	switch(select("Join the Red Team","Join the Green Team","End Conversation")) {
		case 1:
			mes "[Prince Croix]";
			mes "Thank you so much. I feel like I can win with the help of adventurers like you. Now, please go downstairs and join your comrades in sharpening their skills to fight the enemy!";
			set Bat_Team,2;
			break;
		case 2:
			mes "[Prince Croix]";
			mes "So you will take this fight as your own...";
			mes "Then you are my enemy.";
			set Bat_Team,0;
			next;
			mes "[Prince Croix]";
			mes "Go now, We will meet again in the Battlefield.";
			break;
		case 3:
			mes "[Prince Croix]";
			mes "For Maroll!";
			break;
	}	
	
	close2;
	cutin "",255;
	end;
}

// Guard Dummy
// *********************************************************************

bat_room,161,141,3	script	Prince Croix's Aid::bat_aid	4_M_CRU_HEAD,{ end; }
bat_room,161,139,3	duplicate(bat_aid)	Prince Croix's Aid::bat_aid2	4_M_CRU_HEAD
bat_room,161,160,3	duplicate(bat_aid)	General Guillaume's Aid::bat_aid3	4_M_KY_HEAD
bat_room,161,158,3	duplicate(bat_aid)	General Guillaume's Aid::bat_aid4	4_M_KY_HEAD

// Flags
// *********************************************************************

-	script	Base Flag#bg	FAKE_NPC,{ end; }

// BattleGround Warper - Exit
// *********************************************************************

bat_room,148,150,4	script	Teleporter#bat	4_F_TELEPORTER,{
	mes "[Teleporter]";
	mes "Do you wish to leave the battlefield? Use my service to return to town.";
	next;
	if (select("Leave:Don't Leave") == 2) {
		mes "[Teleporter]";
		mes "I'll be here whenever you're in need of my service.";
		close;
	}
	set .@spoint$, getsavepoint(0);
	set .@x, getsavepoint(1);
	set .@y, getsavepoint(2);
	mes "[Teleporter]";
	mes "You will be sent back to " + .@spoint$ + ".";
	close2;
	warp .@spoint$, .@x, .@y;
	end;
}

// Kafra
// *********************************************************************
bat_room,148,147,4	script	Kafra Staff::kaf_bat	4_F_KAFRA9,{
	cutin "kafra_09",2;
	callfunc "F_Kafra",0,2,1,150,0;
}

//== Badges Exchange =======================================
bat_room,160,150,3	script	Erundek	4_M_MANAGER,{
	if (checkweight(1201,1) == 0) {
		mes "- Wait a minute !! -";
		mes "- Currently you're carrying -";
		mes "- too many items with you. -";
		mes "- Please try again -";
		mes "- after you loose some weight. -";
		close;
	}
	mes "[Erundek]";
	mes "Do you have the battlefield badges?";
	mes "I can exchange Bravery Badges and Valor Badges for reward items.";
	next;
	switch(select("Exchange Badges", "Check the Catalog")) {
		case 1:
			mes "[Erundek]";
			mes "Which type of items would you like to exchange?";
			mes "To check more information about the reward items, please use our ^3131FFCatalog^000000.";
			next;
			switch(select("Weapon", "Armor", "Accessory", "Consumable")) {
				case 1:
					mes "[Erundek]";
					mes "You chose ^3131FFWeapon^000000.";
					mes "The following weapons are available for exchange with the battlefield badges.";
					mes "Please note that items for ^3131FFBravery Badges are indicated as (BB)^000000, and ^3131FFValor Badges as (VB)^000000.";
					next;
					switch(select("Dagger/OneSword/TwoSword/TwoSpear", "Staff/Mace/TwoAxe/Shuriken", "Bow/Katar/Music/Whip", "Book/Knuckle", "Revolver/Rifle/Gatling/Shotgun/Launcher")) {
						case 1:
							mes "[Erundek]";
							mes "The following items are available in the ^3131FFDagger, One-Handed Sword, Two-Handed Sword, and Two-Handed Spear^000000 category.";
							next;
							setarray .@Weapons[0],13036,7828,13037,7829,13411,7828,13410,7829,1183,7828,1184,7829,1425,7828,1482,7829;
							break;
						case 2:
							mes "[Erundek]";
							mes "The following items are available in the ^3131FFStaff / Mace / Two-Handed Axe / Huuma Shuriken^000000 category.";
							next;
							setarray .@Weapons[0],1632,7828,1633,7829,1634,7828,1635,7829,1543,7828,1542,7829,1380,7828,1379,7829,13305,7828,13306,7829;
							break;
						case 3:
							mes "[Erundek]";
							mes "The following weapons are available in the ^3131FFBow / Katar / Musical Instrument / Whip^000000 category.";
							next;
							setarray .@Weapons[0],1739,7828,1738,7829,1279,7828,1280,7829,1924,7828,1923,7829,1978,7828,1977,7829;
							break;
						case 4:
							mes "[Erundek]";
							mes "The following weapons are available in the ^3131FFBook / Knuckle^000000 category.";
							next;
							setarray .@Weapons[0],1574,7828,1575,7829,1824,7828,1823,7829;
							break;
						case 5:
							mes "[Erundek]";
							mes "The following weapons are available in the ^3131FFRevolver / Rifle / Gatling Gun / Shotgun / Grenade Launcher^000000 category.";
							next;
							setarray .@Weapons[0],13108,7828,13171,7829,13172,7828,13173,7829,13174,7829;
							break;
					}
					.@menu$ = "";
					for (.@i = 0; .@i < getarraysize(.@Weapons); .@i += 2)
						.@menu$ += getitemname(.@Weapons[.@i])+((.@Weapons[.@i+1]==7828)?"(BB)":"(VB)")+":";
					.@i = (select(.@menu$)-1)*2;
					.@type$ = ((.@Weapons[.@i+1]==7828)?"(BB)":"(VB)");
					mes "[Erundek]";
					mes "You chose ^3131FF"+getitemname(.@Weapons[.@i])+.@type$+"^000000.";
					mes "You can exchange for this item with ^FF0000100 "+getitemname(.@Weapons[.@i+1])+"^000000.";
					mes "Would you like to exchange?";
					next;
					switch(select("Do not exchange", "Exchange")) {
						case 1:
							break;
						case 2:
							mes "[Erundek]";
							mes "Would you like to spend ^FF0000100 "+getitemname(.@Weapons[.@i+1])+"^000000 and receive a ^3131FF"+getitemname(.@Weapons[.@i])+.@type$+"^000000?";
							next;
							mes "[Erundek]";
							mes "Remember, Battleground Reward Items are ^FF0000Character Bound^000000. Are you sure you want this item?";
							next;
							switch(select("Yes", "No")) {
							case 1:
								mes "[Erundek]";
								if (countitem(.@Weapons[.@i+1]) >= 100) {
									mes "Thank you for exchanging.";
									delitem .@Weapons[.@i+1],100;
									getitem .@Weapons[.@i],1;
								}
								else mes "I'm sorry, but you don't have enough badges to exchange.";
								close;
							case 2:
								break;
							}
							break;
					}
					mes "[Erundek]";
					mes "Do you need more time to check the items?";
					close;
				case 2:
					mes "[Erundek]";
					mes "You chose ^3131FFArmor^000000.";
					mes "The following armors are available for exchange with the battlefield badges.";
					next;
					switch(select("Garments / Shoes", "Armor")) {
						case 1:
							setarray .@items[0],2538,50,2539,50,2540,50,2435,50,2436,50,2437,50;
							break;
						case 2:
							setarray .@items[0],2376,80,2377,80,2378,80,2379,80,2380,80,2381,80,2382,80;
							break;
						}
					break;
				case 3:
					mes "[Erundek]";
					mes "You chose ^3131FFAccessory^000000.";
					mes "You can exchange the Medal of Honors with your Badges according to the job classes, as follows:";
					next;
					setarray .@items[0],2733,500,2720,500,2721,500,2722,500,2723,500,2724,500,2725,500;
					.@menu1$ = "Gunslinger:Swordman/Taekwon Master:Thief:Acolyte:Magician:Archer:Merchant";
					break;
				case 4:
					mes "[Erundek]";
					mes "You chose ^3131FFConsumable^000000.";
					mes "The following consumable items are available for exchange with the battlefield badges:";
					next;
					setarray .@items[0],12269,10,12270,10,12271,5,12272,10,12273,10;
					break;
			}
			break;
		case 2:
			mes "[Erundek]";
			mes "We have many items, so please take a look and purchase deliberately.";
			close2;
			readbook 11010,1;
			end;
	}
	.@menu$ = "";
	if (.@menu1$ != "") .@menu$ = .@menu1$;
	else for (.@i = 0; .@i < getarraysize(.@items); .@i += 2)
		.@menu$ += getitemname(.@items[.@i])+":";
	.@i = (select(.@menu$)-1)*2;
	mes "[Erundek]";
	mes "You chose ^3131FF"+getitemname(.@items[.@i])+"^000000.";
	switch(.@items[.@i]) {
		case 2720: mes "This item is for Swordman and Taekwon Master Class only."; break;
		case 2721: mes "This item is for Thief Class only."; break;
		case 2722: mes "This item is for Acolyte Class only."; break;
		case 2723: mes "This item is for Magician Class only."; break;
		case 2724: mes "This item is for Archer Class only."; break;
		case 2725: mes "This item is for Merchant Class only."; break;
		case 2733: mes "This item is for Gunslinger only."; break;
		default: break;
	}
	mes "You can exchange for this item with ^FF0000"+.@items[.@i+1]+" "+getitemname(7828)+" or "+.@items[.@i+1]+" "+getitemname(7829)+"^000000.";
	mes "Would you like to exchange?";
	next;
	switch(select("Do not exchange", "Exchange")) {
		case 1:
			mes "[Erundek]";
			mes "Do you need more time to check the items?";
			break;
		case 2:
			mes "[Erundek]";
			mes "Which Badge do you want to exchange?";
			mes "You need ^3131FF"+.@items[.@i+1]+" Badges^000000 to exchange.";
			next;
			if (.@item[0] < 12269 || .@item[0] > 12273) {
				mes "[Erundek]";
				mes "Remember, Battleground Reward Items are ^FF0000Character Bound^000000. Are you sure you want this item?";
				next;
			}
			.@j = select("Bravery Badge", "Valor Badge", "Cancel");
			mes "[Erundek]";
			if (.@j == 3) {
				mes "You cancelled the exchange.";
				break;
			}
			.@cost = ((.@j==1)?7828:7829);
			if (countitem(.@cost) >= .@items[.@i+1]) {
				mes "Thank you for exchanging.";
				delitem .@cost, .@items[.@i+1];
				getitem .@items[.@i],1;
			}
			else mes "You do not have enough "+getitemname(.@cost)+"s.";
			break;
	}
	close;
}

bat_room,160,148,3	script	Telma	701,{
	mes "[Telma]";
	mes "Welcome, mighty warrior.";
	mes "Do you need supplies for your battles?";
	mes "I can exchange supplies for your badges...";
	next;
	
	switch(select("150 Condensed White Potion:90 Blue Potion:3 Poison Bottle:30 Fire Bottle:30 Acid Bottle:30 Plant Bottle:30 Marine Sphere Bottle:15 Glistening Coat:50 Yellow Gemstone:50 Red Gemstone:100 Blue Gemstone:5 Speed Potion:20 Cobweb")) {
		case 1:		callsub S_BuyConsumableBG,547,150;	// Condensed White Potion
		case 2:		callsub S_BuyConsumableBG,505,90;	// Blue Potion
		case 3:		callsub S_BuyConsumableBG,678,3;	// Poison Bottle
		case 4:		callsub S_BuyConsumableBG,7135,30;	// Fire Bottle
		case 5:		callsub S_BuyConsumableBG,7136,30;	// Acid Bottle
		case 6:		callsub S_BuyConsumableBG,7137,30;	// Plant Bottle
		case 7:		callsub S_BuyConsumableBG,7138,30;	// Marine Sphere Bottle
		case 8:		callsub S_BuyConsumableBG,7139,15;	// Glistening Coat
		case 9:		callsub S_BuyConsumableBG,715,50;	// Yellow Gemstone
		case 10:	callsub S_BuyConsumableBG,716,50;	// Red Gemstone
		case 11:	callsub S_BuyConsumableBG,717,100;	// Blue Gemstone
		case 12:	callsub S_BuyConsumableBG,12016,5;	// Speed Potion
		case 13:	callsub S_BuyConsumableBG,1025,20;	// Cobweb
	}
	end;

S_BuyConsumableBG:
	set .@item_id, getarg(0);
	set .@amt, getarg(1);
	
	mes "[Telma]";
	mes "Do you want it for?...";
	next;
	if (select("~ Battleground:~ War of Emperium") == 1) .@bg_item = 1;
	mes "[Telma]";
	mes "How many sets of ^0000FF"+ .@amt +" "+ getitemname(.@item_id) +"s^000000 do you want?";
	mes "1 = "+ .@amt   +" supplies = 1 badge";
	mes "2 = "+ .@amt*2 +" supplies = 2 badges";
	mes "3 = "+ .@amt*3 +" supplies = 3 badges";
	mes "etc..";
	next;
	input .@sets;
	mes "[Telma]";
	if (.@sets < 1) {
		mes "Enter a positive amount, greater than zero.";
		close;
	}
	mes "So you want ^0000FF"+ (.@amt*.@sets) +" "+ getitemname(.@item_id) +"s^000000...";
	mes "Remember these can only be used in "+((.@item_id)?"BattleGround":"WoE Maps");
	mes "It will cost you "+ .@sets +" badge(s)...";
	next;
	switch(select("Give her "+ .@sets +" Bravery Badge(s):Give her "+ .@sets +" Valor Badge(s):Give her "+ (3*.@sets) +" Heroism Badges")) {
		case 1: set .@badge,7828; set .@cost,1; break;
		case 2: set .@badge,7829; set .@cost,1; break;
		case 3: set .@badge,7773; set .@cost,3; break;
	}
	.@bgchar = getBattleFlag("bg_reserved_char_id");
	.@woechar = getBattleFlag("woe_reserved_char_id");
	mes "[Telma]";
	if (countitem(.@badge) < (.@cost*.@sets)) {
		mes "You do not have enough ^FF0000"+getitemname(.@badge)+"s^000000 to buy "+(.@amt*.@sets)+" "+getitemname(.@item_id)+"s.";
	} else if (!checkweight(.@item_id, .@amt*.@sets)) {
		mes "You are overweight or have too many items in your inventory.";
	} else {
		delitem .@badge, .@cost*.@sets;
		if (.@bg_item) // Battleground's Consumables
			getitem2 .@item_id,(.@amt*.@sets),1,0,0, 254, 0, .@bgchar & 0xFFFF, .@bgchar >> 0x10;
		else
			getitem2 .@item_id,(.@amt*.@sets),1,0,0, 254, 0, .@woechar & 0xFFFF, .@woechar >> 0x10;
		mes "Here are your: ^0000FF"+(.@amt*.@sets)+" "+getitemname(.@item_id)+"s^000000!";
		mes "Remember they can only be used in "+((.@item_id)?"BattleGround":"WoE Maps");
	}
	close;
}

 

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

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

Guest
Answer this question...

×   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...