Jump to content
  • 0

Capture The Hero Bug


Ninjamon

Question


  • Group:  Members
  • Topic Count:  113
  • Topics Per Day:  0.02
  • Content Count:  295
  • Reputation:   2
  • Joined:  03/06/12
  • Last Seen:  

The Registration of CTH doesn't work well. It cannot accept 2 or more participants.

Here is the script

// ==== Registration ==== \\

// ==============================================================================
// MapFlags
// *********************************************************************

bat_room	mapflag	nomemo
bat_room	mapflag	loadevent
bat_room	mapflag	nowarpto
bat_room	mapflag	nowarp
bat_room	mapflag	nobranch
bat_room	mapflag	nopenalty
bat_room	mapflag	noteleport
bat_room	mapflag	nosave	SavePoint

// BattleGround Warper - Entrance
// *********************************************************************

prontera,172,145,3	script	Capture The Hero	403,{
//ayothaya,132,181,3	script	CTH	403,{
	mes "[CTH Recruiter]";
	if (getgmlevel() >= 99) goto cthgm;
if ($@register < 1) {
	set registeredna,0;
	mes "Registration for Capture The Heroes is closed.";
	close;
} else
if (isequipped(2199) || isequipped(1599)) goto nonono;
if (registeredna == 1) { 
	set normallook,(getlook(7));
        setlook 7, 172;
	warp "new_3-4",19,64;
	end;
}
if (registeredna == 2) {
	set normallook,(getlook(7));
	setlook 7, 362;
	warp "new_3-4",139,105;
	end;
}

if (BaseLevel < 265) goto Dipwede;
playermode:
	if (callfunc("has_char_from_same_ip", "new_3-4")) {
		next;
		mes "[CTH Recruiter]";
		mes" ";
		mes "^FF0000Dual Login in CTH is not allowed!^000000";
		close;
	} else {
	mes "The Capture The Heroes will start soon...";
	mes "I was sent here to recruit worthy warriors.";
	next;
	mes "[CTH Recruiter]";
	mes "The forces of good and evil , and are in need of experienced warriors like you. How would you like to lend your power to one of the forces in Anny and CG's Kingdom?";
	next;
	if( select("I Wanna Join:I Don't Want to Join") == 2 )
	{
		mes "[CTH Recruiter]";
		mes "I'll always be stationed here for more soldiers. Feel free to come back whenever you're interested.";
		close;
	}
	mes "[CTH Recruiter]";
	mes "I wish you luck... young warrior.";
	close2;
	goto pilina;
	end;
	}

Dipwede:
mes "[CTH Recruiter]";
mes "I'm sorry but only elite and worthy warriors are aloud to join the Capture The Heroes...";
mes "";
mes "Cry Babies aren't allowed.";
close;

nonono:
mes "I'm Sorry but you cannot join the CTH with the Hokage/Akatsuki suit on.";
close;


pilina:
if ($@register < 1) end;
if ($Team == 1) goto Teamtwo;
	set $Team,1;
	set normallook,(getlook(7));
        setlook 7, 172;
	set Bat_Team,1;
	set registeredna,1;
	warp "new_3-4",19,64;
	sleep2 3000;
	dispbottom "You joined the Warriors of the Light...";
	end;

Teamtwo:
	set $Team,2;
	set normallook,(getlook(7));
        setlook 7, 362;
	set Bat_Team,2;
	set registeredna,2;
	warp "new_3-4",139,105;
	sleep2 3000;
	dispbottom "You joined the Warriors of the Darkness...";
	end;
	
cthgm:
	if (nagstartna==1) goto cthstop;
	mes "Hello Master. Do you want to initiate Capture the Heroes manually?";
	menu "Edit Prizes",editprizes,"Player Mode",playermode,"Start Event",startevent,"Leave",canc;
	end;
	
startevent:
	set nagstartna,1;
	donpcevent "Flavius_BG2::OnCTHStart";
	close;
	
cthstop:
	mes "Hello Master, Do you want to stop Capture the Heroes?";
	menu "Edit Prizes",editprizes,"Player Mode",playermode,"Stop Event",stopevent,"Leave",canc;
	end;
	
stopevent:
	announce "Capture the Heroes has been stopped by a Game Master.",0;
	set $@FlaviusBG2, 2;
	set nagstartna,0;
	donpcevent "Flavius_BG2::OnMatchEnd";
	close;

editprizes:
	set .rewardwinner, getvariableofnpc(.rewardwinner,"Flavius_BG2");
	set .rewardwinneramount, getvariableofnpc(.rewardwinneramount,"Flavius_BG2");
	set .rewardwinnerbadge, getvariableofnpc(.rewardwinnerbadge,"Flavius_BG2");
	set .rewardwinnerbadgeamount, getvariableofnpc(.rewardwinnerbadgeamount,"Flavius_BG2");
	set .rewardloser, getvariableofnpc(.rewardloser,"Flavius_BG2");
	set .rewardloseramount, getvariableofnpc(.rewardloseramount,"Flavius_BG2");
	set .rewardjoin, getvariableofnpc(.rewardjoin,"Flavius_BG2");
	set .rewardjoinamount, getvariableofnpc(.rewardjoinamount,"Flavius_BG2");
	mes "Hello Master, What reward would you like to change?";
	next;
	switch(select("Winner Reward ^008000["+.rewardwinneramount+"x "+getitemname(.rewardwinner)+"]^000000:Winner Reward Badge ^008000["+.rewardwinnerbadgeamount+"x "+getitemname(.rewardwinnerbadge)+"]^000000:Loser Reward ^008000["+.rewardloseramount+"x "+getitemname(.rewardloser)+"]^000000:Reward of Participation ^008000["+.rewardjoinamount+"x "+getitemname(.rewardjoin)+"]^000000:MAX SCORE ^008000["+$cthmaxscore+"]^000000:Leave"))
	{
	case 1:
		next;
		mes "Please input the new Winner reward number!";
		input .@rewardwinput;
		if (getitemname(.@rewardwinput) == "null" || getitemname(.@rewardwinput) == "") {next; mes "This item doesn't exists in the database.."; next; goto editprizes; }
		set getvariableofnpc(.rewardwinner,"Flavius_BG2"), .@rewardwinput;
		next;
		mes "Please input the item amount #.";
		input .@rewardwainput;
		if(.@rewardwainput <= 0){next; mes "Please input a # greater than 0!"; next; goto editprizes; }
		set getvariableofnpc(.rewardwinneramount,"Flavius_BG2"), .@rewardwainput;
		next;
		goto editprizes;
	case 2:
		next;
		mes "Please input the new Winner reward badge number!";
		input .@rewardwbinput;
		if (getitemname(.@rewardwbinput) == "null" || getitemname(.@rewardwbinput) == "") {next; mes "This item doesn't exists in the database.."; next; goto editprizes; }
		set getvariableofnpc(.rewardwinnerbadge,"Flavius_BG2"), .@rewardwbinput;
		next;
		mes "Please input the item amount #.";
		input .@rewardwbainput;
		if(.@rewardwbainput <= 0){next; mes "Please input a # greater than 0!"; next; goto editprizes; }
		set getvariableofnpc(.rewardwinnerbadgeamount,"Flavius_BG2"), .@rewardwbainput;
		next;
		goto editprizes;
	case 3:
		next;
		mes "Please input the new Loser reward number!";
		input .@rewardlinput;
		if (getitemname(.@rewardlinput) == "null" || getitemname(.@rewardlinput) == "") {next; mes "This item doesn't exists in the database.."; next; goto editprizes; }
		set getvariableofnpc(.rewardloser,"Flavius_BG2"), .@rewardlinput;
		next;
		mes "Please input the item amount #.";
		input .@rewardlainput;
		if(.@rewardlainput <= 0){next; mes "Please input a # greater than 0!"; next; goto editprizes; }
		set getvariableofnpc(.rewardloseramount,"Flavius_BG2"), .@rewardlainput;
		next;
		goto editprizes;
	case 4:
		next;
		mes "Please input the new Reward of Participation number!";
		input .@rewardpinput;
		if (getitemname(.@rewardpinput) == "null" || getitemname(.@rewardpinput) == "") {next; mes "This item doesn't exists in the database.."; next; goto editprizes; }
		set getvariableofnpc(.rewardjoin,"Flavius_BG2"), .@rewardpinput;
		next;
		mes "Please input the item amount #.";
		input .@rewardpainput;
		if(.@rewardpainput <= 0){next; mes "Please input a # greater than 0!"; next; goto editprizes; }
		set getvariableofnpc(.rewardjoinamount,"Flavius_BG2"), .@rewardpainput;
		next;
		goto editprizes;
	case 5:
		next;
		mes "Please input the CTH Max Score.";
		input .@sinput;
		if(.@sinput <= 0){next; mes "Please input a # greater than 0!"; next; goto editprizes; }
		set $cthmaxscore, .@sinput;
		next;
		goto editprizes;
	case 6:
		close;
	}
	
canc:
	close;

}

/*
// Time calculation Function
// *********************************************************************
function	script	Time2Str	{
	set .@Time_Left, getarg(0) - gettimetick(2);
	
	set .@Days, .@Time_Left / 86400;
	set .@Time_Left, .@Time_Left - (.@Days * 86400);
	set .@Hours, .@Time_Left / 3600;
	set .@Time_Left, .@Time_Left - (.@Hours * 3600);
	set .@Minutes, .@Time_Left / 60;
	set .@Time_Left, .@Time_Left - (.@Minutes * 60);
	
	set .@Time$, "";
	if( .@Days > 1 )
		set .@Time$, .@Time$ + .@Days + " days, ";
	else if( .@Days > 0 )
		set .@Time$, .@Time$ + .@Days + " day, ";

	if( .@Hours > 1 )
		set .@Time$, .@Time$ + .@Hours + " hours, ";
	else if( .@Hours > 0 )
		set .@Time$, .@Time$ + .@Hours + " hour, ";

	if( .@Minutes > 1 )
		set .@Time$, .@Time$ + .@Minutes + " minutes, ";
	else if( .@Minutes > 0 )
		set .@Time$, .@Time$ + .@Minutes + " minute, ";

	if( .@Time_Left > 1 || .@Time_Left == 0 )
		set .@Time$, .@Time$ + .@Time_Left + " seconds.";
	else if( .@Time_Left == 1 )
		set .@Time$, .@Time$ + .@Time_Left + " second.";
	
	return .@Time$;
}
*/
-	script	Light Camp#bat	973,{ end; }
-	script	Dark Camp#bat	974,{ end; }

// === System === \\

new_3-4,19,69,5	script	Registration#Light	418,{
	end;
OnInit:
	waitingroom "Enter Arena Here",40,"Flavius_BG2::OnGuillaumeJoin",1;
	end;
OnEnterBG:
	set $@FlaviusBG2_id1, waitingroom2bg("bat_room",197,94,"Flavius_BG2::OnGuillaumeQuit","Flavius_BG2::OnPCDieEvent","Registration#Light");
	end;
}

new_3-4,139,108,5	script	Registration#Dark	414,{
	end;
OnInit:
	waitingroom "Enter Arena Here",40,"Flavius_BG2::OnCroixJoin",1;
	end;
OnEnterBG:
	set $@FlaviusBG2_id2, waitingroom2bg("bat_room",197,77,"Flavius_BG2::OnCroixQuit","Flavius_BG2::OnPCDieEvent","Registration#Dark");
	end;
}

// Battleground Engine
// *********************************************************************

-	script	Flavius_BG2	-1,{
	end;

OnCTHStop:
set nagstartna,0;
	if ($@Guillaume_Score > $@Croix_Score) goto Guillawin;
	if ($@Guillaume_Score < $@Croix_Score) goto Croixwin;
	if ($@Guillaume_Score == $@Croix_Score) goto Nowinner;
	end;

OnClock1930:
OnClock2330:
OnClock0330:
OnClock0730:
OnClock1130:
OnClock1530:
OnCTHStart:
announce "Capture The Heroes will start in 4 Minutes... Please warp to the Main Town for Registration.",0;
stopnpctimer;
	set $@Guillaume_Score, 0;
	set $@Croix_Score, 0;
	set $@FlaviusBG2_Victory, 0;
	set $@anuncioF4,0;
	set $@anuncioF3,0;
	set $@RedFlagTaken, 0;
	set $@Red_Flag_Carrier$,0;
	set $@BlueFlagTaken, 0;
	set $@Blue_Flag_Carrier$,0;
	set $@RedFlagFalse, 0;
	set $@BlueFlagFalse, 0;
	// NPC's
	
	disablenpc "Battle Reward#fl2";
	disablenpc "Therapist in Battle#1";
	disablenpc "Therapist in Battle#2";
	disablenpc "Lucifer of the Dark";
	disablenpc "Freyja of the Light";
	disablenpc "Freyja of the Light#1";
	disablenpc "Lucifer of the Dark#1";
	set $@register,1;
	set $@FlaviusBG2, 0;
	if( $@FlaviusBG2_id1 ) { bg_destroy $@FlaviusBG2_id1; set $@FlaviusBG2_id1, 0; }
	if( $@FlaviusBG2_id2 ) { bg_destroy $@FlaviusBG2_id2; set $@FlaviusBG2_id2, 0; }
	sleep 1000;
	mapwarp "bat_b02","prontera",156,180;
	mapwarp "new_2-4","prontera",156,180;
	sleep 2000;
	bg_updatescore "bat_b02",0,0;
sleep 60000;
if( $@FlaviusBG2==2 ) end;
announce "Capture The Heroes registration will close in 3 Minutes... Please warp to the Main Town for Registration.",0;
sleep 60000;
if( $@FlaviusBG2==2 ) end;
announce "Capture The Heroes registration will close in 2 Minutes... Please warp to the Main Town for Registration.",0;
sleep 60000;
if( $@FlaviusBG2==2 ) end;
announce "Capture The Heroes registration will close in 1 Minute... Please warp to the Main Town for Registration.",0;
sleep 1000;
mapannounce "new_3-4","Please get your needed items from your storage, because commands in the battlefield are disabled!",1;
sleep 1000;
mapannounce "new_3-4","You can only open your storage, in the respawn point ( when you died )!",1;
sleep 28000;
if( $@FlaviusBG2==2 ) end;
announce "Capture The Heroes registration will close in 30 Seconds... Please warp to the Main Town for Registration.",0;
sleep 20000;
if( $@FlaviusBG2==2 ) end;
announce "Registration has Ended.",0;
set $@register,0;
goto Simulan;
end;

Simulan:
	bg_updatescore "bat_b02",$@Guillaume_Score,$@Croix_Score;
sleep 2000;
if( $@FlaviusBG2==2 ) end;
		mapannounce "new_3-4","Please get inside the pubs to enter the Arena, You have 30 seconds to prepare.",1;
sleep 20000;
if( $@FlaviusBG2==2 ) end;
		mapannounce "new_3-4","10 Seconds Before Starting, Please Don't Exit the Pubs.",1;	
sleep 7000;
if( $@FlaviusBG2==2 ) end;
		mapannounce "new_3-4","3",1;
sleep 1000;
if( $@FlaviusBG2==2 ) end;
		mapannounce "new_3-4","2",1;

sleep 1000;
if( $@FlaviusBG2==2 ) end;
		mapannounce "new_3-4","1",1;
		donpcevent "Flavius_BG2::OnReadyCheck";
		end;


OnInit:
	set .rewardwinner, 7711;
	set .rewardwinneramount, 15;
	set .rewardwinnerbadge, 7828;
	set .rewardwinnerbadgeamount, 50;
	set .rewardloser, 7711;
	set .rewardloseramount, 10;
	set .rewardjoin, 7829;
	set .rewardjoinamount, 50;
	
	set $cthmaxscore, 3;
	
	setcell "bat_room",201,94,194,90,cell_landprotector,1;
	setcell "bat_room",201,81,194,74,cell_landprotector,1;
	setcell "bat_b02",333,153,326,145,cell_landprotector,1;
	setcell "bat_b02",57,145,65,155,cell_landprotector,1;
	setcell "bat_b02",304,235,319,214,cell_landprotector,1;
	setcell "bat_b02",76,85,99,64,cell_landprotector,1;
	disablenpc "Battle Reward#fl2";
	disablenpc "Therapist in Battle#1";
	disablenpc "Therapist in Battle#2";
	disablenpc "Lucifer of the Dark";
	disablenpc "Freyja of the Light";
	disablenpc "Freyja of the Light#1";
	disablenpc "Lucifer of the Dark#1";
	//set nagstartna,0;
	end;

OnPCLoginEvent:
if ($@register < 1) set registeredna,0;
end;


OnGuillaumeQuit:
OnCroixQuit:
    if ( $@Blue_Flag_Carrier$ == strcharinfo(0) || $@Red_Flag_Carrier$ == strcharinfo(0)){
	
	if( Bat_Team == 1) {
    if( $@BlueFlagTaken == 1 ){
		mapannounce "bat_b02","Lucifer of the Dark has been freed.",bc_map,0xFF0000;
		getmapxy (mapname$,.@mapx,.@mapy,0,strcharinfo(0));
		movenpc "Lucifer of the Dark#1",.@mapx,.@mapy;
		set $@BlueFlagFalse, 1;
		set $@BlueFlagTaken, 0;
		set $@Blue_Flag_Carrier$,0;
		sleep 4000;
		enablenpc "Lucifer of the Dark#1";
		end;
	}
    }
    if( Bat_Team == 2) {
	if( $@RedFlagTaken == 1 ){
		mapannounce "bat_b02","Freyja of the Light has been freed.",bc_map,0x0000FF;
		getmapxy (mapname$,.@mapx,.@mapy,0,strcharinfo(0));
		movenpc "Freyja of the Light#1",.@mapx,.@mapy;
		set $@RedFlagFalse, 1;
		set $@RedFlagTaken, 0;
		set $@Red_Flag_Carrier$,0;
		sleep 4000;
		enablenpc "Freyja of the Light#1";
		end;
	}
	}
	}
	set BG_Delay_Tick, gettimetick(2) + 1200;
	end;

OnGuillaumeJoin:
OnCroixJoin:
		if( $@FlaviusBG2 == 1 ){
	if( $@GuillC < 30 && $@CroiC < 30){
	set .@Guillaume, getwaitingroomstate(0,"Registration#Light");
	set .@Croix, getwaitingroomstate(0,"Registration#Dark");
	if (.@Guillaume!=0 && .@Croix!=0){
	set $@GuillC, ($@GuillC + 1);
	set $@CroiC, ($@CroiC + 1);
	waitingroom2bg_single($@FlaviusBG2_id1,"bat_b02",311,224,"Registration#Light");
	waitingroom2bg_single($@FlaviusBG2_id2,"bat_b02",87,75,"Registration#Dark");
	mapannounce "new_3-4","Capture The Heroes: " + $@GuillC + "/40, C: " + $@CroiC + "/40 in Progress!",1,0x610B5E;
		end;
	}
	}
	}
end;

OnReadyCheck:
	if( $@FlaviusBG2 )
		end;
	set .@Guillaume, getwaitingroomstate(0,"Registration#Light");
	set .@Croix, getwaitingroomstate(0,"Registration#Dark");


	// BG Variables
	set $@FlaviusBG2, 1;
	set $@FlaviusBG2_Victory, 0;
	set $@Guillaume_Score, 0;
	set $@Croix_Score, 0;
	bg_updatescore "bat_b02",$@Guillaume_Score,$@Croix_Score;
	set $@BlueFlagTaken, 0;
	set $@Blue_Flag_Carrier$,0;
	set $@RedFlagTaken, 0;
	set $@Red_Flag_Carrier$,0;
	set $@RedFlagFalse, 0;
	set $@BlueFlagFalse, 0;
	
	// Prepare NPC
	donpcevent "respawn1::OnBGStart";
	donpcevent "respawn2::OnBGStart";
	enablenpc "Therapist in Battle#1";
	enablenpc "Therapist in Battle#2";
	disablenpc "Battle Reward#fl2";
	// Build and Warp Teams
	donpcevent "Registration#Light::OnEnterBG";
	donpcevent "Registration#Dark::OnEnterBG";
	// Vamos contando
	set $@GuillC, 10;
	set $@CroiC, 10;
	announce "Capture The Heroes has started!",0;
	initnpctimer;
	// Start Match!!

OnRoundStart:
	if( $@FlaviusBG2 != 1 ) end;

	areapercentheal "bat_b02",382,2,397,17,100,100;
	areapercentheal "bat_b02",2,282,17,297,100,100;
	bg_warp $@FlaviusBG2_id1,"bat_b02",311,224;
	bg_warp $@FlaviusBG2_id2,"bat_b02",87,75;
	sleep 2000;
	movenpc "Lucifer of the Dark",62,149;
	movenpc "Freyja of the Light",328,150;
	movenpc "Freyja of the Light#1",391,14;
	movenpc "Lucifer of the Dark#1",391,15;
	enablenpc "Lucifer of the Dark";
	enablenpc "Freyja of the Light";
	if( $@FlaviusBG2 != 1 ) end;
	announce "The Capture The Heroes has begun!!",0;
	sleep 5000;
if( $@FlaviusBG2==2 ) end;
	mapannounce "bat_b02","Capture the Enemy's Heroes and bring it to your Hero to score points.",0;
	sleep 3000;
if( $@FlaviusBG2==2 ) end;
	mapannounce "bat_b02","The First Team to score "+$cthmaxscore+" Points wins!!!.",0;
	sleep 3000;
	mapannounce "bat_b02","You only have 10 minutes to win the battle!",0;
	sleep 3000;
	mapannounce "bat_b02","After 10 minutes, if no one wins the battle, both teams will receive same prize!",0;
	sleep 297000;
	mapannounce "bat_b02","5 minutes left before the game ends!",0;
	sleep 180000;
	mapannounce "bat_b02","2 minutes left before the game ends!",0;
	sleep 60000;
	mapannounce "bat_b02","1 minute left before the game ends!",0;
	sleep 55000;
	mapannounce "bat_b02","5",0;
	sleep 1000;
	mapannounce "bat_b02","4",0;
	sleep 1000;
	mapannounce "bat_b02","3",0;
	sleep 1000;
	mapannounce "bat_b02","2",0;
	sleep 1000;
	mapannounce "bat_b02","1",0;
	sleep 1000;
	if( $@FlaviusBG2==2 ) end;
	donpcevent "Flavius_BG2::OnMatchEnd";
	end;


OnPCDieEvent:
    if ( $@Blue_Flag_Carrier$ == strcharinfo(0) || $@Red_Flag_Carrier$ == strcharinfo(0)){

	if( Bat_Team == 1) {
    if( $@BlueFlagTaken == 1 ){
		mapannounce "bat_b02", "Lucifer of the Dark has been freed!!!",bc_map,0xFF0000;
		getmapxy (mapname$,.@mapx,.@mapy,0,strcharinfo(0));
		movenpc "Lucifer of the Dark#1",.@mapx,.@mapy;
		set $@BlueFlagFalse, 1;
		set $@BlueFlagTaken, 0;
		set $@Blue_Flag_Carrier$,0;
		sleep 2000;
		enablenpc "Lucifer of the Dark#1";
		sleep 10000;
		if ($@nahawakanluci == 0){
		movenpc "Lucifer of the Dark#1",155,119;
		set $@nahawakanluci,0;
		end;
		}
		
		end;
	}
    }
    if( Bat_Team == 2) {
	if( $@RedFlagTaken == 1 ){
		mapannounce "bat_b02", "Freyja of the Light has been freed!!!",bc_map,0x0000FF;
		getmapxy (mapname$,.@mapx,.@mapy,0,strcharinfo(0));
		movenpc "Freyja of the Light#1",.@mapx,.@mapy;
		set $@RedFlagFalse, 1;
		set $@RedFlagTaken, 0;
		set $@Red_Flag_Carrier$,0;
		sleep 2000;
		enablenpc "Freyja of the Light#1";
		sleep 10000;
		if ($@nahawakanfreya == 0){
		movenpc "Freyja of the Light#1",243,182;
		set $@nahawakanfreya,0;
		end;
		}
	}
	}
	}
	end;


	
OnMatchEnd:
	set $@FlaviusBG2, 2;
	stopnpctimer;
	movenpc "Freyja of the Light",391,15;
	movenpc "Lucifer of the Dark",391,14;
	movenpc "Freyja of the Light#1",392,15;
	movenpc "Lucifer of the Dark#1",392,14;
	disablenpc "Lucifer of the Dark";
	disablenpc "Freyja of the Light";
	disablenpc "Freyja of the Light#1";
	disablenpc "Lucifer of the Dark#1";	
	donpcevent "respawn1::OnBGStop";
	donpcevent "respawn2::OnBGStop";
	disablenpc "Therapist in Battle#1";
	disablenpc "Therapist in Battle#2";
	enablenpc "Battle Reward#fl2";
	sleep 5000;
	mapwarp "bat_b02","new_2-4",51,191;
	sleep 5000;
	mapwarp "bat_room","new_2-4",51,191;
	sleep 3000;
	mapannounce "new_2-4","Capture The Heroes will close in 1 minute!",1,0x610B5E;
	initnpctimer;
	end;

OnTimer30000:
	if( $@FlaviusBG2 == 2 )
		mapannounce "new_2-4","Capture The Heroes will close in 30 seconds!",1,0x610B5E;
	end;
OnTimer50000:
	if( $@FlaviusBG2 == 2 )
		mapannounce "new_2-4","Capture The Heroes will close in 10 seconds!",1,0x610B5E;
	end;

OnTimer60000:
	if( $@FlaviusBG2 != 2 )
		end;
OnReset:
	stopnpctimer;
	set $@Guillaume_Score, 0;
	set $@Croix_Score, 0;
	set $@anuncioF4,0;
	set $@anuncioF3,0;
	set $@RedFlagTaken, 0;
	set $@Red_Flag_Carrier$,0;
	set $@BlueFlagTaken, 0;
	set $@Blue_Flag_Carrier$,0;
	set $@RedFlagFalse, 0;
	set $@BlueFlagFalse, 0;
	// NPC's
	disablenpc "Battle Reward#fl2";
	disablenpc "Therapist in Battle#1";
	disablenpc "Therapist in Battle#2";
	disablenpc "Lucifer of the Dark";
	disablenpc "Freyja of the Light";
	disablenpc "Freyja of the Light#1";
	disablenpc "Lucifer of the Dark#1";
	if( $@FlaviusBG2_id1 ) { bg_destroy $@FlaviusBG2_id1; set $@FlaviusBG2_id1, 0; }
	if( $@FlaviusBG2_id2 ) { bg_destroy $@FlaviusBG2_id2; set $@FlaviusBG2_id2, 0; }
	sleep 1000;
	mapwarp "bat_room","new_2-4",51,191;
	sleep 1000;
	mapwarp "bat_b02","new_2-4",51,191;
	sleep 2000;
	bg_updatescore "bat_b02",0,0;
	set $@FlaviusBG2, 0;
	end;


Guillawin:
		announce "The Warriors of the Light has won the Capture The Heroes!",0;
		set $@FlaviusBG2_Victory, 1;
		donpcevent "Flavius_BG2::OnMatchEnd";
		end;

Croixwin:
		announce "The Warriors of the Dark has won the Capture The Heroes!",0;
		set $@FlaviusBG2_Victory, 2;
		donpcevent "Flavius_BG2::OnMatchEnd";
		end;

Nowinner:
		announce "The Capture The Heroes has ended. There are no victors!",0;
		set $@FlaviusBG2_Victory, 3;
		donpcevent "Flavius_BG2::OnMatchEnd";
		end;

}

// Banderas estaticas :3

bat_b02,328,150,5	script	Freyja of the Light	1751,1,1,{
end;
OnTouch:
	if( Bat_Team == 2 ){
	set @hp, (Hp * 100 / MaxHp);
	//if (@hp < 50) goto notenafhp;
	set $@RedFlagTaken, 1;
	set $@Red_Flag_Carrier$,strcharinfo(0);
	mapannounce "bat_b02", "[ "+$@Red_Flag_Carrier$+" ] kidnapped Freyja of the Light",bc_map,0xFF0000;
	disablenpc "Freyja of the Light";
	movenpc "Freyja of the Light",391,15;
    callsub OnRedFlagCarrier;
  	end;

notenafhp:
announce "You cannot kidnap the Hero. Your HP is below 50%, Please Make sure that your HP is above 50% to successfully kidnap the Hero.",3;
end;
	}

	if( $@BlueFlagTaken == 1 && $@Blue_Flag_Carrier$ == strcharinfo(0) ){ 
	mapannounce "bat_b02", "[ "+$@Blue_Flag_Carrier$+" ] successfully devoured Lucifer of the Dark",bc_map,0x0000FF;
	set @banderas,@banderas + 1;
	set $@BlueFlagTaken, 0;
	set $@Blue_Flag_Carrier$,0;
	if( set($@Guillaume_Score, $@Guillaume_Score + 1) < $cthmaxscore )
	{
	bg_updatescore "bat_b02",$@Guillaume_Score,$@Croix_Score;

	disablenpc "Lucifer of the Dark";
	disablenpc "Freyja of the Light";
	disablenpc "Freyja of the Light#1";
	disablenpc "Lucifer of the Dark#1";
	movenpc "Lucifer of the Dark",62,149;
	movenpc "Freyja of the Light",328,150;
	movenpc "Freyja of the Light#1",391,14;
	movenpc "Lucifer of the Dark#1",391,15;
	sleep 5000;
	mapannounce "bat_b02","The Heroes have been set to their Bases!!",bc_map,0xFFFF00;
    enablenpc "Lucifer of the Dark";
	enablenpc "Freyja of the Light";		
	}
	else
	{
		bg_updatescore "bat_b02",$@Guillaume_Score,$@Croix_Score;
		mapannounce "bat_b02","The Warriors of the Light has won the Capture The Heroes!",1,0x0000FF;
		set $@FlaviusBG2_Victory, 1;
		donpcevent "Flavius_BG2::OnMatchEnd";
	}
	}
	end;
	
OnRedFlagCarrier:
if($@RedFlagTaken == 1) {
    if($@Red_Flag_Carrier$ == strcharinfo(0)) {
	
        sc_end SC_CLOAKING;
        sc_end SC_CHASEWALK;
        sc_end SC_HIDING;
	sc_start 297,2000,1;
        sc_start SC_ROKISWEIL,1200000,1;
        emotion e_hlp,1;
        percentheal -7,0;
        specialeffect2 58;
        sleep2 2000;
        goto OnRedFlagCarrier;}}
sc_end 297; 
sc_end SC_ROKISWEIL;       
end;
}
	

bat_b02,62,149,5	script	Lucifer of the Dark	1916,1,1,{
end;
OnTouch:
	if( Bat_Team == 1 ){ 
	set @hp2, (Hp * 100 / MaxHp);
	//if (@hp2 < 50) goto notenafhp2;
	set $@BlueFlagTaken, 1;
	set $@Blue_Flag_Carrier$,strcharinfo(0);
	mapannounce "bat_b02", "[ "+$@Blue_Flag_Carrier$+" ] kidnapped Lucifer of the Dark",bc_map,0x0000FF;
	disablenpc "Lucifer of the Dark";
	movenpc "Lucifer of the Dark",391,14;
	callsub OnBlueFlagCarrier;
	end;

notenafhp2:
announce "You cannot kidnap the Hero. Your HP is below 50%, Please Make sure that your HP is above 50% to successfully kidnap the Hero.",3;
end;
	}

	if( $@RedFlagTaken == 1 && $@Red_Flag_Carrier$ == strcharinfo(0) ){ 
	mapannounce "bat_b02", "[ "+$@Red_Flag_Carrier$+" ] successfully  devoured Freyja of the Light",bc_map,0xFF0000;
	set @banderas,@banderas + 1;
	set $@RedFlagTaken, 0;
	set $@Red_Flag_Carrier$,0;
	if( set($@Croix_Score, $@Croix_Score + 1) < $cthmaxscore )
	{
	bg_updatescore "bat_b02",$@Guillaume_Score,$@Croix_Score;
	
	disablenpc "Lucifer of the Dark";
	disablenpc "Freyja of the Light";
	disablenpc "Freyja of the Light#1";
	disablenpc "Lucifer of the Dark#1";
	movenpc "Lucifer of the Dark",62,149;
	movenpc "Freyja of the Light",328,150;
	movenpc "Freyja of the Light#1",391,14;
	movenpc "Lucifer of the Dark#1",391,15;
	sleep 5000;
    mapannounce "bat_b02","The Heroes have been set to their Bases!!",bc_map,0xFFFF00;
    enablenpc "Lucifer of the Dark";
	enablenpc "Freyja of the Light";		
	}
	else
	{
		bg_updatescore "bat_b02",$@Guillaume_Score,$@Croix_Score;
		mapannounce "bat_b02","The Warriors of the Dark has won the Capture The Heroes!",1,0xFF0000;
		set $@FlaviusBG2_Victory, 2;
		donpcevent "Flavius_BG2::OnMatchEnd";
	}
	}
	end;
	
OnBlueFlagCarrier:
if($@BlueFlagTaken == 1) {
    if($@Blue_Flag_Carrier$ == strcharinfo(0)) {
	
        sc_end SC_CLOAKING;
        sc_end SC_CHASEWALK;
        sc_end SC_HIDING;
	sc_start 297,2000,1;
        sc_start SC_ROKISWEIL,1200000,1;
        emotion e_hlp,1;
        percentheal -7,0;
        specialeffect2 58;
        sleep2 2000;
        goto OnBlueFlagCarrier;}}
sc_end 297;
sc_end SC_ROKISWEIL;     
end;

}

//Banderas que dropean al morir, y se mueven :3!
bat_b02,390,13,5	script	Lucifer of the Dark#1	1916,1,1,{
end;
OnTouch:
	if( Bat_Team == 1 ){
		set $@nahawakanluci,1;
		set $@BlueFlagFalse, 0;
		set $@BlueFlagTaken, 1;
		set $@Blue_Flag_Carrier$,strcharinfo(0);
		mapannounce "bat_b02","[ "+$@Blue_Flag_Carrier$+" ] kidnapped Lucifer of the Dark!!!",bc_map,0xFF0000;
		disablenpc "Lucifer of the Dark#1";
		movenpc "Lucifer of the Dark#1",390,13;
		callsub OnBlueFlagCarrier;
		end;
	}
	if( Bat_Team == 2 ){
	    set $@Blue_Returned$,strcharinfo(0);
		mapannounce "bat_b02","[ "+$@Blue_Returned$+" ] rescued Lucifer of the Dark...",bc_map,0xFF0000;
		set $@nahawakanluci,1;
		set $@Blue_Returned$,0;
		set $@BlueFlagFalse, 0;
		disablenpc "Lucifer of the Dark#1";
		movenpc "Lucifer of the Dark#1",390,13;
		movenpc "Lucifer of the Dark",62,149;
		enablenpc "Lucifer of the Dark";		
		end;
	}
end;

OnBlueFlagCarrier:
if($@BlueFlagTaken == 1) {
    if($@Blue_Flag_Carrier$ == strcharinfo(0)) {
        sc_end SC_CLOAKING;
        sc_end SC_CHASEWALK;
        sc_end SC_HIDING;
	sc_start 297,2000,1;
        sc_start SC_ROKISWEIL,1200000,1;
        emotion e_hlp,1;
        percentheal -7,0;
        specialeffect2 58;
        sleep2 2000;
        goto OnBlueFlagCarrier;}}
sc_end 297; 
sc_end SC_ROKISWEIL;        
end;
}

bat_b02,390,14,5	script	Freyja of the Light#1	1751,1,1,{
end;
OnTouch:
	if( Bat_Team == 2 ){
		set $@nahawakanfreya,1;
	   	set $@RedFlagFalse, 0;
		set $@RedFlagTaken, 1;
		set $@Red_Flag_Carrier$,strcharinfo(0);
		mapannounce "bat_b02", "[ "+$@Red_Flag_Carrier$+" ] kidnapped Freyja of the Light!!!",bc_map,0x0000FF;
		disablenpc "Freyja of the Light#1";
		movenpc "Freyja of the Light#1",390,13;
		callsub OnRedFlagCarrier;
		end;
	}
	if( Bat_Team == 1 ){
	    set $@Red_Returned$,strcharinfo(0);
		mapannounce "bat_b02","[ "+$@Red_Returned$+" ] rescued Freyja of the Light...",bc_map,0x0000FF;
		set $@nahawakanfreya,1;
		set $@Red_Returned$,0;
		set $@RedFlagFalse, 0;
		disablenpc "Freyja of the Light#1";
		movenpc "Freyja of the Light#1",390,14;
		movenpc "Freyja of the Light",328,150;
		enablenpc "Freyja of the Light";
		end;
	}
end;

OnRedFlagCarrier:
if($@RedFlagTaken == 1) {
    if($@Red_Flag_Carrier$ == strcharinfo(0)) {
        sc_end SC_CLOAKING;
        sc_end SC_CHASEWALK;
        sc_end SC_HIDING;
	sc_start 297,2000,1;
        sc_start SC_ROKISWEIL,1200000,1;
        emotion e_hlp,1;
        percentheal -7,0;
        specialeffect2 58;
        sleep2 2000;
        goto OnRedFlagCarrier;}}
sc_end 297; 
sc_end SC_ROKISWEIL;    
end;
}

// Map View de las banderas.

-	script	viewmapred	-,{
end;
OnPCLoadMapEvent:
OnViewRed:
    getmapxy .@MAPNAME$,@x,@y,0,strcharinfo(0);
    if(.@MAPNAME$ == "bat_b02") {

    if($@FlaviusBG2 == 2) {
    viewpoint 2,.yE,.yE,1,0x0000ff;
    end;}
    if($@FlaviusBG2 == 1) {
    
    if ($@RedFlagFalse == 1) {
    getmapxy(.mapES$, .xE, .yE,1,"Freyja of the Light#1");
    viewpoint 1,.xE,.yE,1,0x0000ff;
	sleep2 1000;
	goto OnViewRed;      
    }
    if ($@RedFlagTaken == 1) {
    getmapxy(.mapES$, .xE, .yE,0,$@Red_Flag_Carrier$);
    viewpoint 1,.xE,.yE,1,0x0000ff;
	sleep2 1000;
	goto OnViewRed;
    }
    } 
	getmapxy(.mapES$, .xE, .yE,1,"Freyja of the Light");
	viewpoint 1,.xE,.yE,1,0x0000ff;
	sleep2 1000;
	goto OnViewRed;

}
end;
}

/*-	script	IfAfkInBattleField	-1,{

OnPCLoadMapEvent:

	//while ( !getmapxy ( .@afkmap$, .@afkx, .@afky, 0) && .@afkmap$ == "bat_b02" ) {
	while( ! getmapxy(.@afkmap$,.@afkx,.@afky,0) && .@afkmap$ == "bat_b02"){
        if ( .@afkx == .@afkmapx && .@afky == .@afkmapy ) {
            if( .@afkcountifidle < 60 ){
                set .@afkcountifidle,.@afkcountifidle+10;
                if(.@afkcountifidle==(60-10)){ dispbottom "You have 10 seconds to move or you will be tagged as AFK"; }
            } else {
                dispbottom "You've been kicked for being afk.";
				set registeredna,0;
				setlook 7,normallook;
                warp "SavePoint",0,0;
                break;
            }
        } else {
            set .@afkmapx,.@afkx;
            set .@afkmapy,.@afky;
            set .@afkcountifidle,0;
        }
        sleep2 10000;
    }
}*/

/*-	script	IfAfkInRespawn	-1,{

OnPCLoadMapEvent:

	while( ! getmapxy(.@afkmap2$,.@afkx2,.@afky2,0) && .@afkmap2$ == "bat_room"){
        if ( .@afkx2 == .@afkmapx2 && .@afky2 == .@afkmapy2 ) {
            if( .@afkcountifidle2 < 60 ){
                set .@afkcountifidle2,.@afkcountifidle2+10;
                if(.@afkcountifidle2==(60-10)){ dispbottom "You have 10 seconds to move or you will be tagged as AFK"; }
            } else {
                dispbottom "You've been kicked for being afk.";
				set registeredna,0;
				setlook 7,normallook;
                warp "SavePoint",0,0;
                break;
            }
        } else {
            set .@afkmapx2,.@afkx2;
            set .@afkmapy2,.@afky2;
            set .@afkcountifidle2,0;
        }
        sleep2 10000;
    }
}*/



-	script	Logout_CTH	-1,{

OnPCLogoutEvent:
	set registeredna,0;	
	end;
}

function	script	has_char_from_same_ip	{
	set .@my_map$, getarg(0);
	// get array of char names who are online from the same IP
	query_sql "SELECT `char`.`name` FROM `char` LEFT JOIN login ON `char`.account_id=login.account_id " + 
			  "WHERE last_ip=(SELECT last_ip FROM login WHERE account_id="+playerattached()+") AND online AND `char`.account_id!=" + playerattached(), .@name$;
	// check each char, and see if they are on the map
	for (set .@i,0; .@i < getarraysize(.@name$); set .@i,.@i+1) {
		getmapxy .@map$, .@x, .@y, 0, .@name$[.@i];
		if (.@map$ == .@my_map$)
			return 1; // another char from this IP is already on map
	}
	return 0; // no other chars from this IP are on that map
}

-	script	viewmapblue	-,{
end;
OnPCLoadMapEvent:
OnViewBlue:
    getmapxy .@MAPNAME$,@x,@y,0,strcharinfo(0);
    if(.@MAPNAME$ == "bat_b02") {
    if($@FlaviusBG2 == 2) {
    viewpoint 2,.yEE,.yEE,2,0xff0000;
    end;}
    if($@FlaviusBG2 == 1) {
    
    if ($@BlueFlagFalse == 1) {
    getmapxy(.mapEES$, .xEE, .yEE,1,"Lucifer of the Dark#1");
    viewpoint 1,.xEE,.yEE,2,0xff0000;
	sleep2 1000;
	goto OnViewBlue;      
    }
    if ($@BlueFlagTaken == 1) {
    getmapxy(.mapEES$, .xEE, .yEE,0,$@Blue_Flag_Carrier$);
    viewpoint 1,.xEE,.yEE,2,0xff0000;
	sleep2 1000;
	goto OnViewBlue;
    }
    } 
	getmapxy(.mapEES$, .xEE, .yEE,1,"Lucifer of the Dark");
	viewpoint 1,.xEE,.yEE,2,0xff0000;
	sleep2 1000;
	goto OnViewBlue;

}
end;
}



// Battleground rewards
// *********************************************************************

new_2-4,51,191,5	script	Battle Reward#fl2	851,{
		if( $@FlaviusBG2_Victory == Bat_Team )
		{ // Victory
			set registeredna,0;
			setlook 7,normallook;
			mes "[Swandery]";
			mes "Blessed Warrior";
			mes "Let's enjoy our glorious victory!";
			mes "" + strcharinfo(0) + ", its a sign reflecting victory";			
			set .rewardwinner, getvariableofnpc(.rewardwinner,"Flavius_BG2");
			set .rewardwinneramount, getvariableofnpc(.rewardwinneramount,"Flavius_BG2");
			set .rewardwinnerbadge, getvariableofnpc(.rewardwinnerbadge,"Flavius_BG2");
			set .rewardwinnerbadgeamount, getvariableofnpc(.rewardwinnerbadgeamount,"Flavius_BG2");
			getitem .rewardwinner,.rewardwinneramount;
			getitem .rewardwinnerbadge,.rewardwinnerbadgeamount;
			set .rewardjoin, getvariableofnpc(.rewardjoin,"Flavius_BG2");
			set .rewardjoinamount, getvariableofnpc(.rewardjoinamount,"Flavius_BG2");
			getitem .rewardjoin,.rewardjoinamount;
			dispbottom "You've earned another "+.rewardjoinamount+" "+getitemname(.rewardjoin)+" for playing Capture the Heroes!";
			warp "dewata",200,180;
			end;
		}
		else
		{ // Derrota
			set registeredna,0;
			setlook 7,normallook;
			mes "[Swandery]";
			mes "You lost, but you're dedicated to this battle.";
			mes "This is a reward for your great dedication!";
			mes "Just take this defeat a lesson, and later you would definitely learn.";
			set .rewardloser, getvariableofnpc(.rewardloser,"Flavius_BG2");
			set .rewardloseramount, getvariableofnpc(.rewardloseramount,"Flavius_BG2");
			getitem .rewardloser,.rewardloseramount;
			set .rewardjoin, getvariableofnpc(.rewardjoin,"Flavius_BG2");
			set .rewardjoinamount, getvariableofnpc(.rewardjoinamount,"Flavius_BG2");
			getitem .rewardjoin,.rewardjoinamount;
			dispbottom "You've earned "+.rewardjoinamount+" "+getitemname(.rewardjoin)+" for playing Capture the Heroes!"; 
			warp "dewata",200,180;
			end;
		}

		//set Flavius2_BG_Tick, gettimetick(2) + 300;
		//getitem 7829, 2;
		//if(.@rewardb != 0) {
		//set .rewardjoin, getvariableofnpc(.rewardjoin,"Flavius_BG2");
		//set .rewardjoinamount, getvariableofnpc(.rewardjoinamount,"Flavius_BG2");
       	//getitem .rewardjoin,.rewardjoinamount;
       	//dispbottom "You've earned "+.rewardjoinamount+" "+getitemname(.rewardjoin)+" for playing Capture the Heroes!"; 
		setlook 7,normallook;
		set registeredna,0;
		bg_leave;
		warp "prontera",156,180;
		end;
}



// Battleground Therapist
// *********************************************************************

bat_room,197,97,5	script	Therapist in Battle#1	95,{
	mes "[Therapist in Battle]";
	mes "Just close your eyes, and take a deep breathe.";
	mes "You can be free from pain.";
	percentheal 100,100;
	repair(1);
	sc_start SC_MAGNIFICAT,300000,5;
	switch ( BaseJob ) {
		case Job_Alchemist:				set .@spirit, 445; break;
		case Job_Monk:					set .@spirit, 447; break;
		case Job_Star_Gladiator:		set .@spirit, 448; break;
		case Job_Sage:					set .@spirit, 449; break;
		case Job_Crusader:				set .@spirit, 450; break;
		case Job_SuperNovice:			set .@spirit, 451; break;
		case Job_Knight:				set .@spirit, 452; break;
		case Job_Wizard:				set .@spirit, 453; break;
		case Job_Priest:				set .@spirit, 454; break;
		case Job_Bard: case Job_Dancer:	set .@spirit, 455; break;
		case Job_Rogue:					set .@spirit, 456; break;
		case Job_Assassin:				set .@spirit, 457; break;
		case Job_Blacksmith:			set .@spirit, 458; break;
		case Job_Hunter:				set .@spirit, 460; break;
		case Job_Soul_Linker:			set .@spirit, 461; break;
		default:
			if ( Upper == 1 && BaseLevel < 70 )
				set .@spirit, 494;
	}
	if ( .@spirit ) {
		sc_start4 sc_spirit, .@time, 5, .@spirit,0,0;
		skilleffect .@spirit, 5;
	}

	close2;
	warp "bat_b02",311,224;
}

bat_room,197,74,1	script	Therapist in Battle#2	95,{
	mes "[Therapist in Battle]";
	mes "Just close your eyes, and take a deep breathe.";
	mes "You can be free from pain.";
	percentheal 100,100;
	repair(1);
	sc_start SC_MAGNIFICAT,300000,5;
	switch ( BaseJob ) {
		case Job_Alchemist:				set .@spirit, 445; break;
		case Job_Monk:					set .@spirit, 447; break;
		case Job_Star_Gladiator:		set .@spirit, 448; break;
		case Job_Sage:					set .@spirit, 449; break;
		case Job_Crusader:				set .@spirit, 450; break;
		case Job_SuperNovice:			set .@spirit, 451; break;
		case Job_Knight:				set .@spirit, 452; break;
		case Job_Wizard:				set .@spirit, 453; break;
		case Job_Priest:				set .@spirit, 454; break;
		case Job_Bard: case Job_Dancer:	set .@spirit, 455; break;
		case Job_Rogue:					set .@spirit, 456; break;
		case Job_Assassin:				set .@spirit, 457; break;
		case Job_Blacksmith:			set .@spirit, 458; break;
		case Job_Hunter:				set .@spirit, 460; break;
		case Job_Soul_Linker:			set .@spirit, 461; break;
		default:
			if ( Upper == 1 && BaseLevel < 70 )
				set .@spirit, 494;
	}
	if ( .@spirit ) {
		sc_start4 sc_spirit, .@time, 5, .@spirit,0,0;
		skilleffect .@spirit, 5;
	}

	close2;
	warp "bat_b02",87,75;
}

// Battleground Respawn
// *********************************************************************

/*function	script	respawn1f	{

	sleep 5000;
	areapercentheal "bat_room",201,90,194,97,100,100;
	areawarp "bat_room",201,90,194,97,"bat_b02",311,224;
	end;
}

function	script	respawn2f	{

	sleep 5000;
	areapercentheal "bat_room",201,74,194,81,100,100;
	areawarp "bat_room",201,74,194,81,"bat_b02",87,75;
	end;
}wew*/
	

//bat_room,197,97,0	script	respawn1	-1,13,13,{
bat_room,197,97,0	script	respawn1	104,{
	end;

OnBGStop:
	stopnpctimer;
	end;
	
OnBGStart:
	initnpctimer;
	end;

OnTimer5000:
	misceffect 83;
	end;

OnTimer10000:
	areapercentheal "bat_room",201,90,194,97,100,100;
	areawarp "bat_room",201,90,194,97,"bat_b02",311,224;
	initnpctimer;
	end;
}

//bat_room,197,74,0	script	respawn2	-1,13,13,{
bat_room,197,74,0	script	respawn2	104,{
	end;

OnBGStop:
	stopnpctimer;
	end;
	
OnBGStart:
	initnpctimer;
	end;

OnTimer5000:
	misceffect 83;
	end;

OnTimer10000:
	areapercentheal "bat_room",201,74,194,81,100,100;
	areawarp "bat_room",201,74,194,81,"bat_b02",87,75;
	initnpctimer;
	end;
}

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

bat_b02,304,231,1	duplicate(Light Camp#bat)	Light Camp#bat32	973
bat_b02,319,231,1	duplicate(Light Camp#bat)	Light Camp#bat33	973
bat_b02,304,218,1	duplicate(Light Camp#bat)	Light Camp#bat34	973
bat_b02,319,218,1	duplicate(Light Camp#bat)	Light Camp#bat35	973
bat_b02,304,231,1	duplicate(Light Camp#bat)	Light Camp#bat36	973
bat_b02,304,231,1	duplicate(Light Camp#bat)	Light Camp#bat37	973
bat_b02,335,142,1	duplicate(Light Camp#bat)	Light Camp#bat38	973
bat_b02,335,157,1	duplicate(Light Camp#bat)	Light Camp#bat39	973
bat_b02,390,16,1	duplicate(Light Camp#bat)	Light Camp#bat40	973
bat_b02,292,163,1	duplicate(Light Camp#bat)	Light Camp#bat41	973
bat_b02,292,136,1	duplicate(Light Camp#bat)	Light Camp#bat42	973
bat_b02,241,185,1	duplicate(Light Camp#bat)	Light Camp#bat43	973
bat_b02,247,179,1	duplicate(Light Camp#bat)	Light Camp#bat44	973

bat_b02,96,81,1	duplicate(Dark Camp#bat)	Dark Camp#bat30	974
bat_b02,96,68,1	duplicate(Dark Camp#bat)	Dark Camp#bat31	974
bat_b02,79,81,1	duplicate(Dark Camp#bat)	Dark Camp#bat32	974
bat_b02,79,68,1	duplicate(Dark Camp#bat)	Dark Camp#bat33	974
bat_b02,96,81,1	duplicate(Dark Camp#bat)	Dark Camp#bat34	974
bat_b02,96,81,1	duplicate(Dark Camp#bat)	Dark Camp#bat35	974
bat_b02,59,164,1	duplicate(Dark Camp#bat)	Dark Camp#bat36	974
bat_b02,59,137,1	duplicate(Dark Camp#bat)	Dark Camp#bat37	974
bat_b02,10,296,1	duplicate(Dark Camp#bat)	Dark Camp#bat38	974
bat_b02,110,162,1	duplicate(Dark Camp#bat)	Dark Camp#bat39	974
bat_b02,110,137,1	duplicate(Dark Camp#bat)	Dark Camp#bat40	974
bat_b02,152,120,1	duplicate(Dark Camp#bat)	Dark Camp#bat41	974
bat_b02,158,114,1	duplicate(Dark Camp#bat)	Dark Camp#bat42	974


bat_b02,87,81,3	script	Healer#boa1	81,{
if (Bat_Team == 1) end;
if ( $@Blue_Flag_Carrier$ == strcharinfo(0) || $@Red_Flag_Carrier$ == strcharinfo(0)) end;
percentheal 100,100;
	repair(1);
	sc_start SC_BLESSING,300000,10;
	sc_start SC_INCREASEAGI,300000,10;
	sc_start SC_MAGNIFICAT,300000,5;

	switch ( BaseJob ) {
		case Job_Alchemist:				set .@spirit, 445; break;
		case Job_Monk:					set .@spirit, 447; break;
		case Job_Star_Gladiator:		set .@spirit, 448; break;
		case Job_Sage:					set .@spirit, 449; break;
		case Job_Crusader:				set .@spirit, 450; break;
		case Job_SuperNovice:			set .@spirit, 451; break;
		case Job_Knight:				set .@spirit, 452; break;
		case Job_Wizard:				set .@spirit, 453; break;
		case Job_Priest:				set .@spirit, 454; break;
		case Job_Bard: case Job_Dancer:	set .@spirit, 455; break;
		case Job_Rogue:					set .@spirit, 456; break;
		case Job_Assassin:				set .@spirit, 457; break;
		case Job_Blacksmith:			set .@spirit, 458; break;
		case Job_Hunter:				set .@spirit, 460; break;
		case Job_Soul_Linker:			set .@spirit, 461; break;
		default:
			if ( Upper == 1 && BaseLevel < 70 )
				set .@spirit, 494;
	}
	if ( .@spirit ) {
		sc_start4 sc_spirit, .@time, 5, .@spirit,0,0;
		skilleffect .@spirit, 5;
	}
	close;
}

bat_b02,313,231,3	script	Healer#boa2	81,{
if (Bat_Team == 2) end;
if ( $@Blue_Flag_Carrier$ == strcharinfo(0) || $@Red_Flag_Carrier$ == strcharinfo(0)) end;
	percentheal 100,100;
	repair(1);
	sc_start SC_BLESSING,300000,10;
	sc_start SC_INCREASEAGI,300000,10;
	sc_start SC_MAGNIFICAT,300000,5;

	switch ( BaseJob ) {
		case Job_Alchemist:				set .@spirit, 445; break;
		case Job_Monk:					set .@spirit, 447; break;
		case Job_Star_Gladiator:		set .@spirit, 448; break;
		case Job_Sage:					set .@spirit, 449; break;
		case Job_Crusader:				set .@spirit, 450; break;
		case Job_SuperNovice:			set .@spirit, 451; break;
		case Job_Knight:				set .@spirit, 452; break;
		case Job_Wizard:				set .@spirit, 453; break;
		case Job_Priest:				set .@spirit, 454; break;
		case Job_Bard: case Job_Dancer:	set .@spirit, 455; break;
		case Job_Rogue:					set .@spirit, 456; break;
		case Job_Assassin:				set .@spirit, 457; break;
		case Job_Blacksmith:			set .@spirit, 458; break;
		case Job_Hunter:				set .@spirit, 460; break;
		case Job_Soul_Linker:			set .@spirit, 461; break;
		default:
			if ( Upper == 1 && BaseLevel < 70 )
				set .@spirit, 494;
	}
	if ( .@spirit ) {
		sc_start4 sc_spirit, .@time, 5, .@spirit,0,0;
		skilleffect .@spirit, 5;
	}

	close;


}
Link to comment
Share on other sites

1 answer to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

I successfully start the event though o.o

login all my 4 clients

post-8685-0-64184800-1390149165_thumb.jpg

however this script ... missing battleground mapflag, or pvp mapflag

I didn't see a single getcharid(4) inside this script ...

then ... this script uses bat_team player variable to differentiate their teams ?

means, how the hell player kill each other ?

I got a hunch this script Must have source modification on battle.c...

seriously, if players already register as a battleground team,

players couldn't able to kill each other with same battleground ID ...

no need to do source modification anymore

anyways the lines that I comment to make this work is line 42

//if (BaseLevel < 265) goto Dipwede;
line 44~50

//	if (callfunc("has_char_from_same_ip", "new_3-4")) {
//		next;
//		mes "[CTH Recruiter]";
//		mes" ";
//		mes "^FF0000Dual Login in CTH is not allowed!^000000";
//		close;
//	} else {
line 68

//	}
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
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...