Can Anyone take a look of this, is there a way for this to be, Auto Team Balance upon Joining BG?.. or in Registration?..
Here's the script.. Originally from eAthena and seem to work on Hercules..
Original Script..
http://www.eathena.w...howtopic=255789
My Current Script, this is on Team Deathmatch Battleground..
// ==============================================================================// BattleGround System - Flavius TD - Flavius Team Deathmatch// ==============================================================================// By Suke / s4zuk3// ==============================================================================// Registration NPC's// *********************************************************************jupe_ele,39,57,4 script Registration::Fl1R_Guillaume 418,{ end;OnInit: waitingroom "Team Battle",4,"Flavius_BG1::OnGuillaumeJoin",1; end;OnEnterBG: set $@FlaviusBG1_id1, waitingroom2bg("bat_b01",390,10,"Flavius_BG1::OnGuillaumeQuit",""); end;}jupe_ele,46,57,4 script Registration::Fl1R_Croix 414,{ end;OnInit: waitingroom "Team Battle",4,"Flavius_BG1::OnCroixJoin",1; end;OnEnterBG: set $@FlaviusBG1_id2, waitingroom2bg("bat_b01",10,290,"Flavius_BG1::OnCroixQuit",""); end;}// Battleground Engine// *********************************************************************- script Flavius_BG1 -1,{ end;OnInit: disablenpc "Guillaume Vintenar#fl1"; disablenpc "Croix Vintenar#fl1"; disablenpc "Therapist in battle#fl11"; disablenpc "Therapist in battle#fl12"; end;OnGuillaumeQuit:OnCroixQuit: if($@FlaviusBG1 != 1) {end;} if(Bat_Team == 2) { for(set .@i,0; .@i < getarraysize($@bg_red$); set .@i,.@i+1){ if($@bg_red$[.@i] == strcharinfo(0)) {break;} } deletearray $@bg_red$[.@i],1; set $@td_a,$@td_a-1; end; } else if(Bat_Team == 1) { for(set .@i,0; .@i < getarraysize($@bg_blue$); set .@i,.@i+1){ if($@bg_blue$[.@i] == strcharinfo(0)) {break;} } deletearray $@bg_blue$[.@i],1; set $@td_b,$@td_b-1; end; } else { end; } end; OnGuillaumeJoin:OnCroixJoin: if( $@FlaviusBG1 == 1 ){ if( $@Guill < 30 && $@Croi < 30){ set .@Guillaume, getwaitingroomstate(0,"Fl1R_Guillaume"); set .@Croix, getwaitingroomstate(0,"Fl1R_Croix"); if (.@Guillaume!=0 && .@Croix!=0){ set $@Guill, ($@Guill + 1); set $@Croi, ($@Croi + 1); waitingroom2bg_single($@FlaviusBG1_id1,"bat_b01",311,224,"Fl1R_Guillaume"); waitingroom2bg_single($@FlaviusBG1_id2,"bat_b01",87,75,"Fl1R_Croix"); mapannounce "jupe_ele","Battleground -- Team Deathmatch [80-99] G: " + $@Guill + "/30, C: " + $@Croi + "/30 in Progress!!",1,0x006400; end; } } } if( $@FlaviusBG1 == 0 ){ donpcevent "Flavius_BG1::OnReadyCheck"; end; }OnReadyCheck: if( $@FlaviusBG1 ) end; set .@Guillaume, getwaitingroomstate(0,"Fl1R_Guillaume"); set .@Croix, getwaitingroomstate(0,"Fl1R_Croix"); if( .@Guillaume < 3 || .@Croix < 3 ){ if( .@Guillaume >=4 && .@Croix >=4 && !agitcheck() && $@FLTD_Flood < gettimetick(2) ) { announce "Battleground -- Team Deathmatch [ B ]: " + .@Guillaume + "/3, [ R ]: " + .@Croix + "/3",bc_all,0x006400; set $@FLTD_Flood, gettimetick(2) + 15; end; } mapannounce "jupe_ele","Battleground -- Team Deathmatch [ B ]: " + .@Guillaume + "/3, [ R ]: " + .@Croix + "/3",1,0x006400; end; } // // BG Variables set $@FlaviusBG1, 1; set $@FlaviusBG1_Victory, 0; set .Guillaume_Score, 1; set .Croix_Score, 1; // Prepare NPC donpcevent "#gfl1_respawn::OnBGStart"; donpcevent "#cfl1_respawn::OnBGStart"; enablenpc "Therapist in battle#fl11"; enablenpc "Therapist in battle#fl12"; disablenpc "Guillaume Vintenar#fl1"; disablenpc "Croix Vintenar#fl1"; // Build and Warp Teams donpcevent "Fl1R_Guillaume::OnEnterBG"; donpcevent "Fl1R_Croix::OnEnterBG"; // Vamos contando :3 set $@Guill, 10; set $@Croi, 10; announce "Battleground -- Team Deathmatch has started!",0,0x006400; initnpctimer; // Death!!OnRoundStart: if( $@FlaviusBG1 != 1 ) end; bg_updatescore "bat_b01",.Guillaume_Score,.Croix_Score; areapercentheal "bat_b01",382,2,397,17,100,100; areapercentheal "bat_b01",2,282,17,297,100,100; bg_warp $@FlaviusBG1_id1,"bat_b01",311,224; bg_warp $@FlaviusBG1_id2,"bat_b01",87,75; sleep 2000; if( $@FlaviusBG1 != 1 ) end; mapannounce "bat_b01","Team Deathmatch has begun!!",1,0x006400; bg_updatescore "bat_b01",.Guillaume_Score,.Croix_Score; end;OnPCDieEvent: if( $@FlaviusBG1 == 1 ) { getmapxy (mapname$,.@mapx,.@mapy,0,strcharinfo(0)); if ( mapname$ != "bat_b01") end; if( Bat_Team == 1) { set .Croix_Score, .Croix_Score -1; bg_updatescore "bat_b01",.Guillaume_Score,.Croix_Score; if (.Croix_Score < 1) donpcevent "Flavius_BG1::OnCroixTDWin"; end; } if ( Bat_Team == 2) { set .Guillaume_Score, .Guillaume_Score -1; bg_updatescore "bat_b01",.Guillaume_Score,.Croix_Score; if (.Guillaume_Score < 1) donpcevent "Flavius_BG1::OnGuillaumeTDWin"; end; } }end;OnGuillaumeTDWin: set $@FlaviusBG1, 2; set $@FlaviusBG1_Victory, 1; mapannounce "bat_b01","The Blue Team has won the Team Deathmatch",1,0x0000FF; stopnpctimer; sleep 2000; donpcevent "Flavius_BG1::OnMatchEnd"; end; OnCroixTDWin: set $@FlaviusBG1, 2; set $@FlaviusBG1_Victory, 2; mapannounce "bat_b01","The Red Team has won the Team Deathmatch",1,0xFF0000; stopnpctimer; sleep 2000; donpcevent "Flavius_BG1::OnMatchEnd"; end; OnTimer900000: if ($@FlaviusBG1 != 1) end; mapannounce "bat_b01","Team Deathmatch will ends in 5 minutes",1,0x006400; end;OnTimer1140000: if ($@FlaviusBG1 != 1) end; mapannounce "bat_b01","Team Deathmatch will ends in 1 minute",1,0x006400; end;OnTimer1200000: if ($@FlaviusBG1 != 1) end; if( .Croix_Score > .Guillaume_Score ) { mapannounce "bat_b01","The Croix army has won the Battle of Flavius Team Deathmatch!",1,0xFF0000; donpcevent "Flavius_BG1::OnCroixTDWin"; } else if( .Croix_Score < .Guillaume_Score ) { mapannounce "bat_b01","The Guillaume army has won the Battle of Flavius Team Deathmatch!",1,0x0000FF; donpcevent "Flavius_BG1::OnGuillaumeTDWin"; } else { mapannounce "bat_b01","The Battle of Flavius Team Deathmatch is over. The time is out, this is a Tie",1,0x006400; set $@FlaviusBG1, 2; set $@FlaviusBG1_Victory, 3; stopnpctimer; sleep 2000; } OnMatchEnd: donpcevent "#gfl1_respawn::OnBGStop"; donpcevent "#cfl1_respawn::OnBGStop"; disablenpc "Therapist in battle#fl11"; disablenpc "Therapist in battle#fl12"; enablenpc "Guillaume Vintenar#fl1"; enablenpc "Croix Vintenar#fl1"; bg_warp $@FlaviusBG1_id1,"bat_b01",390,10; bg_warp $@FlaviusBG1_id2,"bat_b01",10,290; deletearray $@bg_red$; deletearray $@bg_blue$; set $@td_a,0; set $@td_b,0; sleep 3000; mapannounce "bat_b01","Battle of Flavius Team Deathmatch will close in 1 minute!",1,0x006400; initnpctimer; end;OnTimer30000: if( $@FlaviusBG1 == 2 ) mapannounce "bat_b01","Battle of Flavius Team Deathmatch will close in 30 seconds!",1,0x006400; end;OnTimer50000: if( $@FlaviusBG1 == 2 ) mapannounce "bat_b01","Battle of Flavius Team Deathmatch will close in 10 seconds!",1,0x006400; end;OnTimer60000: if( $@FlaviusBG1 != 2 ) end;OnReset: stopnpctimer; set .Guillaume_Score, 99; set .Croix_Score, 99; set $@FlaviusBG1_Victory, 0; // NPC's disablenpc "Guillaume Vintenar#fl1"; disablenpc "Croix Vintenar#fl1"; disablenpc "Therapist in battle#fl11"; disablenpc "Therapist in battle#fl12"; if( $@FlaviusBG1_id1 ) { bg_destroy $@FlaviusBG1_id1; set $@FlaviusBG1_id1, 0; } if( $@FlaviusBG1_id2 ) { bg_destroy $@FlaviusBG1_id2; set $@FlaviusBG1_id2, 0; } sleep 1000; mapwarp "bat_b01","bat_room",155,150; sleep 2000; bg_updatescore "bat_b01",.Guillaume_Score,.Croix_Score; set $@FlaviusBG1, 0; donpcevent "Flavius_BG1::OnReadyCheck"; end;}// View oponentes en el mapa <3- script viewtd -,{end;OnPCLoadMapEvent: if($@FlaviusBG1 != 1) {end;} if(Bat_Team == 2) { getmapxy .@MAPNAME$,.@X,.@Y,0,strcharinfo(0); while(.@MAPNAME$ == "bat_b01"){ if($@FlaviusBG1 != 1) {end;} getmapxy .@MAPNAME$,.@X,.@Y,0,strcharinfo(0); if(.@MAPNAME$ != "bat_b01") { end;} for(set .@i,0; .@i < getarraysize($@bg_red$); set .@i,.@i+1){ if($@bg_red$[.@i] == strcharinfo(0)) { set .@ontd,1; break;} } if(.@ontd != 1) { setarray $@bg_red$[$@td_a],strcharinfo(0); set $@td_a,$@td_a+1; } set .@j,0; for (set .@i,0; .@i < getarraysize($@bg_blue$); set .@i,.@i+1){ set .@j,.@j+1; getmapxy(.mapES$, .xI, .yI,0,$@bg_blue$[.@i]); viewpoint 1,.xI,.yI,.@j,0x0000ff; } // cierre for sleep2 1000; } // cierre while } else if(Bat_Team == 1) { getmapxy .@MAPNAME$,.@X,.@Y,0,strcharinfo(0); while(.@MAPNAME$ == "bat_b01"){ if($@FlaviusBG1 != 1) {end;} getmapxy .@MAPNAME$,.@X,.@Y,0,strcharinfo(0); if(.@MAPNAME$ != "bat_b01") { end;} for(set .@i,0; .@i < getarraysize($@bg_blue$); set .@i,.@i+1){ if($@bg_blue$[.@i] == strcharinfo(0)) { set .@ontd,1; break;} } if(.@ontd != 1) { setarray $@bg_blue$[$@td_b],strcharinfo(0); set $@td_b,$@td_b+1; } set .@j,0; for (set .@i,0; .@i < getarraysize($@bg_red$); set .@i,.@i+1){ set .@j,.@j+1; getmapxy(.mapES$, .xE, .yE,0,$@bg_red$[.@i]); viewpoint 1,.xE,.yE,.@j,0xff0000; } // cierre for sleep2 1000; } // cierre while } else { end; } }// Battleground rewards// *********************************************************************bat_b01,390,13,5 script Guillaume Vintenar#fl1 419,{ if( $@FlaviusBG1_Victory ) { if( $@FlaviusBG1_Victory == Bat_Team ) { // Victory mes "[Swandery]"; mes "Blessed Guillaume!!"; mes "Let's enjoy our glorious victory!"; mes "" + strcharinfo(0) + ", its a sign reflecting victory"; close2; set .@Reward,18; } else { // Derrota mes "[Swandery]"; mes "You lost, but you're dedicated to this battle."; mes "This is a reward for your great dedication by Guillaume Marollo!"; mes "Just take this defeat a lesson, and later you would definitely learn."; close2; set .@Reward,6; } set Flavius_BG_Tick, gettimetick(2) + 300; //setquest 2070; getitem 7829, .@Reward; set .@ontd,0; bg_leave; warp "bat_room",155,150; end; } end;}bat_b01,10,293,5 script Croix Vintenar#fl1 415,{ if( $@FlaviusBG1_Victory ) { if( $@FlaviusBG1_Victory == Bat_Team ) { // Victory mes "[Swandery]"; mes "Blessed Croax!!"; mes "Let's enjoy our glorious victory!"; mes "" + strcharinfo(0) + ", its a sign reflecting victory"; close2; set .@Reward, 18; } else { // Derrota mes "[Swandery]"; mes "Oh, " + strcharinfo(0) + ". Don't be sad."; mes "Even though we didn't win, we did our best."; mes "This is a Royal gift from Croix, and please don't forget this battle. We can win the next."; close2; set .@Reward, 6; } set Flavius_BG_Tick, gettimetick(2) + 300; //setquest 2070; getitem 7829, .@Reward; set .@ontd,0; bg_leave; warp "bat_room",155,150; end; } end;}// Battleground Therapist// *********************************************************************bat_b01,390,13,5 script Therapist in battle#fl12 95,{ OnHeal: if((@h_last) && (getnpctimer(1))) end; set @h_last,1; percentheal 100,100; repair 1101; skilleffect 34,0; sc_start SC_BLESSING,240000,5; skilleffect 29,0; sc_start SC_INC_AGI,240000,5; dispbottom "HP/SP fully restored."; if(!getnpctimer(1)){setnpctimer 0; attachnpctimer(strcharinfo(1)); startnpctimer;} while(getbrokenid(1)){ repair(1);{ set .@i, .@i +1; } if (.@i) dispbottom .@i + " Item(s) Repaired.";} end; OnTimer5000: set @h_last,0; stopnpctimer; end; OnInit: defpattern 1, "heal","OnHeal"; activatepset 1; end;}bat_b01,10,293,5 script Therapist in battle#fl11 95,{ OnHeal: if((@h_last) && (getnpctimer(1))) end; set @h_last,1; percentheal 100,100; repair 1101; skilleffect 34,0; sc_start SC_BLESSING,240000,5; skilleffect 29,0; sc_start SC_INC_AGI,240000,5; dispbottom "HP/SP fully restored."; if(!getnpctimer(1)){setnpctimer 0; attachnpctimer(strcharinfo(0)); startnpctimer;} while(getbrokenid(1)){ repair(1);{ set .@i, .@i +1; } if (.@i) dispbottom .@i + " Item(s) Repaired.";} end; OnTimer5000: set @h_last,0; stopnpctimer; end; OnInit: defpattern 1, "heal","OnHeal"; activatepset 1; end;}// Battleground Respawn and Regroup// *********************************************************************bat_b01,390,10,0 script #gfl1_respawn 139,{ end;OnBGStart: initnpctimer; end;OnBGStop: stopnpctimer; end;OnTimer9000: misceffect 83; end;OnTimer10000: areapercentheal "bat_b01",382,2,397,17,100,100; set .@mapx,rand(309,327); set .@mapy,rand(141,159); areawarp "bat_b01",382,2,397,17,"bat_b01",.@mapx,.@mapy; initnpctimer; end;}bat_b01,10,290,0 script #cfl1_respawn 139,{ end;OnBGStart: initnpctimer; end;OnBGStop: stopnpctimer; end;OnTimer9000: misceffect 83; end;OnTimer10000: areapercentheal "bat_b01",2,282,17,297,100,100; set .@mapx,rand(72,91); set .@mapy,rand(141,159); areawarp "bat_b01",2,282,17,297,"bat_b01",.@mapx,.@mapy; initnpctimer; end;}// MapFlags// *********************************************************************bat_b01 mapflag battleground 2bat_b01 mapflag nomemobat_b01 mapflag nosave SavePointbat_b01 mapflag noteleportbat_b01 mapflag nowarpbat_b01 mapflag nowarptobat_b01 mapflag noreturnbat_b01 mapflag nobranchbat_b01 mapflag nopenaltybat_b01 mapflag loadevent// ***********************************************************************
Thank you in advance <3
Kindly Move this Post, I accidentally posted it here, and it supposed to be on "Script Support Section" Thanks..
Edited by Zalbahis, 16 July 2013 - 11:58 AM.