//===== rAthena Script =======================================
//= Dynamic Battleground Arena
//===== By ===================================================
//= llchrisll
//===== Version ==============================================
//= 1.0 - Initial Version
//===== Tested With ==========================================
//= rAthena 06/29/2019 Revision
//= GIT Hash: c1975d7ea3729c1f5deec2e0dcf04841c4b96969
//===== Description ==========================================
//= This battleground arena can be configured however you like.
// You could compare it with an Call of Duty game.
// Which consists of Domination, Capture the Flag and so on
//= The config is per Game Mode dynamically changeable.
//= Using extra Maps so it won't collide with other Battlegrounds
// Copied the bat_a01 and bat_b01 map
//===== Comments =============================================
//= You need the following file: Battleground_Arena.rar
// Inside the GRF you find instructions how to install the maps:
// dbg_readme.txt
//===== ToDO =================================================
//= Capture the Flag: Change effect for Flag Holder to a better one!
//============================================================
- script DBGArena_Core -1,{
OnInit:
// BG Modes
setarray $@DBG_Mode$[1],"Team Deathmatch","Search & Destroy","Domination","Rush","Capture the Flag";
// BG Maps for each Mode
// Note: [0] = is to prevent errors when $@DBG_Status is reseted by Arena Ending mid-way like by a player leaving
setarray $@DBG_Map$[0],"dbg_arena","dbg_arena","dbg_arena","dbg_dom","dbg_arena","dbg_arena";
// BG Announce Colors per Mode
setarray $@DBG_Anno$[1],"0x8CFFFB","0xA4CC2D","0xEAC2EB","0xB97A56","0xEB1E33";
// BG Announce Type
// How will the Announces be displayed to the players:
// Recommended Values:
// - bc_all: Global
// - bc_woe: Displayed as WoE Information, which can be turned off
set $@DBG_Anno_T,bc_woe;
// BG Team Spawn Coordinates per Mode
setarray .team1_x[1],87,87,349,87,87;
setarray .team1_y[1],75,75,311,75,75;
setarray .team2_x[1],312,312,350,312,312;
setarray .team2_y[1],225,225,91,225,225;
// Min Players to start an match per Mode
setarray .DBG_PlayersMin[1],2,2,2,2,2;
// Max Players per Team per Mode
setarray .DBG_PlayersMax[1],10,10,20,10,10;
// Time Limit until match ends per Mode in minutes
setarray .DBG_TLimit[1],10,10,10,10,10;
// Max Points to end the match per Mode
// Note: Client can only display up to 100 points
setarray .DBG_MPTS[1],75,2,100,2,3;
// Battleground Join Timer in minutes
set .BG_JoinTime,3;
// WoE Restriction
// 0 = Ignore WoE Status
// 1 = When WoE is active, no BG
set .DBG_WoE,1;
// Battleground Happy Hour
// For the actual Happy Hour time look for "OnClock"
// 0 = Disable
// 1 = Enable
set .DBG_HH,1;
// Don't touch this value below, to adjust the rate itself go to "OnClock2000:"
set .DBG_HH_Rate,1;
// Custom Commands
bindatcmd "joinbgarena",strnpcinfo(0)+"::OnBGJoin";
bindatcmd "leavebgarena",strnpcinfo(0)+"::OnBGLeave";
bindatcmd "bgarenainfo",strnpcinfo(0)+"::OnBGInfo";
// Custom GM Commands to start or end the BG Arena manually
bindatcmd "startbgarena",strnpcinfo(0)+"::OnBGArenaInit",99,99;
bindatcmd "endbgarena",strnpcinfo(0)+"::OnBGArenaEnd",99,99;
// Load Reward Function
function DBG_Reward;
end;
// Happy Hour Starting Time
OnClock2000:
if(!.DBG_HH || .DBG_WoE && (agitcheck() || agitcheck2() || agitcheck3())) end;
set .DBG_HH_Rate,2; // Happy Hour Rate
announce "Battleground Arena: Battleground Happy Hour has started. Rewards will be x"+.DBG_HH_Rate+" for the next hour!",bc_all;
end;
// Happy Hour Ending Time
OnClock2100:
if(!.DBG_HH) end;
announce "Battleground Arena: Battleground Happy Hour has ended!",bc_all;
set .DBG_HH_Rate,1; // Reset to normal reward
end;
// Starting Battleground Arena
OnBGArenaInit:
// Check if players are still on the map
if(getmapusers("dbg_arena") > 0)
mapwarp "dbg_arena","prontera",156,191;
if(getmapusers("dbg_dom") > 0)
mapwarp "dbg_dom","prontera",156,191;
OnBGArenaPrepare:
if(.DBG_Match) {
donpcevent "DBGArena_Vote::OnBGVoteInit";
set .DBG_Match,0;
end;
}
set $@DBG_T1Score,0;
set $@DBG_T2Score,0;
donpcevent strnpcinfo(0)+"::OnBGArenaScore";
set .DBG_Prepare,1;
set .t,0;
// Checking for exisiting battle groups
if($@DBG_T1) {
set .@bg_t1,bg_get_data($@DBG_T1,1); // Saving Player Amount of Team 1
copyarray .Team1[0],$@arenamembers[0],.@bg_t1; // and copy the Game IDs into the "join" array .Team1
bg_destroy $@DBG_T1;
set $@DBG_T1,0;
for ( set .@t,0; .@t < getarraysize(.Team1); set .@t,.@t + 1)
if(attachrid(.Team1[.@t]) == 1) // Attach the current Game ID for getcharid()
setarray .Team1[.@t],getcharid(3); // Overwrite the Game ID with the Account ID
}
if($@DBG_T2) {
set .@bg_t2,bg_get_data($@DBG_T2,1); // Saving Player Amount of Team 2
copyarray .Team2[0],$@arenamembers[0],.@bg_t2; // and copy the Game IDs into the "join" array .Team2
bg_destroy $@DBG_T2;
set $@DBG_T2,0;
for ( set .@t,0; .@t < getarraysize(.Team2); set .@t,.@t + 1)
if(attachrid(.Team2[.@t]) == 1) // Attach the current Game ID for getcharid()
setarray .Team2[.@t],getcharid(3); // Overwrite the Game ID with the Account ID
}
if(!$@DBG_Status) {
donpcevent "DBGArena_Vote::OnBGVoteInit";
end;
}
// Creating BG Group ID's
set $@DBG_T1,bg_create($@DBG_Map$[$@DBG_Status],.team1_x[$@DBG_Status],.team1_y[$@DBG_Status],strnpcinfo(0)+"::OnBGLeave",strnpcinfo(0)+"::OnBGArenaDeath");
set $@DBG_T2,bg_create($@DBG_Map$[$@DBG_Status],.team2_x[$@DBG_Status],.team2_y[$@DBG_Status],strnpcinfo(0)+"::OnBGLeave",strnpcinfo(0)+"::OnBGArenaDeath");
sleep 2000;
announce "Battleground Arena: You have "+.BG_JoinTime+" Minute"+( (.BG_JoinTime > 1)?"s":"")+" to join by using \"@joinbgarena\" - Mode: "+$@DBG_Mode$[$@DBG_Status],$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
// Check if there are existing players in the queue
if(getarraysize(.Team1) > 0 || getarraysize(.Team2) > 0)
announce "Battleground Arena: "+$@DBG_Mode$[$@DBG_Status]+" - Team 1: "+getarraysize(.Team1)+"/"+.DBG_PlayersMax[$@DBG_Status]+" : Team 2: "+getarraysize(.Team2)+"/"+.DBG_PlayersMax[$@DBG_Status],$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
set .BGJoin,1;
sleep (.BG_JoinTime*60*1000);
set .BGJoin,0;
if( (getarraysize(.Team1) + getarraysize(.Team2) ) < .DBG_PlayersMin[$@DBG_Status]) {
announce "Battleground Arena: Time is over! But there are not enough participants to start/continue the match!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
donpcevent strnpcinfo(0)+"::OnBGArenaEnd"; // End the whole Battleground
end;
}
for ( set .@t,0; .@t < getarraysize(.Team1); set .@t,.@t + 1)
if(isloggedin(.Team1[.@t])) {
if(attachrid(.Team1[.@t]) == 0) continue;
bg_join($@DBG_T1);
detachrid;
}
for ( set .@t,0; .@t < getarraysize(.Team2); set .@t,.@t + 1)
if(isloggedin(.Team2[.@t])) {
if(attachrid(.Team2[.@t]) == 0) continue;
bg_join($@DBG_T2);
detachrid;
}
deletearray .Team1[0],getarraysize(.Team1);
deletearray .Team2[0],getarraysize(.Team2);
set .DBG_Prepare,0;
OnBGArenaReset: // Next Round, mostly for S&D and CTF
// Warp BG Groups on the field
if(.DBG_Reset) {
stopnpctimer;
bg_warp $@DBG_T1,$@DBG_Map$[$@DBG_Status],.team1_x[$@DBG_Status],.team1_y[$@DBG_Status];
bg_warp $@DBG_T2,$@DBG_Map$[$@DBG_Status],.team2_x[$@DBG_Status],.team2_y[$@DBG_Status];
set .DBG_Reset,0;
set .t,0;
}
set .@bg_pl,bg_get_data($@DBG_T1,1);
for ( set .@p,0; .@p < .@bg_pl; set .@p,.@p + 1) {
pcblockmove $@arenamembers[.@p],1; // Disable Movement
pcblockskill $@arenamembers[.@p],1; // Disable Skills
}
set .@bg_pl,bg_get_data($@DBG_T2,1);
for ( set .@p,0; .@p < .@bg_pl; set .@p,.@p + 1) {
pcblockmove $@arenamembers[.@p],1; // Disable Movement
pcblockskill $@arenamembers[.@p],1; // Disable Skills
}
donpcevent "DBG_Init::OnBGPrepare";
end;
// Battleground Arena - Match Duration
OnBGArenaTimer:
set .DBG_Match,1;
initnpctimer;
end;
OnTimer60000: // Every Minute
stopnpctimer;
set .t,.t + 1; // Increase Minute Counter
if(.DBG_Match && .t < .DBG_TLimit[$@DBG_Status]) {
mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+" - Time Limit: "+(.DBG_TLimit[$@DBG_Status] - .t)+" Minute"+ ( ((.DBG_TLimit[$@DBG_Status] - .t) > 1)?"s":"") +" left!",bc_all,$@DBG_Anno$[$@DBG_Status];
initnpctimer;
// If an Match is active and timer has been reached
} else if(.DBG_Match && .t == .DBG_TLimit[$@DBG_Status]) {
mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": The Match is over! Time Limit has been reached!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
if($@DBG_Status != 1 || $@DBG_Status != 3) { // S&D + Rush + CTF has round based matches
if($@DBG_Status == 2) // S&D: Declare Team 2 as winner
set getvariableofnpc(.SAD_Win,"DBG_Init"),2;
else if($@DBG_Status == 4) // Rush: Declare Team 2 as winner
set getvariableofnpc(.Rush_Win,"DBG_Init"),2;
donpcevent "DBG_Init::OnRoundReset";
} else
donpcevent strnpcinfo(0)+"::OnBGMatchEnd";
} else if($@DBG_Status && !.DBG_Prepare)
if(getmapusers($@DBG_Map$[$@DBG_Status]) < .DBG_PlayersMin[$@DBG_Status])
donpcevent strnpcinfo(0)+"::OnBGArenaEnd";
end;
// Battleground Arena - Death Event
OnBGArenaDeath:
mapannounce $@DBG_Map$[$@DBG_Status],"["+rid2name(killerrid)+"] has killed ["+strcharinfo(0)+"]!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
switch($@DBG_Status) {
default: break;
case 1: // TDM
if(@DBG_Team == 1) // Killed player is in Team 1, increase Team 2's Score
set $@DBG_T2Score,$@DBG_T2Score + 1;
else if(@DBG_Team == 2) // Killed player is in Team 2, increase Team 1's Score
set $@DBG_T1Score,$@DBG_T1Score + 1;
break;
case 2: // Search & Destroy
if(!@Has_Bomb) end;
getmapxy(.@map$,.@bomb_x,.@bomb_y,BL_NPC);
movenpc "Bomb#SAD",.@bomb_x,.@bomb_y;
mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": The bomb has been dropped!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
set @Has_Bomb,0;
enablenpc "Bomb#SAD";
set .@bg_pl,bg_get_data($@DBG_T1,1);
copyarray .@bg_ids[getarraysize(.@bg_ids)],$@arenamembers[0],.@bg_pl;
set .@bg_pl,bg_get_data($@DBG_T2,1);
copyarray .@bg_ids[getarraysize(.@bg_ids)],$@arenamembers[0],.@bg_pl;
for ( set .@p,0; .@p < getarraysize(.@bg_ids); set .@p,.@p + 1)
if(attachrid(.@bg_ids[.@p]))
viewpoint 0,.@bomb_x,.@bomb_y,3,0xFF0000;
end;
case 4: // Rush
if(@DBG_Team == 1) // Player of Team 1 has been killed, decrease Team 1's Life Pool
set .Rush_Life,.Rush_Life - 1;
else if(@DBG_Team == 2)
end;
if(!.Rush_Life) { // Team 1's Lifes are 0, Team 2 wins the round
mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": Team 1 has lost all of their lifes! Team 2 wins this round!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
set getvariableofnpc(.Rush_Win,"DBG_Init"),2;
donpcevent "DBG_Init::OnRoundReset";
end;
}
mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": Team 2 has "+.Rush_Life+" lifes left!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
break;
case 5: // Capture the Flag
if(!@Has_Flag) end;
getmapxy(.@map$,.@flag_x,.@flag_y,BL_NPC);
set .@npc$,"Team "+@Has_Flag+" Flag#"+@Has_Flag;
movenpc .@npc$,.@flag_x,.@flag_y;
mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": The Flag of Team "+@DBG_Team+" has been dropped!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
set @Has_Flag,0;
enablenpc .@npc$;
set .@bg_pl,bg_get_data($@DBG_T1,1);
copyarray .@bg_ids[getarraysize(.@bg_ids)],$@arenamembers[0],.@bg_pl;
set .@bg_pl,bg_get_data($@DBG_T2,1);
copyarray .@bg_ids[getarraysize(.@bg_ids)],$@arenamembers[0],.@bg_pl;
for ( set .@p,0; .@p < getarraysize(.@bg_ids); set .@p,.@p + 1)
if(attachrid(.@bg_ids[.@p]))
viewpoint 0,.@flag_x,.@flag_y,3,0xFF0000;
end;
}
donpcevent strnpcinfo(0)+"::OnBGArenaScore";
end;
OnBGArenaScore:
bg_updatescore $@DBG_Map$[$@DBG_Status],$@DBG_T1Score,$@DBG_T2Score;
if($@DBG_T1Score >= .DBG_MPTS[$@DBG_Status] || $@DBG_T2Score >= .DBG_MPTS[$@DBG_Status] || .DBG_End)
donpcevent strnpcinfo(0)+"::OnBGMatchEnd";
end;
// Match ended = Give rewards
OnBGMatchEnd:
// .@rew_xxx[X]: Rewards of Winner/Loser
// [0] = BGArenaPts
// [1] = War Badges
// [2] = Valor Badges
// [3] = Bravery Badges
// Note: If you add more rewards, you have to edit the DBG_Reward function too > .@rew_item[]
stopnpctimer;
set .t,0;
switch($@DBG_Status) {
case 0: debugmes "OnBGMatchEnd - $@DBG_Status = 0 > Error"; break; // Shouldn't happen
case 1: // TDM
setarray .@rew_win[0],10,5,5,5;
setarray .@rew_lose[0],5,2,2,2;
break;
case 2: // Search & Destroy
setarray .@rew_win[0],15,8,8,8;
setarray .@rew_lose[0],7,4,4,4;
break;
case 3: // Domination
setarray .@rew_win[0],20,10,10,10;
setarray .@rew_lose[0],10,8,8,8;
break;
case 4: // Rush
setarray .@rew_win[0],15,8,8,8;
setarray .@rew_lose[0],7,4,4,4;
break;
case 5: // Capture the Flag
setarray .@rew_win[0],15,8,8,8;
setarray .@rew_lose[0],7,4,4,4;
break;
}
donpcevent "DBG_Init::OnBGDisable"; // Disable NPC's
// Decide Winners and reset score
if($@DBG_T1Score < $@DBG_T2Score) {
DBG_Reward($@DBG_T2,.DBG_HH_Rate,.@rew_win[0],.@rew_win[1],.@rew_win[2],.@rew_win[3]);
DBG_Reward($@DBG_T1,.DBG_HH_Rate,.@rew_lose[0],.@rew_lose[1],.@rew_lose[2],.@rew_lose[3]);
announce "Battleground Arena: Team 2 has won this match!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
} else if($@DBG_T2Score < $@DBG_T1Score) {
DBG_Reward($@DBG_T1,.DBG_HH_Rate,.@rew_win[0],.@rew_win[1],.@rew_win[2],.@rew_win[3]);
DBG_Reward($@DBG_T2,.DBG_HH_Rate,.@rew_lose[0],.@rew_lose[1],.@rew_lose[2],.@rew_lose[3]);
announce "Battleground Arena: Team 1 has won this match!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
} else {
DBG_Reward($@DBG_T1,.DBG_HH_Rate,.@rew_lose[0],.@rew_lose[1],.@rew_lose[2],.@rew_lose[3]);
DBG_Reward($@DBG_T2,.DBG_HH_Rate,.@rew_lose[0],.@rew_lose[1],.@rew_lose[2],.@rew_lose[3]);
announce "Battleground Arena: It's an draw ! Nobody has won this match!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
}
mapwarp $@DBG_Map$[$@DBG_Status],"prontera",156,191;
sleep 2500; // Let the players finish warping
if(.DBG_End) donpcevent strnpcinfo(0)+"::OnBGArenaEnd";
else donpcevent strnpcinfo(0)+"::OnBGArenaPrepare";
end;
// Battleground Arena - Arena ended
OnBGArenaEnd:
if(!$@DBG_Status || !.DBG_Match) end;
donpcevent "DBG_Init::OnBGDisable";
mapwarp $@DBG_Map$[$@DBG_Status],"prontera",156,191;
deletearray .Team1[0],getarraysize(.Team1);
deletearray .Team2[0],getarraysize(.Team2);
if($@DBG_T1) {
set .@bg_t,bg_get_data($@DBG_T1,1); // Saving Player Amount of Team 1
bg_destroy $@DBG_T1;
set $@DBG_T1,0;
for ( set .@t,0; .@t < .@bg_t; set .@t,.@t + 1)
if(isloggedin($@arenamembers[.@t]) == 1 && attachrid($@arenamembers[.@t]) == 1) {
bg_leave;
set @DBG_Team,0;
pcblockmove getcharid(3),0;
pcblockskill getcharid(3),0;
detachrid;
}
}
if($@DBG_T2) {
set .@bg_t,bg_get_data($@DBG_T2,1); // Saving Player Amount of Team 2
bg_destroy $@DBG_T2;
set $@DBG_T2,0;
for ( set .@t,0; .@t < .@bg_t; set .@t,.@t + 1)
if(isloggedin($@arenamembers[.@t]) == 1 && attachrid($@arenamembers[.@t]) == 1) {
bg_leave;
set @DBG_Team,0;
pcblockmove getcharid(3),0;
pcblockskill getcharid(3),0;
detachrid;
}
}
set $@DBG_Status,0;
set .DBG_Match,0;
set .DBG_Prepare,0;
set .DBG_Reset,0;
set .DBG_End,0;
set .BGJoin,0;
announce "[Server]: Battleground Arena has ended! Good luck next time!",$@DBG_Anno_T;
end;
// Battleground Arena - @joinbgarena command
OnBGJoin:
if(!.BGJoin) {
message strcharinfo(0),"Battleground Arena: Joining the Arena is currently not possible.";
end;
}
if(@DBG_Team) {
message strcharinfo(0),"Battleground Arena: You are already registered for the Arena.";
end;
}
if(getarraysize(.Team1) <= getarraysize(.Team2) && getarraysize(.Team1) < .DBG_PlayersMax[$@DBG_Status]) {
setarray .Team1[getarraysize(.Team1)],getcharid(3);
set @DBG_Team,1;
} else if(getarraysize(.Team2) <= getarraysize(.Team1) && getarraysize(.Team2) < .DBG_PlayersMax[$@DBG_Status]) {
setarray .Team2[getarraysize(.Team2)],getcharid(3);
set @DBG_Team,2;
} else {
message strcharinfo(0),"Battleground Arena: I'm sorry, but every Team is full already. Please try again later.";
end;
}
announce "Battleground Arena: "+$@DBG_Mode$[$@DBG_Status]+" - Team 1: "+getarraysize(.Team1)+"/"+.DBG_PlayersMax[$@DBG_Status]+" : Team 2: "+getarraysize(.Team2)+"/"+.DBG_PlayersMax[$@DBG_Status],$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
end;
// Battleground Arena - @leavebgarena command & Quit Event
OnBGLeave:
if(!$@DBG_Status || !@DBG_Team) {
message strcharinfo(0),"Battleground Arena: From what are you running away? You didn't register yet!";
end;
}
if(.BGJoin) {
if(@DBG_Team == 1)
for ( set .@c,0; .@c < getarraysize(.Team1); set .@c,.@c + 1)
if(getcharid(3) == .Team1[.@c])
deletearray .Team1[.@c],1;
else if(@DBG_Team == 2)
for ( set .@c,0; .@c < getarraysize(.Team1); set .@c,.@c + 1)
if(getcharid(3) == .Team1[.@c])
deletearray .Team1[.@c],1;
} else if(.DBG_Match) {
bg_leave;
warp "prontera",156,191;
pcblockmove getcharid(3),0;
pcblockskill getcharid(3),0;
if(getmapusers($@DBG_Map$[$@DBG_Status]) < .DBG_PlayersMin[$@DBG_Status]) {
announce "Battleground Arena: There are not enough participants to continue the match.",$@DBG_Anno_T;
set .DBG_End,1;
donpcevent strnpcinfo(0)+"::OnBGArenaScore";
}
}
set @DBG_Team,0;
announce "Battleground Arena: ["+strcharinfo(0)+"] has left the battlefield!",$@DBG_Anno_T;
end;
// Battleground Arena - @bgarenainfo command
OnBGInfo:
if(!$@DBG_Status)
message strcharinfo(0),"Battleground Arena: Inactive";
else {
message strcharinfo(0),"Battleground Arena: "+$@DBG_Mode$[$@DBG_Status]+" - "+$@DBG_T1Score+" : "+$@DBG_T2Score;
if(.DBG_Match)
message strcharinfo(0),"Battleground Arena: Time Limit - "+(.DBG_TLimit[$@DBG_Status] - .t)+" Minute"+ ( ((.DBG_TLimit[$@DBG_Status] - .t) > 1)?"s":"")+" until the Match ends.";
else if(.BGJoin)
message strcharinfo(0),"Battleground Arena: It's currently possible to join the battlefield!";
}
end;
// Battleground Arena - Unblock players and put markers on minimap
OnBGPlayerBlock:
set .@bg_pl,bg_get_data($@DBG_T1,1);
copyarray .@bg_ids[getarraysize(.@bg_ids)],$@arenamembers[0],.@bg_pl;
set .@bg_pl,bg_get_data($@DBG_T2,1);
copyarray .@bg_ids[getarraysize(.@bg_ids)],$@arenamembers[0],.@bg_pl;
for ( set .@p,0; .@p < getarraysize(.@bg_ids); set .@p,.@p + 1)
if(attachrid(.@bg_ids[.@p])) {
pcblockmove getcharid(3),0; // Enable Movement
pcblockskill getcharid(3),0; // Enable Skills
if($@DBG_Status == 2) { // S&D
getmapxy(.@map_a$,.@targeta_x,.@targeta_y,BL_NPC,"Target A#1");
getmapxy(.@map_b$,.@targetb_x,.@targetb_y,BL_NPC,"Target B#2");
viewpoint 1,.@targeta_x,.@targeta_y,1,0xFF0000;
viewpoint 1,.@targetb_x,.@targetb_y,2,0x00FF00;
} else if($@DBG_Status == 3) { // Domination
getmapxy(.@map_a$,.@flaga_x,.@flaga_y,BL_NPC,"Flag A#1");
getmapxy(.@map_b$,.@flagb_x,.@flagb_y,BL_NPC,"Flag B#2");
getmapxy(.@map_c$,.@flagc_x,.@flagc_y,BL_NPC,"Flag C#3");
viewpoint 1,.@flaga_x,.@flaga_y,1,0xFF0000;
viewpoint 1,.@flagb_x,.@flagb_y,2,0x00FF00;
viewpoint 1,.@flagc_x,.@flagc_y,3,0x0000FF;
} else if($@DBG_Status == 4) { // Rush
getmapxy(.@map$,.@def_x,.@def_y,BL_NPC,"Defend Crystal");
viewpoint 1,.@def_x,.@def_y,1,0xFF0000;
}
}
end;
// Battleground Arena - Reward Function
function DBG_Reward {
// getarg(0) = Group ID
// getarg(1) = Happy Hour Rate
// getarg(2) = BGArenaPts
// getarg(3) = War Badges (7773)
// getarg(4) = Valor Badges (7829)
// getarg(5) = Bravery Badges (7828)
// Item ID of Rewards:
// Change this values to adjust the reward ids!
setarray .@rew_item[0],7773,7829,7828;
set .@grp_count,bg_get_data(getarg(0),1);
// Loop through the players and give them the reward
for ( set .@b,0; .@b < .@grp_count; set .@b,.@b + 1) {
attachrid($@arenamembers[.@b]);
set BGArenaPts,BGArenaPts + (getarg(2)*getarg(1));
dispbottom "Battleground Arena: You have recieved "+(getarg(2)*getarg(1))+"x Battleground Arena Points.";
for ( set .@r,0; .@r < getarraysize(.@rew_item); set .@r,.@r + 1)
getitem .@rew_item[.@r],getarg(.@r+3)*getarg(1);
detachrid;
}
return;
}
}
// Battleground Arena - Vote NPC
- script DBGArena_Vote -1,{
OnInit:
// Time to vote in minutes
set .VoteTime,3;
bindatcmd "@votebgarena",strnpcinfo(0)+"::OnBGVote";
end;
// Battleground Arena - Starting Vote
OnBGVoteInit:
set .vt,0;
set .bg_v1_ct,0;
set .bg_v2_ct,0;
set .bg_v3_ct,0;
set .bg_v1,rand(1,(getarraysize($@DBG_Mode$) - 1));
if($@DBG_Status) // Save previous Game Mode as 2nd Vote Option
set .bg_v2,$@DBG_Status;
else
set .bg_v2,rand(1,(getarraysize($@DBG_Mode$) - 1));
set .bg_v3,rand(1,(getarraysize($@DBG_Mode$) - 1));
// Checking of duplicate Vote Entries
while(1) {
set .@f1,0;
set .@f3,0;
if(.bg_v1 == .bg_v2 || .bg_v1 == .bg_v3) set .@f1,1;
if(.bg_v3 == .bg_v2 || .bg_v3 == .bg_v1) set .@f3,1;
if(.@f1) set .bg_v1,rand(1,(getarraysize($@DBG_Mode$) - 1));
if(.@f3) set .bg_v3,rand(1,(getarraysize($@DBG_Mode$) - 1));
if(!.@f1 && !.@f3)
break;
sleep 100; // Preventing infinite loop
}
announce "Battleground Arena: Game Mode Voting is now possible. Use \"@votebgarena\" to vote for an Game Mode.",$@DBG_Anno_T;
sleep 2000;
announce "Battleground Arena: You have "+.VoteTime+" Minute"+ ( (.VoteTime > 1)?"s":"")+" to vote, if there are no votes until then, the Arena will be stopped.",$@DBG_Anno_T;
set .Vote,1;
initnpctimer;
end;
// Battleground Arena - Vote Time Limit
OnTimer60000: // Every Minute
stopnpctimer;
set .vt,.vt + 1;
if(.vt == .VoteTime) { // Check if Time Limit has been reached
set .Vote,0;
set .vt,0;
announce "Battleground Arena: Vote Result - "+$@DBG_Mode$[.bg_v1]+" = "+.bg_v1_ct+" | "+$@DBG_Mode$[.bg_v2]+" = "+.bg_v2_ct+" | "+$@DBG_Mode$[.bg_v3]+" = "+.bg_v3_ct,$@DBG_Anno_T;
// End the Battleground if there are no votes placed
if(!.bg_v1_ct && !.bg_v2_ct && !.bg_v3_ct) {
donpcevent "DBGArena_Core::OnBGArenaEnd";
end;
// Comparing if any vote is the same as one other but still higher than a different one
} else if(.bg_v1_ct == .bg_v2_ct && .bg_v1_ct > .bg_v3_ct)
set .@bg,1;
else if(.bg_v2_ct == .bg_v3_ct && .bg_v2_ct > .bg_v1_ct)
set .@bg,2;
else if(.bg_v3_ct == .bg_v1_ct && .bg_v3_ct > .bg_v2_ct)
set .@bg,3;
// Compare if any vote is higher than the others
else if(.bg_v1_ct > .bg_v2_ct && .bg_v1_ct > .bg_v3_ct)
set .@bg,1;
else if(.bg_v2_ct > .bg_v1_ct && .bg_v2_ct > .bg_v3_ct)
set .@bg,2;
else if(.bg_v3_ct > .bg_v1_ct && .bg_v3_ct > .bg_v2_ct)
set .@bg,3;
set $@DBG_Status,getd(".bg_v"+.@bg);
donpcevent "DBGArena_Core::OnBGArenaPrepare";
end;
}
initnpctimer;
end;
OnBGVote:
if(!.Vote) {
message strcharinfo(0),"Battleground Arena: There is currently no voting running.";
end;
}
if(.@atcmd_parameters$[0] == "") {
message strcharinfo(0),"Battleground Arena: Current Votings: "+.bg_v1_ct+" : "+$@DBG_Mode$[.bg_v1]+" (1) | "+.bg_v2_ct+" : "+$@DBG_Mode$[.bg_v2]+" (2) | "+.bg_v3_ct+" : "+$@DBG_Mode$[.bg_v3]+" (3)";
sleep2 1000;
message strcharinfo(0),"Battleground Arena: You can vote with \"@votebgarena 1|2|3\" for the prefered Game Mode.";
} else {
set .@v,atoi(.@atcmd_parameters$[0]);
setd(".bg_v"+.@v+"_ct"),getd(".bg_v"+.@v+"_ct") + 1;
message strcharinfo(0),"Battleground Arena: Vote has been confirmed. You have voted for \""+$@DBG_Mode$[getd(".bg_v"+.@v)]+"\".";
}
end;
}
// Battleground Arena - Healer NPC's
- script #DBG_Heal -1,{
if(@DBG_Team != atoi(charat(strnpcinfo(2),2)) ) {
npctalk "You don't belong to Team "+charat(strnpcinfo(2),2)+"!",strnpcinfo(0),bc_self;
} else {
if(@Heal_Delay > gettimetick(2)) {
npctalk "You can't be healed yet, please wait a few seconds.",strnpcinfo(0),bc_self;
end;
}
npctalk "You have been fully healed! Good luck!",strnpcinfo(0),bc_self;
specialeffect 911;
percentheal 100,100;
set @Heal_Delay,gettimetick(2) + .HDelay;
}
end;
OnInit:
// Delay until you can get healed again in seconds
set .HDelay,10;
disablenpc strnpcinfo(0);
end;
OnEnable:
enablenpc strnpcinfo(0);
if($@DBG_Map$[$@DBG_Status] == "dbg_arena") {
enablenpc "Healer#1-1";
enablenpc "Healer#1-2";
} else if($@DBG_Map$[$@DBG_Status] == "dbg_dom") {
enablenpc "Healer#2-1";
enablenpc "Healer#2-2";
}
end;
OnDisable:
if($@DBG_Map$[$@DBG_Status] == "dbg_arena") {
disablenpc "Healer#1-1";
disablenpc "Healer#1-2";
} else if($@DBG_Map$[$@DBG_Status] == "dbg_dom") {
disablenpc "Healer#2-1";
disablenpc "Healer#2-2";
}
disablenpc strnpcinfo(0);
end;
}
dbg_arena,88,82,4 duplicate(#DBG_Heal) Healer#1-1 4_F_NURSE
dbg_arena,311,232,4 duplicate(#DBG_Heal) Healer#1-2 4_F_NURSE
dbg_dom,354,317,4 duplicate(#DBG_Heal) Healer#2-1 4_F_NURSE
dbg_dom,349,100,4 duplicate(#DBG_Heal) Healer#2-2 4_F_NURSE
// Battleground Arena - Player warped on the battlefield and prepare final stuff for the match
- script DBG_Init -1,{
OnBGPrepare:
sleep 2500; // Let the players be warped to the map before starting
mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": The Match will start shortly.",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
sleep 3000;
mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": Until 10 seconds before the start of the match, you won't be able to move or use skills.",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
sleep 3000;
mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": Think about a good strategy to win and play fair.",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
sleep 3000;
switch($@DBG_Status) {
default: break;
case 2: // Search & Destroy
enablenpc "DBG_Target";
enablenpc "Target A#1";
enablenpc "Target B#2";
enablenpc "Bomb#SAD";
set .Planting_1,0;
set .Planting_2,0;
set .Bomb_Active_T1,0;
set .Bomb_Active_T2,0;
if(!.NoAnno) {
mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": Team 1 has to destroy one of the targets by using the bomb, which can be picked up!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
sleep 3000;
mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": Team 2 has to defend both targets and defuse the bomb, if it was planted.",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
sleep 3000;
}
break;
case 3: // Domination
enablenpc "DBG_DOM_Flag";
enablenpc "Flag A#1";
enablenpc "Flag B#2";
enablenpc "Flag C#3";
// Reseting Display ID to Neutral Flag
setnpcdisplay "Flag A#1",1911;
setnpcdisplay "Flag B#2",1911;
setnpcdisplay "Flag C#3",1911;
// Create Chat Room (Display Box)
donpcevent "Flag A#1::OnDisplayBox";
donpcevent "Flag B#2::OnDisplayBox";
donpcevent "Flag C#3::OnDisplayBox";
if(!.NoAnno) {
mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": There are 3 Flags to take, if one team has more members at a flag than the other, then the first team will get the flag!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
sleep 3000;
mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": Holding Flags gives Points every 5 seconds. The more flags your team holds the more points you will get!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
sleep 3000;
}
break;
case 4: // Rush
// How many Lifes does the Attacker Team has in Rush?
set getvariableofnpc(.Rush_Life,"DBGArena_Core"),45;
if(!.NoAnno) {
mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": Team 1 has to attack the other Team's Crystal to win, while they have to defend until the time limit has been reached!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
sleep 3000;
mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": Team 1 has "+getvariableofnpc(.Rush_Life,"DBGArena_Core")+" Lifes. If they hit \"0\" Team 2 wins!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
sleep 3000;
}
break;
case 5: // Capture the Flag
enablenpc "DBG_CTF_Flag";
enablenpc "Team 1 Flag#1";
enablenpc "Team 2 Flag#2";
movenpc "Team 1 Flag#1",.CTF1_x,.CTF1_y;
movenpc "Team 2 Flag#2",.CTF2_x,.CTF2_y;
set getvariableofnpc(.Flag1_Base,"Team 1 Flag#1"),1;
set getvariableofnpc(.Flag2_Base,"Team 2 Flag#2"),1;
// Effect for Flag Holder
set .f_effect,409; // Meteor Assault
set .f_effect_t,1500; // Timer in milliseconds, when the effect will shown again
if(!.NoAnno) {
mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": Each Team has a flag to protect while stealing the enemies flag!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
sleep 3000;
mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": The first team to bring the enemies flag to their own wins the round!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
sleep 3000;
}
break;
}
set .NoAnno,0;
mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": The Match will start in 1 Minute!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
sleep 50000; // 50 sec
mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": 10 Seconds left, you can now move and buff your members!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
donpcevent "DBGArena_Core::OnBGPlayerBlock";
donpcevent "#DBG_Heal::OnEnable";
sleep 10000; // 10 sec
mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": The Match starts now! Good luck to both Teams!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
donpcevent "DBGArena_Core::OnBGArenaTimer"; // Start the Timer in DBGArena_Core for Time Limit
if($@DBG_Status == 3) // Start flag timer for Domination
initnpctimer;
else if($@DBG_Status == 4) // Spawn Crystal for Rush
bg_monster $@DBG_T2,$@DBG_Map$[$@DBG_Status],.mob[0],.mob[1],"Defend Crystal",1914,strnpcinfo(0)+"::OnRushMobDeath";
end;
// Round Reset - Basically only for S&D / Rush / CTF
OnRoundReset:
if($@DBG_Status == 2 && .SAD_Win > 0) {
set .@RS$,"SAD";
setd(".T"+.SAD_Win+"_Score"),getd(".T"+.SAD_Win+"_Score") + 1;
mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": [Team "+.SAD_Win+"] has scored 1 Point!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
set .SAD_Win,0;
} else if($@DBG_Status == 4 && .Rush_Win > 0) {
set .@RS$,"Rush";
setd(".T"+.Rush_Win+"_Score"),getd(".T"+.Rush_Win+"_Score") + 1;
mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": [Team "+.Rush_Win+"] has scored 1 Point!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
set .Rush_Win,0;
} else if($@DBG_Status == 5 && .CTF_Win > 0) {
set .@RS$,"CTF";
setd(".T"+.CTF_Win+"_Score"),getd(".T"+.CTF_Win+"_Score") + 1;
mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": [Team "+.CTF_Win+"] has scored 1 Point!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
set .CTF_Win,0;
}
sleep 2000;
donpcevent strnpcinfo(0)+"::OnBGDisable";
donpcevent strnpcinfo(0)+"::OnBGRoundScore";
set .rounds,.rounds + 1;
mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": Round "+.rounds+" has finished!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
sleep 2000;
if(.rounds < getd("."+.@RS$+"_RoundSwap")) {
mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": Starting Round "+(.rounds+1)+" in a few seconds!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
set getvariableofnpc(.DBG_Reset,"DBGArena_Core"),1;
set .NoAnno,1; // To prevent repeating the Announcements in the next round
donpcevent "DBGArena_Core::OnBGArenaReset";
} else {
if(.T1_Score > .T2_Score)
set $@DBG_T1Score,$@DBG_T1Score + 1;
else if(.T2_Score > .T1_Score)
set $@DBG_T2Score,$@DBG_T2Score + 1;
set .T1_Score,0;
set .T2_Score,0;
if(.Team_Swapped) {
donpcevent strnpcinfo(0)+"::OnBGRoundScore";
donpcevent "DBGArena_Core::OnBGArenaScore";
set .Team_Swapped,0;
end;
}
mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": End of the match! Switching Teams....",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
sleep 2000;
set .rounds,0;
// Swapping Teams
set .@T1,$@DBG_T2;
set .@T2,$@DBG_T1;
set $@DBG_T1,.@T1;
set $@DBG_T2,.@T2;
set .Team_Swapped,1;
// Reseting Round
set getvariableofnpc(.DBG_Reset,"DBGArena_Core"),1;
donpcevent "DBGArena_Core::OnBGArenaReset";
}
end;
// Battleground Arena - Update Score
OnBGRoundScore:
bg_updatescore $@DBG_Map$[$@DBG_Status],.T1_Score,.T2_Score;
end;
// Domination - Flag Timer
OnTimer5000: // Every 5th second
stopnpctimer;
if(($@DBG_T1Score + .flags_pts[$@DBG_Flag_CT1]) < 100)
set $@DBG_T1Score,$@DBG_T1Score + .flags_pts[$@DBG_Flag_CT1];
else
set $@DBG_T1Score,100;
if(($@DBG_T2Score + .flags_pts[$@DBG_Flag_CT2]) < 100)
set $@DBG_T2Score,$@DBG_T2Score + .flags_pts[$@DBG_Flag_CT2];
else
set $@DBG_T2Score,100;
donpcevent "DBGArena_Core::OnBGArenaScore";
initnpctimer;
end;
// Rush - Crystal Death Event
OnRushMobDeath:
mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": [Team 1] has destroyed the Crystal!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
set .Rush_Win,1;
donpcevent strnpcinfo(0)+"::OnRoundReset";
end;
OnFlagMark:
deltimer strnpcinfo(0)+"::OnFlagMark";
if(!@Has_Flag) end;
specialeffect2 .f_effect;
addtimer .f_effect_t,strnpcinfo(0)+"::OnFlagMark";
end;
OnBGDisable:
switch($@DBG_Status) {
default: break;
case 2: // Search and Destroy
stopnpctimer "DBG_Target";
stopnpctimer "Target A#1";
stopnpctimer "Target B#2";
movenpc "Bomb#SAD",.SAD_x,.SAD_y;
disablenpc "DBG_Target";
disablenpc "Target A#1";
disablenpc "Target B#2";
disablenpc "Bomb#SAD";
break;
case 3: // Domination
stopnpctimer;
disablenpc "DBG_DOM_Flag";
disablenpc "Flag A#1";
disablenpc "Flag B#2";
disablenpc "Flag C#3";
break;
case 5: // Capture the Flag
movenpc "Team 1 Flag#1",.CTF1_x,.CTF1_y;
movenpc "Team 2 Flag#2",.CTF2_x,.CTF2_y;
disablenpc "DBG_CTF_Flag";
disablenpc "Team 1 Flag#1";
disablenpc "Team 2 Flag#2";
break;
}
donpcevent "#DBG_Heal::OnDisable";
killmonsterall $@DBG_Map$[$@DBG_Status];
end;
OnInit:
// ======= Search and Destroy =====
// Saving original coordiantes of the bomb
getmapxy(.@map$,.SAD_x,.SAD_y,BL_NPC,"Bomb#SAD");
// How many rounds until the teams are swapped?
// Note: First round has the value 0
set .SAD_RoundSwap,2;
// ======= Domination =====
// Flag Settings - Points
// Default: [ ] = Flag Count
// [0] = 0 Flags > 0 Pts (Obviously)
// [1] = 1 Flag > 1 Pt
// [2] = 2 Flags > 3 Pts
// [3] = 3 Flags > 5 Pts
setarray .flags_pts[0],0,1,3,5;
// ======= Rush =====
// How many rounds until the teams are swapped?
// Note: First round has the value 0
set .Rush_RoundSwap,2;
// Mob Coordinates of Defender Team (Team 2)
setarray .mob[0],328,150;
// ======= Rush =====
// Saving original coordiantes of the flags
getmapxy(.@map$,.CTF1_x,.CTF1_y,BL_NPC,"Team 1 Flag#1");
getmapxy(.@map$,.CTF2_x,.CTF2_y,BL_NPC,"Team 2 Flag#2");
// How many rounds until the teams are swapped?
// Note: First round has the value 0
set .CTF_RoundSwap,2;
end;
}
// Search and Destroy - Target NPC's
- script DBG_Target -1,{
if(getd(".Bomb_Active_T"+strnpcinfo(2)) && @DBG_Team == 2) {
progressbar "",.defuse;
if(!playerattached()) end; // Check if the player is still attached, like got killed
stopnpctimer strnpcinfo(0);
mapannounce strnpcinfo(4),"Search & Destroy: Team 2 has succesfully defused the bomb at "+strnpcinfo(1)+".",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
setd(".Bomb_Active_T"+strnpcinfo(2)),0;
setd(".b_T"+strnpcinfo(2)),0;
set getvariableofnpc(.SAD_Win,"DBG_Init"),2;
donpcevent "DBG_Init::OnRoundReset";
} else if(!getd(".Bomb_Active_T"+strnpcinfo(2)) && @DBG_Team == 1) { // Check if Attacker
if(!@Has_Bomb)
message strcharinfo(0),"You need to the bomb to destroy this target.";
else if(getd(".Planting_"+strnpcinfo(2)) == 0) {
addtimer 1000,strnpcinfo(0)+"::OnBombPlant";
getmapxy(.@map$,@x,@y,BL_PC);
setd(".Planting_"+strnpcinfo(2)),1;
}
}
end;
OnBombPlant:
deltimer strnpcinfo(0)+"::OnBombPlant";
getmapxy(.@map$,.@x,.@y,BL_PC);
if(.@x != @x && .@y != @y) {
message strcharinfo(0),"Search & Destroy: You are not allowed to move!";
set .plant_t,0;
setd(".Planting_"+strnpcinfo(2)),0;
set @x,0;
set @y,0;
end;
}
if(.plant_t < .plant) {
addtimer 1000,strnpcinfo(0)+"::OnBombPlant";
npctalk "Planting complete in "+(.plant-.plant_t)+" seconds.",strnpcinfo(0);
set .plant_t,.plant_t + 1;
end;
}
set @x,0;
set @y,0;
mapannounce strnpcinfo(4),"Search & Destroy: Team 1 has planted the Bomb at "+strnpcinfo(1)+". "+.bomb+" seconds unil it explodes!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
setd(".Bomb_Active_T"+strnpcinfo(2)),1;
set @Has_Bomb,0;
set .plant_t,0;
setd(".Planting_"+strnpcinfo(2)),0;
initnpctimer strnpcinfo(0);
end;
OnTimer1000:
stopnpctimer strnpcinfo(0);
setd(".b_T"+strnpcinfo(2)),getd(".b_T"+strnpcinfo(2)) + 1;
npctalk "Time left until explosion: "+(.bomb-getd(".b_T"+strnpcinfo(2)))+" seconds",strnpcinfo(0);
misceffect 54;
initnpctimer strnpcinfo(0);
if(getd(".b_T"+strnpcinfo(2)) < .bomb || getd(".Bomb_Active_T"+strnpcinfo(2)) == 0) end;
stopnpctimer strnpcinfo(0);
setd(".Bomb_Active_T"+strnpcinfo(2)),0;
specialeffect .explode;
set getvariableofnpc(.SAD_Win,"DBG_Init"),1;
donpcevent "DBG_Init::OnRoundReset";
end;
OnInit:
set .bomb,20; // Time until bomb explodes in seconds
set .plant,5; // Required time to plant the bomb in seconds
set .defuse,8; // Time to defuse the bomb
set .explode,730; // Effect ID for explosion
disablenpc strnpcinfo(0);
end;
}
dbg_arena,199,191,4 duplicate(DBG_Target) Target A#1 1914
dbg_arena,199,106,4 duplicate(DBG_Target) Target B#2 1915
// Search & Destroy - Bomb
dbg_arena,97,78,4 script Bomb#SAD 1904,{
if(@DBG_Team != 1) end;
set @Has_Bomb,1;
npctalk "["+strcharinfo(0)+"] has picked up the Bomb.",strnpcinfo(0),bc_area;
sleep 500;
disablenpc strnpcinfo(0);
end;
OnInit:
set .npc$,strnpcinfo(0);
disablenpc .npc$;
end;
}
// Domination - Flag Template
- script DBG_DOM_Flag -1,{
end;
OnTouch:
if(getd(".Flag"+strnpcinfo(2)+"_Group") == @DBG_Team) end; // Team x owns this Flag, end
if(getd(".TakeOver_F"+strnpcinfo(2))) end; // TakeOver is in progress
setd(".TakeOver_F"+strnpcinfo(2)),1;
mapannounce strnpcinfo(4),"Domination: ["+strnpcinfo(1)+"] is being taken....",bc_area,$@DBG_Anno$[$@DBG_Status];
while( .@t < .flag_timer) {
misceffect (766-.@t);
set .@t,.@t + 1;
sleep 1000;
}
setd(".TakeOver_F"+strnpcinfo(2)),0;
getmapxy(.@map$,.@flag_x,.@flag_y,BL_NPC);
set .@F_T1,bg_getareausers($@DBG_T1,strnpcinfo(4),(.@flag_x-3),(.@flag_y-3),(.@flag_x+3),(.@flag_y+3));
set .@F_T2,bg_getareausers($@DBG_T2,strnpcinfo(4),(.@flag_x-3),(.@flag_y-3),(.@flag_x+3),(.@flag_y+3));
if(!getd(".Flag"+strnpcinfo(2)+"_Group")) { // Neutral Flag
if(.@F_T1 > .@F_T2) {
set $@DBG_Flag_CT1,$@DBG_Flag_CT1 + 1;
setd(".Flag"+strnpcinfo(2)+"_Group"),1;
} else if(.@F_T2 > .@F_T1) {
set $@DBG_Flag_CT2,$@DBG_Flag_CT2 + 1;
setd(".Flag"+strnpcinfo(2)+"_Group"),2;
} else {
npctalk strnpcinfo(1)+": There are equal amount of players, therefore no one can take the flag!";
end;
}
} else if(getd(".Flag"+strnpcinfo(2)+"_Group") == 1) { // Team 1 has flag
if(.@F_T1 < .@F_T2) {
set $@DBG_Flag_CT1,$@DBG_Flag_CT1 - 1;
set $@DBG_Flag_CT2,$@DBG_Flag_CT2 + 1;
setd(".Flag"+strnpcinfo(2)+"_Group"),2;
} else {
npctalk strnpcinfo(1)+": There are equal amount or Team 1 has more players, therefore Team 1 keeps the flag!";
end;
}
} else if(getd(".Flag"+strnpcinfo(2)+"_Group") == 2) { // Team 2 has flag
if(.@F_T2 < .@F_T1) {
set $@DBG_Flag_CT1,$@DBG_Flag_CT1 + 1;
set $@DBG_Flag_CT2,$@DBG_Flag_CT2 - 1;
setd(".Flag"+strnpcinfo(2)+"_Group"),1;
} else {
npctalk strnpcinfo(1)+": There are equal amount or Team 2 has more players, therefore Team 2 keeps the flag!";
end;
}
}
setnpcdisplay(strnpcinfo(0),strnpcinfo(0),getd(".T"+getd(".Flag"+strnpcinfo(2)+"_Group")+"_FlagID"));
mapannounce strnpcinfo(4),"Domination: ["+strnpcinfo(1)+"] has been taken by Team "+getd(".Flag"+strnpcinfo(2)+"_Group")+"!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
delwaitingroom;
OnDisplayBox:
waitingroom strnpcinfo(1)+" - "+( (getd(".Flag"+strnpcinfo(2)+"_Group") == 0)?"[Neutral]":"[Team "+getd(".Flag"+strnpcinfo(2)+"_Group")+"]"),0;
end;
OnInit:
set .T1_FlagID,1912; // ID to display when Team 1 has taken the Flag
set .T2_FlagID,1913; // ID to display when Team 2 has taken the Flag
set .flag_timer,10; // Timer to take an flag in seconds
disablenpc strnpcinfo(0);
end;
}
// Flags duplicates to be taken
dbg_dom,209,291,4 duplicate(DBG_DOM_Flag) Flag A#1 1911,3,3
dbg_dom,274,204,4 duplicate(DBG_DOM_Flag) Flag B#2 1911,3,3
dbg_dom,267,131,4 duplicate(DBG_DOM_Flag) Flag C#3 1911,3,3
// Capture the Flag - Flag NPC's
- script DBG_CTF_Flag -1,{
if(getd(".Flag"+strnpcinfo(2)+"_Base")) { // Is the flag at base?
if(@DBG_Team == atoi(strnpcinfo(2)) && (@Has_Flag > 0 && @Has_Flag != @DBG_Team) ) {
mapannounce strnpcinfo(4),"Capture the Flag: Team "+@DBG_Team+" has succesfully conquered the enemies Flag!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
set getvariableofnpc(.CTF_Win,"DBG_Init"),@DBG_Team;
set @Has_Flag,0;
donpcevent "DBG_Init::OnRoundReset";
} else if(@DBG_Team != atoi(strnpcinfo(2))) {
disablenpc strnpcinfo(0);
setd(".Flag"+strnpcinfo(2)+"_Base"),0;
set @Has_Flag,atoi(strnpcinfo(2));
mapannounce strnpcinfo(4),"Capture the Flag: The Flag of Team "+strnpcinfo(2)+" has been taken by ["+strcharinfo(0)+"]!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
addtimer 5000,"DBG_Init::OnFlagMark";
}
} else if(!getd(".Flag"+strnpcinfo(2)+"_Base")) { // Has the flag been dropped?
if(@DBG_Team == atoi(strnpcinfo(2))) { // Is the player in the same team as the Flag belongs to?
movenpc strnpcinfo(0),getd(".CTF"+strnpcinfo(2)+"_x"),getd(".CTF"+strnpcinfo(2)+"_y");
setd(".Flag"+strnpcinfo(2)+"_Base"),1;
mapannounce strnpcinfo(4),"Capture the Flag: The Flag of Team "+@DBG_Team+" has been saved by ["+strcharinfo(0)+"]!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
} else {
disablenpc strnpcinfo(0);
set @Has_Flag,atoi(strnpcinfo(2));
specialeffect2 getvariableofnpc(.f_effect,"DBG_Init");
addtimer getvariableofnpc(.f_effect_t,"DBG_Init"),"DBG_Init::OnFlagMark";
mapannounce strnpcinfo(4),"Capture the Flag: The Flag of Team "+strnpcinfo(2)+" has been taken by ["+strcharinfo(0)+"]!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
}
}
end;
OnInit:
// Saving original coordiantes and Names of the flags
if(strnpcinfo(2) != "") {
getmapxy(.@map$,getd(".CTF"+strnpcinfo(2)+"_x"),getd(".CTF"+strnpcinfo(2)+"_y"),BL_NPC);
setd(".npc_F"+strnpcinfo(2)+"$"),strnpcinfo(0);
}
disablenpc strnpcinfo(0);
end;
}
dbg_arena,62,150,4 duplicate(DBG_CTF_Flag) Team 1 Flag#1 1912
dbg_arena,328,150,4 duplicate(DBG_CTF_Flag) Team 2 Flag#2 1913
prontera,147,175,4 script Battleground Arena 100,{
mes .n$;
mes "Welcome, "+strcharinfo(0)+"!";
mes "How can I help you?";
next;
switch(select("- Start Arena:- Information:- Shop:- Leave")) {
case 1:
mes .n$;
if($@DBG_Status) {
mes "The Battleground Arena is currently active.";
mes "Use \"@joinbgarena\" to join.";
close;
}
if(.DBG_WoE && (agitcheck() || agitcheck2() || agitcheck3())) {
mes "Currently the War of Emperium is active, therefore I can't start the Arena!";
close;
}
mes "Which Game Mode do you want to play?";
next;
for ( set .@g,1; .@g < getarraysize($@DBG_Mode$); set .@g,.@g + 1)
set .@gm_menu$,.@gm_menu$ + "- "+$@DBG_Mode$[.@g]+ ( ($@DBG_Mode$[.@g+1] != "")?":":"");
set .@gm,select(.@gm_menu$);
mes .n$;
mes $@DBG_Mode$[.@gm]+", it is?";
if(select("- Yes:- No") - 1) close;
next;
mes .n$;
mes "Okay, here we go.";
set $@DBG_Status,.@gm;
close2;
announce "An warrior is calling out for others to participate in the Battleground Arena.",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status];
sleep 3000;
donpcevent "DBGArena_Core::OnBGArenaInit";
end;
case 2:
mes .n$;
mes "About what do you want to learn more?";
next;
switch(select("- Join Arena:- Game Modes:- Happy Hour:- Custom Commands:- Rewards:- Nevermind")) {
case 1: // Join Arena
mes .n$;
mes "Every Warrior can start the Battleground Arena by selecting the Game Mode,";
mes (getvariableofnpc(.DBG_WoE,"DBGArena_Core") == 0?"even":"but not")+" when WoE is active.";
mes "As soon it starts you will see the announcement.";
break;
// Games Modes
case 2:
mes .n$;
mes "There are a total of "+(getarraysize($@DBG_Mode$) - 1)+" Game Modes.";
mes "About which Game Mode do you want to know more?";
next;
switch(select("- Team Deathmatch:- Search & Destroy:- Domination:- Rush:- Capture the Flag")) {
case 1: // TDM
mes .n$;
mes "Team Deathmatch consists only of battling the other Team.";
mes "The goal is to defeat more enemies than the other team until either the time limit or the required points have been reached.";
break;
case 2: // S&D
mes .n$;
mes "Search & Destroy consists of destroying 1 of 2 Targets.";
mes "Team 1 has access to the bomb while Team 2 has to defend the targets.";
break;
case 3: // Domination
mes .n$;
mes "Domination consists of taking flags. There are a total of 3 flags to take.";
mes "Each flag gives points every 5 seconds, the more flags are taken by an team the more points they will recieve.";
break;
case 4: // Rush
mes .n$;
mes "Rush consists of destroying an Crystal.";
mes "Team 1 are the attackers and have limited lifes, while Team 2 has to defend the crystal until either the Time Limit or the attackers are out of lifes.";
break;
case 5: // CTF
mes .n$;
mes "Capture the Flag consists of taking the enemies flag and bring it to the own flag.";
mes "If the own flag was taken, you have to take it back to score.";
break;
}
next;
mes .n$;
switch(@menu) {
default:
mes "Time Limit per Match is: "+getvariableofnpc(.DBG_TLimit[@menu],"DBGArena_Core")+" "+ ( (getvariableofnpc(.DBG_TLimit[@menu],"DBGArena_Core") > 1)?"Minutes":"Minute");
mes "The required Points to win is: "+getvariableofnpc(.DBG_MPTS[@menu],"DBGArena_Core");
break;
case 2:
case 4:
case 5:
mes "There are multiply rounds per match and the Time Limit per round is:";
mes getvariableofnpc(.DBG_TLimit[@menu],"DBGArena_Core")+" "+ ( (getvariableofnpc(.DBG_TLimit[@menu],"DBGArena_Core") > 1)?"Minutes":"Minute");
mes "After each round, the match will restart until a certain amount of rounds have passed, then the teams will be swapped and the team which scores the most in these rounds, scores 1 total point.";
mes "The required Points to win is: "+getvariableofnpc(.DBG_MPTS[@menu],"DBGArena_Core");
break;
}
break;
// Happy Hour
case 3:
mes .n$;
mes "During the day it can happen that \"Happy Hour\" will start.";
mes "This means that the reward will be increased for this very hour.";
break;
// Custom Commands
case 4:
mes .n$;
mes "There are following commands for the Battleground Arena:";
mes " > @bgarenainfo = Display the Score and Time left";
mes " > @joinbgarena = Joins the Battleground Arena";
mes " > @leavebgarena = Leaves the Battleground Arena";
if(getgroupid()) {
mes " ";
mes " For GM's exists:";
mes " > @startbgarena = Start the Battleground Arena";
mes " > @endbgarena = Ends the Battleground Arena";
}
break;
// Rewards
case 5:
mes .n$;
mes "There are 4 different rewards awaiting you after each match.";
mes "The reward amount itself depends on the Game Mode tho.";
mes " ";
mes " > Arena Points (for the Arena Shop)";
mes " > Valor Badges";
mes " > War Badges";
mes " > Bravery Badges";
break;
// Nevermind
case 6:
break;
}
break;
case 3:
mes .n$;
mes "I will now open the Battleground Arena Shop!";
mes "You have currently "+BGArenaPts+" Arena Points!";
mes "Note: The Discount Skill won't work on me!";
close2;
callshop "DBG_Shop",1;
npcshopattach "DBG_Shop";
end;
case 4:
break;
}
close;
OnBuyItem:
for ( set .@b,0; .@b < getarraysize(@bought_nameid); set .@b,.@b + 1)
for ( set .@s,0; .@s < getarraysize(.bg_shop); set .@s,.@s + 2)
if(@bought_nameid[.@b] == .bg_shop[.@s]) {
if(checkweight(@bought_nameid[.@b],@bought_nameid[.@b]) == 0) {
npctalk "Battleground Shop: You can't buy this many items, you would be overweight!!",strnpcinfo(0),bc_self;
end;
}
set .@total,.@total + (.bg_shop[.@s+1]*@bought_quantity[.@b]);
}
if(.@total > BGArenaPts) {
npctalk "Battleground Shop: I'm sorry, but you don't have the required Arena Points. You are missing "+(.@total-BGArenaPts)+" Points.",strnpcinfo(0),bc_self;;
end;
}
for ( set .@i,0; .@i < getarraysize(@bought_nameid); set .@i,.@i + 1)
getitem @bought_nameid[.@i],@bought_quantity[.@i];
set BGArenaPts,BGArenaPts - .@total;
dispbottom "Battleground Shop: You have paied "+.@total+" Arena Points.";
end;
OnInit:
set .n$,"["+strnpcinfo(0)+"]";
// Item ID,Price
setarray .bg_shop[0],12020,2, // [0] == Cursed Water
12028,2, // [1] == Box of Thunder
12029,2, // [2] == Box of Gloom
12030,2, // [3] == Box of Resentment
12031,2, // [4] == Box of Drowsiness
12032,2, // [5] == Box of Stroms
12033,2, // [6] == Box of Sunlight
12034,2, // [7] == Box of Panting
12108,5, // [8] == Scroll Package
12215,5, // [9] == LV 10 Blessing Scroll
12216,5, // [10] == LV 10 Agi Scroll
12217,5, // [11] == LV 5 Aspersio Scroll
12218,5, // [12] == LV 5 Assumptio Scroll
12219,5, // [13] == LV 10 Wind Walker Scroll
12075,10, // [14] == Steamed Tongue
12080,10, // [15] == Dragon Breath Cocktail
12085,10, // [16] == Immortal Stew
12090,10, // [17] == Steamed Desert Scorpions
12095,10, // [18] == Hwergelmir's Tonic
12100,10, // [19] == Cooked Nice Tail's Tails
12114,4, // [20] == Elemental Converter[Fire]
12115,4, // [21] == Elemental Converter[Water]
12116,4, // [22] == Elemental Converter[Earth]
12117,4, // [23] == Elemental Converter[Wind]
12118,3, // [24] == Fireproof Potion
12119,3, // [25] == Coldproof Potion
12120,3, // [26] == Earthproof Potion
12121,3, // [27] == Thunderproof Potion
13543,10, // [28] == Chemical Protection Helm Scroll Box
13544,10, // [29] == Chemical Protection Shield Scroll Box
13545,10, // [30] == Chemical Protection Armor Scroll Box
13546,10, // [31] == Chemical Protection Weapon Scroll Box
7139,1, // [32] == Glistening Coat
13547,10, // [33] == Repair Weapon Scroll Box
14593,5; // [34] == Mystical Amplification Scroll
npcshopdelitem "DBG_Shop",501;
for ( set .@s,0; .@s < getarraysize(.bg_shop); set .@s,.@s + 2)
npcshopadditem "DBG_Shop",.bg_shop[.@s],.bg_shop[.@s+1];
end;
}
- pointshop DBG_Shop -1,BGArenaPts,501:-1
// Base Flags - Only to display the Team's Flag
// Template for saving lines only
- script DBG_BaseFlag -1,{
end;
}
// Team 1 Base Flags on dbg_arena
dbg_arena,80,81,4 duplicate(DBG_BaseFlag) Team 1 Base#arena1 1912
dbg_arena,95,81,4 duplicate(DBG_BaseFlag) Team 1 Base#arena2 1912
dbg_arena,95,68,4 duplicate(DBG_BaseFlag) Team 1 Base#arena3 1912
dbg_arena,80,68,4 duplicate(DBG_BaseFlag) Team 1 Base#arena4 1912
// Team 2 Base Flags on dbg_arena
dbg_arena,304,230,4 duplicate(DBG_BaseFlag) Team 2 Base#arena1 1913
dbg_arena,318,230,4 duplicate(DBG_BaseFlag) Team 2 Base#arena2 1913
dbg_arena,318,218,4 duplicate(DBG_BaseFlag) Team 2 Base#arena3 1913
dbg_arena,304,218,4 duplicate(DBG_BaseFlag) Team 2 Base#arena4 1913
// Mapflags
// Battleground Arena
dbg_arena mapflag nosave
dbg_arena mapflag noteleport
dbg_arena mapflag nomemo
dbg_arena mapflag nowarp
dbg_arena mapflag nowarpto
dbg_arena mapflag noreturn
dbg_arena mapflag nogo
dbg_arena mapflag nodrop
dbg_arena mapflag nobranch
dbg_arena mapflag nopenalty
dbg_arena mapflag nozenypenalty
dbg_arena mapflag novending
dbg_arena mapflag nochat
dbg_arena mapflag nightenabled
dbg_arena mapflag battleground 2
// Battleground Arena - Domination
dbg_dom mapflag nosave
dbg_dom mapflag noteleport
dbg_dom mapflag nomemo
dbg_dom mapflag nowarp
dbg_dom mapflag nowarpto
dbg_dom mapflag noreturn
dbg_dom mapflag nogo
dbg_dom mapflag nodrop
dbg_dom mapflag nobranch
dbg_dom mapflag nopenalty
dbg_dom mapflag nozenypenalty
dbg_dom mapflag novending
dbg_dom mapflag nochat
dbg_dom mapflag nightenabled
dbg_dom mapflag battleground 2
Question
celeron0134
//===== rAthena Script ======================================= //= Dynamic Battleground Arena //===== By =================================================== //= llchrisll //===== Version ============================================== //= 1.0 - Initial Version //===== Tested With ========================================== //= rAthena 06/29/2019 Revision //= GIT Hash: c1975d7ea3729c1f5deec2e0dcf04841c4b96969 //===== Description ========================================== //= This battleground arena can be configured however you like. // You could compare it with an Call of Duty game. // Which consists of Domination, Capture the Flag and so on //= The config is per Game Mode dynamically changeable. //= Using extra Maps so it won't collide with other Battlegrounds // Copied the bat_a01 and bat_b01 map //===== Comments ============================================= //= You need the following file: Battleground_Arena.rar // Inside the GRF you find instructions how to install the maps: // dbg_readme.txt //===== ToDO ================================================= //= Capture the Flag: Change effect for Flag Holder to a better one! //============================================================ - script DBGArena_Core -1,{ OnInit: // BG Modes setarray $@DBG_Mode$[1],"Team Deathmatch","Search & Destroy","Domination","Rush","Capture the Flag"; // BG Maps for each Mode // Note: [0] = is to prevent errors when $@DBG_Status is reseted by Arena Ending mid-way like by a player leaving setarray $@DBG_Map$[0],"dbg_arena","dbg_arena","dbg_arena","dbg_dom","dbg_arena","dbg_arena"; // BG Announce Colors per Mode setarray $@DBG_Anno$[1],"0x8CFFFB","0xA4CC2D","0xEAC2EB","0xB97A56","0xEB1E33"; // BG Announce Type // How will the Announces be displayed to the players: // Recommended Values: // - bc_all: Global // - bc_woe: Displayed as WoE Information, which can be turned off set $@DBG_Anno_T,bc_woe; // BG Team Spawn Coordinates per Mode setarray .team1_x[1],87,87,349,87,87; setarray .team1_y[1],75,75,311,75,75; setarray .team2_x[1],312,312,350,312,312; setarray .team2_y[1],225,225,91,225,225; // Min Players to start an match per Mode setarray .DBG_PlayersMin[1],2,2,2,2,2; // Max Players per Team per Mode setarray .DBG_PlayersMax[1],10,10,20,10,10; // Time Limit until match ends per Mode in minutes setarray .DBG_TLimit[1],10,10,10,10,10; // Max Points to end the match per Mode // Note: Client can only display up to 100 points setarray .DBG_MPTS[1],75,2,100,2,3; // Battleground Join Timer in minutes set .BG_JoinTime,3; // WoE Restriction // 0 = Ignore WoE Status // 1 = When WoE is active, no BG set .DBG_WoE,1; // Battleground Happy Hour // For the actual Happy Hour time look for "OnClock" // 0 = Disable // 1 = Enable set .DBG_HH,1; // Don't touch this value below, to adjust the rate itself go to "OnClock2000:" set .DBG_HH_Rate,1; // Custom Commands bindatcmd "joinbgarena",strnpcinfo(0)+"::OnBGJoin"; bindatcmd "leavebgarena",strnpcinfo(0)+"::OnBGLeave"; bindatcmd "bgarenainfo",strnpcinfo(0)+"::OnBGInfo"; // Custom GM Commands to start or end the BG Arena manually bindatcmd "startbgarena",strnpcinfo(0)+"::OnBGArenaInit",99,99; bindatcmd "endbgarena",strnpcinfo(0)+"::OnBGArenaEnd",99,99; // Load Reward Function function DBG_Reward; end; // Happy Hour Starting Time OnClock2000: if(!.DBG_HH || .DBG_WoE && (agitcheck() || agitcheck2() || agitcheck3())) end; set .DBG_HH_Rate,2; // Happy Hour Rate announce "Battleground Arena: Battleground Happy Hour has started. Rewards will be x"+.DBG_HH_Rate+" for the next hour!",bc_all; end; // Happy Hour Ending Time OnClock2100: if(!.DBG_HH) end; announce "Battleground Arena: Battleground Happy Hour has ended!",bc_all; set .DBG_HH_Rate,1; // Reset to normal reward end; // Starting Battleground Arena OnBGArenaInit: // Check if players are still on the map if(getmapusers("dbg_arena") > 0) mapwarp "dbg_arena","prontera",156,191; if(getmapusers("dbg_dom") > 0) mapwarp "dbg_dom","prontera",156,191; OnBGArenaPrepare: if(.DBG_Match) { donpcevent "DBGArena_Vote::OnBGVoteInit"; set .DBG_Match,0; end; } set $@DBG_T1Score,0; set $@DBG_T2Score,0; donpcevent strnpcinfo(0)+"::OnBGArenaScore"; set .DBG_Prepare,1; set .t,0; // Checking for exisiting battle groups if($@DBG_T1) { set .@bg_t1,bg_get_data($@DBG_T1,1); // Saving Player Amount of Team 1 copyarray .Team1[0],$@arenamembers[0],.@bg_t1; // and copy the Game IDs into the "join" array .Team1 bg_destroy $@DBG_T1; set $@DBG_T1,0; for ( set .@t,0; .@t < getarraysize(.Team1); set .@t,.@t + 1) if(attachrid(.Team1[.@t]) == 1) // Attach the current Game ID for getcharid() setarray .Team1[.@t],getcharid(3); // Overwrite the Game ID with the Account ID } if($@DBG_T2) { set .@bg_t2,bg_get_data($@DBG_T2,1); // Saving Player Amount of Team 2 copyarray .Team2[0],$@arenamembers[0],.@bg_t2; // and copy the Game IDs into the "join" array .Team2 bg_destroy $@DBG_T2; set $@DBG_T2,0; for ( set .@t,0; .@t < getarraysize(.Team2); set .@t,.@t + 1) if(attachrid(.Team2[.@t]) == 1) // Attach the current Game ID for getcharid() setarray .Team2[.@t],getcharid(3); // Overwrite the Game ID with the Account ID } if(!$@DBG_Status) { donpcevent "DBGArena_Vote::OnBGVoteInit"; end; } // Creating BG Group ID's set $@DBG_T1,bg_create($@DBG_Map$[$@DBG_Status],.team1_x[$@DBG_Status],.team1_y[$@DBG_Status],strnpcinfo(0)+"::OnBGLeave",strnpcinfo(0)+"::OnBGArenaDeath"); set $@DBG_T2,bg_create($@DBG_Map$[$@DBG_Status],.team2_x[$@DBG_Status],.team2_y[$@DBG_Status],strnpcinfo(0)+"::OnBGLeave",strnpcinfo(0)+"::OnBGArenaDeath"); sleep 2000; announce "Battleground Arena: You have "+.BG_JoinTime+" Minute"+( (.BG_JoinTime > 1)?"s":"")+" to join by using \"@joinbgarena\" - Mode: "+$@DBG_Mode$[$@DBG_Status],$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; // Check if there are existing players in the queue if(getarraysize(.Team1) > 0 || getarraysize(.Team2) > 0) announce "Battleground Arena: "+$@DBG_Mode$[$@DBG_Status]+" - Team 1: "+getarraysize(.Team1)+"/"+.DBG_PlayersMax[$@DBG_Status]+" : Team 2: "+getarraysize(.Team2)+"/"+.DBG_PlayersMax[$@DBG_Status],$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; set .BGJoin,1; sleep (.BG_JoinTime*60*1000); set .BGJoin,0; if( (getarraysize(.Team1) + getarraysize(.Team2) ) < .DBG_PlayersMin[$@DBG_Status]) { announce "Battleground Arena: Time is over! But there are not enough participants to start/continue the match!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; donpcevent strnpcinfo(0)+"::OnBGArenaEnd"; // End the whole Battleground end; } for ( set .@t,0; .@t < getarraysize(.Team1); set .@t,.@t + 1) if(isloggedin(.Team1[.@t])) { if(attachrid(.Team1[.@t]) == 0) continue; bg_join($@DBG_T1); detachrid; } for ( set .@t,0; .@t < getarraysize(.Team2); set .@t,.@t + 1) if(isloggedin(.Team2[.@t])) { if(attachrid(.Team2[.@t]) == 0) continue; bg_join($@DBG_T2); detachrid; } deletearray .Team1[0],getarraysize(.Team1); deletearray .Team2[0],getarraysize(.Team2); set .DBG_Prepare,0; OnBGArenaReset: // Next Round, mostly for S&D and CTF // Warp BG Groups on the field if(.DBG_Reset) { stopnpctimer; bg_warp $@DBG_T1,$@DBG_Map$[$@DBG_Status],.team1_x[$@DBG_Status],.team1_y[$@DBG_Status]; bg_warp $@DBG_T2,$@DBG_Map$[$@DBG_Status],.team2_x[$@DBG_Status],.team2_y[$@DBG_Status]; set .DBG_Reset,0; set .t,0; } set .@bg_pl,bg_get_data($@DBG_T1,1); for ( set .@p,0; .@p < .@bg_pl; set .@p,.@p + 1) { pcblockmove $@arenamembers[.@p],1; // Disable Movement pcblockskill $@arenamembers[.@p],1; // Disable Skills } set .@bg_pl,bg_get_data($@DBG_T2,1); for ( set .@p,0; .@p < .@bg_pl; set .@p,.@p + 1) { pcblockmove $@arenamembers[.@p],1; // Disable Movement pcblockskill $@arenamembers[.@p],1; // Disable Skills } donpcevent "DBG_Init::OnBGPrepare"; end; // Battleground Arena - Match Duration OnBGArenaTimer: set .DBG_Match,1; initnpctimer; end; OnTimer60000: // Every Minute stopnpctimer; set .t,.t + 1; // Increase Minute Counter if(.DBG_Match && .t < .DBG_TLimit[$@DBG_Status]) { mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+" - Time Limit: "+(.DBG_TLimit[$@DBG_Status] - .t)+" Minute"+ ( ((.DBG_TLimit[$@DBG_Status] - .t) > 1)?"s":"") +" left!",bc_all,$@DBG_Anno$[$@DBG_Status]; initnpctimer; // If an Match is active and timer has been reached } else if(.DBG_Match && .t == .DBG_TLimit[$@DBG_Status]) { mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": The Match is over! Time Limit has been reached!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; if($@DBG_Status != 1 || $@DBG_Status != 3) { // S&D + Rush + CTF has round based matches if($@DBG_Status == 2) // S&D: Declare Team 2 as winner set getvariableofnpc(.SAD_Win,"DBG_Init"),2; else if($@DBG_Status == 4) // Rush: Declare Team 2 as winner set getvariableofnpc(.Rush_Win,"DBG_Init"),2; donpcevent "DBG_Init::OnRoundReset"; } else donpcevent strnpcinfo(0)+"::OnBGMatchEnd"; } else if($@DBG_Status && !.DBG_Prepare) if(getmapusers($@DBG_Map$[$@DBG_Status]) < .DBG_PlayersMin[$@DBG_Status]) donpcevent strnpcinfo(0)+"::OnBGArenaEnd"; end; // Battleground Arena - Death Event OnBGArenaDeath: mapannounce $@DBG_Map$[$@DBG_Status],"["+rid2name(killerrid)+"] has killed ["+strcharinfo(0)+"]!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; switch($@DBG_Status) { default: break; case 1: // TDM if(@DBG_Team == 1) // Killed player is in Team 1, increase Team 2's Score set $@DBG_T2Score,$@DBG_T2Score + 1; else if(@DBG_Team == 2) // Killed player is in Team 2, increase Team 1's Score set $@DBG_T1Score,$@DBG_T1Score + 1; break; case 2: // Search & Destroy if(!@Has_Bomb) end; getmapxy(.@map$,.@bomb_x,.@bomb_y,BL_NPC); movenpc "Bomb#SAD",.@bomb_x,.@bomb_y; mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": The bomb has been dropped!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; set @Has_Bomb,0; enablenpc "Bomb#SAD"; set .@bg_pl,bg_get_data($@DBG_T1,1); copyarray .@bg_ids[getarraysize(.@bg_ids)],$@arenamembers[0],.@bg_pl; set .@bg_pl,bg_get_data($@DBG_T2,1); copyarray .@bg_ids[getarraysize(.@bg_ids)],$@arenamembers[0],.@bg_pl; for ( set .@p,0; .@p < getarraysize(.@bg_ids); set .@p,.@p + 1) if(attachrid(.@bg_ids[.@p])) viewpoint 0,.@bomb_x,.@bomb_y,3,0xFF0000; end; case 4: // Rush if(@DBG_Team == 1) // Player of Team 1 has been killed, decrease Team 1's Life Pool set .Rush_Life,.Rush_Life - 1; else if(@DBG_Team == 2) end; if(!.Rush_Life) { // Team 1's Lifes are 0, Team 2 wins the round mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": Team 1 has lost all of their lifes! Team 2 wins this round!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; set getvariableofnpc(.Rush_Win,"DBG_Init"),2; donpcevent "DBG_Init::OnRoundReset"; end; } mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": Team 2 has "+.Rush_Life+" lifes left!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; break; case 5: // Capture the Flag if(!@Has_Flag) end; getmapxy(.@map$,.@flag_x,.@flag_y,BL_NPC); set .@npc$,"Team "+@Has_Flag+" Flag#"+@Has_Flag; movenpc .@npc$,.@flag_x,.@flag_y; mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": The Flag of Team "+@DBG_Team+" has been dropped!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; set @Has_Flag,0; enablenpc .@npc$; set .@bg_pl,bg_get_data($@DBG_T1,1); copyarray .@bg_ids[getarraysize(.@bg_ids)],$@arenamembers[0],.@bg_pl; set .@bg_pl,bg_get_data($@DBG_T2,1); copyarray .@bg_ids[getarraysize(.@bg_ids)],$@arenamembers[0],.@bg_pl; for ( set .@p,0; .@p < getarraysize(.@bg_ids); set .@p,.@p + 1) if(attachrid(.@bg_ids[.@p])) viewpoint 0,.@flag_x,.@flag_y,3,0xFF0000; end; } donpcevent strnpcinfo(0)+"::OnBGArenaScore"; end; OnBGArenaScore: bg_updatescore $@DBG_Map$[$@DBG_Status],$@DBG_T1Score,$@DBG_T2Score; if($@DBG_T1Score >= .DBG_MPTS[$@DBG_Status] || $@DBG_T2Score >= .DBG_MPTS[$@DBG_Status] || .DBG_End) donpcevent strnpcinfo(0)+"::OnBGMatchEnd"; end; // Match ended = Give rewards OnBGMatchEnd: // .@rew_xxx[X]: Rewards of Winner/Loser // [0] = BGArenaPts // [1] = War Badges // [2] = Valor Badges // [3] = Bravery Badges // Note: If you add more rewards, you have to edit the DBG_Reward function too > .@rew_item[] stopnpctimer; set .t,0; switch($@DBG_Status) { case 0: debugmes "OnBGMatchEnd - $@DBG_Status = 0 > Error"; break; // Shouldn't happen case 1: // TDM setarray .@rew_win[0],10,5,5,5; setarray .@rew_lose[0],5,2,2,2; break; case 2: // Search & Destroy setarray .@rew_win[0],15,8,8,8; setarray .@rew_lose[0],7,4,4,4; break; case 3: // Domination setarray .@rew_win[0],20,10,10,10; setarray .@rew_lose[0],10,8,8,8; break; case 4: // Rush setarray .@rew_win[0],15,8,8,8; setarray .@rew_lose[0],7,4,4,4; break; case 5: // Capture the Flag setarray .@rew_win[0],15,8,8,8; setarray .@rew_lose[0],7,4,4,4; break; } donpcevent "DBG_Init::OnBGDisable"; // Disable NPC's // Decide Winners and reset score if($@DBG_T1Score < $@DBG_T2Score) { DBG_Reward($@DBG_T2,.DBG_HH_Rate,.@rew_win[0],.@rew_win[1],.@rew_win[2],.@rew_win[3]); DBG_Reward($@DBG_T1,.DBG_HH_Rate,.@rew_lose[0],.@rew_lose[1],.@rew_lose[2],.@rew_lose[3]); announce "Battleground Arena: Team 2 has won this match!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; } else if($@DBG_T2Score < $@DBG_T1Score) { DBG_Reward($@DBG_T1,.DBG_HH_Rate,.@rew_win[0],.@rew_win[1],.@rew_win[2],.@rew_win[3]); DBG_Reward($@DBG_T2,.DBG_HH_Rate,.@rew_lose[0],.@rew_lose[1],.@rew_lose[2],.@rew_lose[3]); announce "Battleground Arena: Team 1 has won this match!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; } else { DBG_Reward($@DBG_T1,.DBG_HH_Rate,.@rew_lose[0],.@rew_lose[1],.@rew_lose[2],.@rew_lose[3]); DBG_Reward($@DBG_T2,.DBG_HH_Rate,.@rew_lose[0],.@rew_lose[1],.@rew_lose[2],.@rew_lose[3]); announce "Battleground Arena: It's an draw ! Nobody has won this match!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; } mapwarp $@DBG_Map$[$@DBG_Status],"prontera",156,191; sleep 2500; // Let the players finish warping if(.DBG_End) donpcevent strnpcinfo(0)+"::OnBGArenaEnd"; else donpcevent strnpcinfo(0)+"::OnBGArenaPrepare"; end; // Battleground Arena - Arena ended OnBGArenaEnd: if(!$@DBG_Status || !.DBG_Match) end; donpcevent "DBG_Init::OnBGDisable"; mapwarp $@DBG_Map$[$@DBG_Status],"prontera",156,191; deletearray .Team1[0],getarraysize(.Team1); deletearray .Team2[0],getarraysize(.Team2); if($@DBG_T1) { set .@bg_t,bg_get_data($@DBG_T1,1); // Saving Player Amount of Team 1 bg_destroy $@DBG_T1; set $@DBG_T1,0; for ( set .@t,0; .@t < .@bg_t; set .@t,.@t + 1) if(isloggedin($@arenamembers[.@t]) == 1 && attachrid($@arenamembers[.@t]) == 1) { bg_leave; set @DBG_Team,0; pcblockmove getcharid(3),0; pcblockskill getcharid(3),0; detachrid; } } if($@DBG_T2) { set .@bg_t,bg_get_data($@DBG_T2,1); // Saving Player Amount of Team 2 bg_destroy $@DBG_T2; set $@DBG_T2,0; for ( set .@t,0; .@t < .@bg_t; set .@t,.@t + 1) if(isloggedin($@arenamembers[.@t]) == 1 && attachrid($@arenamembers[.@t]) == 1) { bg_leave; set @DBG_Team,0; pcblockmove getcharid(3),0; pcblockskill getcharid(3),0; detachrid; } } set $@DBG_Status,0; set .DBG_Match,0; set .DBG_Prepare,0; set .DBG_Reset,0; set .DBG_End,0; set .BGJoin,0; announce "[Server]: Battleground Arena has ended! Good luck next time!",$@DBG_Anno_T; end; // Battleground Arena - @joinbgarena command OnBGJoin: if(!.BGJoin) { message strcharinfo(0),"Battleground Arena: Joining the Arena is currently not possible."; end; } if(@DBG_Team) { message strcharinfo(0),"Battleground Arena: You are already registered for the Arena."; end; } if(getarraysize(.Team1) <= getarraysize(.Team2) && getarraysize(.Team1) < .DBG_PlayersMax[$@DBG_Status]) { setarray .Team1[getarraysize(.Team1)],getcharid(3); set @DBG_Team,1; } else if(getarraysize(.Team2) <= getarraysize(.Team1) && getarraysize(.Team2) < .DBG_PlayersMax[$@DBG_Status]) { setarray .Team2[getarraysize(.Team2)],getcharid(3); set @DBG_Team,2; } else { message strcharinfo(0),"Battleground Arena: I'm sorry, but every Team is full already. Please try again later."; end; } announce "Battleground Arena: "+$@DBG_Mode$[$@DBG_Status]+" - Team 1: "+getarraysize(.Team1)+"/"+.DBG_PlayersMax[$@DBG_Status]+" : Team 2: "+getarraysize(.Team2)+"/"+.DBG_PlayersMax[$@DBG_Status],$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; end; // Battleground Arena - @leavebgarena command & Quit Event OnBGLeave: if(!$@DBG_Status || !@DBG_Team) { message strcharinfo(0),"Battleground Arena: From what are you running away? You didn't register yet!"; end; } if(.BGJoin) { if(@DBG_Team == 1) for ( set .@c,0; .@c < getarraysize(.Team1); set .@c,.@c + 1) if(getcharid(3) == .Team1[.@c]) deletearray .Team1[.@c],1; else if(@DBG_Team == 2) for ( set .@c,0; .@c < getarraysize(.Team1); set .@c,.@c + 1) if(getcharid(3) == .Team1[.@c]) deletearray .Team1[.@c],1; } else if(.DBG_Match) { bg_leave; warp "prontera",156,191; pcblockmove getcharid(3),0; pcblockskill getcharid(3),0; if(getmapusers($@DBG_Map$[$@DBG_Status]) < .DBG_PlayersMin[$@DBG_Status]) { announce "Battleground Arena: There are not enough participants to continue the match.",$@DBG_Anno_T; set .DBG_End,1; donpcevent strnpcinfo(0)+"::OnBGArenaScore"; } } set @DBG_Team,0; announce "Battleground Arena: ["+strcharinfo(0)+"] has left the battlefield!",$@DBG_Anno_T; end; // Battleground Arena - @bgarenainfo command OnBGInfo: if(!$@DBG_Status) message strcharinfo(0),"Battleground Arena: Inactive"; else { message strcharinfo(0),"Battleground Arena: "+$@DBG_Mode$[$@DBG_Status]+" - "+$@DBG_T1Score+" : "+$@DBG_T2Score; if(.DBG_Match) message strcharinfo(0),"Battleground Arena: Time Limit - "+(.DBG_TLimit[$@DBG_Status] - .t)+" Minute"+ ( ((.DBG_TLimit[$@DBG_Status] - .t) > 1)?"s":"")+" until the Match ends."; else if(.BGJoin) message strcharinfo(0),"Battleground Arena: It's currently possible to join the battlefield!"; } end; // Battleground Arena - Unblock players and put markers on minimap OnBGPlayerBlock: set .@bg_pl,bg_get_data($@DBG_T1,1); copyarray .@bg_ids[getarraysize(.@bg_ids)],$@arenamembers[0],.@bg_pl; set .@bg_pl,bg_get_data($@DBG_T2,1); copyarray .@bg_ids[getarraysize(.@bg_ids)],$@arenamembers[0],.@bg_pl; for ( set .@p,0; .@p < getarraysize(.@bg_ids); set .@p,.@p + 1) if(attachrid(.@bg_ids[.@p])) { pcblockmove getcharid(3),0; // Enable Movement pcblockskill getcharid(3),0; // Enable Skills if($@DBG_Status == 2) { // S&D getmapxy(.@map_a$,.@targeta_x,.@targeta_y,BL_NPC,"Target A#1"); getmapxy(.@map_b$,.@targetb_x,.@targetb_y,BL_NPC,"Target B#2"); viewpoint 1,.@targeta_x,.@targeta_y,1,0xFF0000; viewpoint 1,.@targetb_x,.@targetb_y,2,0x00FF00; } else if($@DBG_Status == 3) { // Domination getmapxy(.@map_a$,.@flaga_x,.@flaga_y,BL_NPC,"Flag A#1"); getmapxy(.@map_b$,.@flagb_x,.@flagb_y,BL_NPC,"Flag B#2"); getmapxy(.@map_c$,.@flagc_x,.@flagc_y,BL_NPC,"Flag C#3"); viewpoint 1,.@flaga_x,.@flaga_y,1,0xFF0000; viewpoint 1,.@flagb_x,.@flagb_y,2,0x00FF00; viewpoint 1,.@flagc_x,.@flagc_y,3,0x0000FF; } else if($@DBG_Status == 4) { // Rush getmapxy(.@map$,.@def_x,.@def_y,BL_NPC,"Defend Crystal"); viewpoint 1,.@def_x,.@def_y,1,0xFF0000; } } end; // Battleground Arena - Reward Function function DBG_Reward { // getarg(0) = Group ID // getarg(1) = Happy Hour Rate // getarg(2) = BGArenaPts // getarg(3) = War Badges (7773) // getarg(4) = Valor Badges (7829) // getarg(5) = Bravery Badges (7828) // Item ID of Rewards: // Change this values to adjust the reward ids! setarray .@rew_item[0],7773,7829,7828; set .@grp_count,bg_get_data(getarg(0),1); // Loop through the players and give them the reward for ( set .@b,0; .@b < .@grp_count; set .@b,.@b + 1) { attachrid($@arenamembers[.@b]); set BGArenaPts,BGArenaPts + (getarg(2)*getarg(1)); dispbottom "Battleground Arena: You have recieved "+(getarg(2)*getarg(1))+"x Battleground Arena Points."; for ( set .@r,0; .@r < getarraysize(.@rew_item); set .@r,.@r + 1) getitem .@rew_item[.@r],getarg(.@r+3)*getarg(1); detachrid; } return; } } // Battleground Arena - Vote NPC - script DBGArena_Vote -1,{ OnInit: // Time to vote in minutes set .VoteTime,3; bindatcmd "@votebgarena",strnpcinfo(0)+"::OnBGVote"; end; // Battleground Arena - Starting Vote OnBGVoteInit: set .vt,0; set .bg_v1_ct,0; set .bg_v2_ct,0; set .bg_v3_ct,0; set .bg_v1,rand(1,(getarraysize($@DBG_Mode$) - 1)); if($@DBG_Status) // Save previous Game Mode as 2nd Vote Option set .bg_v2,$@DBG_Status; else set .bg_v2,rand(1,(getarraysize($@DBG_Mode$) - 1)); set .bg_v3,rand(1,(getarraysize($@DBG_Mode$) - 1)); // Checking of duplicate Vote Entries while(1) { set .@f1,0; set .@f3,0; if(.bg_v1 == .bg_v2 || .bg_v1 == .bg_v3) set .@f1,1; if(.bg_v3 == .bg_v2 || .bg_v3 == .bg_v1) set .@f3,1; if(.@f1) set .bg_v1,rand(1,(getarraysize($@DBG_Mode$) - 1)); if(.@f3) set .bg_v3,rand(1,(getarraysize($@DBG_Mode$) - 1)); if(!.@f1 && !.@f3) break; sleep 100; // Preventing infinite loop } announce "Battleground Arena: Game Mode Voting is now possible. Use \"@votebgarena\" to vote for an Game Mode.",$@DBG_Anno_T; sleep 2000; announce "Battleground Arena: You have "+.VoteTime+" Minute"+ ( (.VoteTime > 1)?"s":"")+" to vote, if there are no votes until then, the Arena will be stopped.",$@DBG_Anno_T; set .Vote,1; initnpctimer; end; // Battleground Arena - Vote Time Limit OnTimer60000: // Every Minute stopnpctimer; set .vt,.vt + 1; if(.vt == .VoteTime) { // Check if Time Limit has been reached set .Vote,0; set .vt,0; announce "Battleground Arena: Vote Result - "+$@DBG_Mode$[.bg_v1]+" = "+.bg_v1_ct+" | "+$@DBG_Mode$[.bg_v2]+" = "+.bg_v2_ct+" | "+$@DBG_Mode$[.bg_v3]+" = "+.bg_v3_ct,$@DBG_Anno_T; // End the Battleground if there are no votes placed if(!.bg_v1_ct && !.bg_v2_ct && !.bg_v3_ct) { donpcevent "DBGArena_Core::OnBGArenaEnd"; end; // Comparing if any vote is the same as one other but still higher than a different one } else if(.bg_v1_ct == .bg_v2_ct && .bg_v1_ct > .bg_v3_ct) set .@bg,1; else if(.bg_v2_ct == .bg_v3_ct && .bg_v2_ct > .bg_v1_ct) set .@bg,2; else if(.bg_v3_ct == .bg_v1_ct && .bg_v3_ct > .bg_v2_ct) set .@bg,3; // Compare if any vote is higher than the others else if(.bg_v1_ct > .bg_v2_ct && .bg_v1_ct > .bg_v3_ct) set .@bg,1; else if(.bg_v2_ct > .bg_v1_ct && .bg_v2_ct > .bg_v3_ct) set .@bg,2; else if(.bg_v3_ct > .bg_v1_ct && .bg_v3_ct > .bg_v2_ct) set .@bg,3; set $@DBG_Status,getd(".bg_v"+.@bg); donpcevent "DBGArena_Core::OnBGArenaPrepare"; end; } initnpctimer; end; OnBGVote: if(!.Vote) { message strcharinfo(0),"Battleground Arena: There is currently no voting running."; end; } if(.@atcmd_parameters$[0] == "") { message strcharinfo(0),"Battleground Arena: Current Votings: "+.bg_v1_ct+" : "+$@DBG_Mode$[.bg_v1]+" (1) | "+.bg_v2_ct+" : "+$@DBG_Mode$[.bg_v2]+" (2) | "+.bg_v3_ct+" : "+$@DBG_Mode$[.bg_v3]+" (3)"; sleep2 1000; message strcharinfo(0),"Battleground Arena: You can vote with \"@votebgarena 1|2|3\" for the prefered Game Mode."; } else { set .@v,atoi(.@atcmd_parameters$[0]); setd(".bg_v"+.@v+"_ct"),getd(".bg_v"+.@v+"_ct") + 1; message strcharinfo(0),"Battleground Arena: Vote has been confirmed. You have voted for \""+$@DBG_Mode$[getd(".bg_v"+.@v)]+"\"."; } end; } // Battleground Arena - Healer NPC's - script #DBG_Heal -1,{ if(@DBG_Team != atoi(charat(strnpcinfo(2),2)) ) { npctalk "You don't belong to Team "+charat(strnpcinfo(2),2)+"!",strnpcinfo(0),bc_self; } else { if(@Heal_Delay > gettimetick(2)) { npctalk "You can't be healed yet, please wait a few seconds.",strnpcinfo(0),bc_self; end; } npctalk "You have been fully healed! Good luck!",strnpcinfo(0),bc_self; specialeffect 911; percentheal 100,100; set @Heal_Delay,gettimetick(2) + .HDelay; } end; OnInit: // Delay until you can get healed again in seconds set .HDelay,10; disablenpc strnpcinfo(0); end; OnEnable: enablenpc strnpcinfo(0); if($@DBG_Map$[$@DBG_Status] == "dbg_arena") { enablenpc "Healer#1-1"; enablenpc "Healer#1-2"; } else if($@DBG_Map$[$@DBG_Status] == "dbg_dom") { enablenpc "Healer#2-1"; enablenpc "Healer#2-2"; } end; OnDisable: if($@DBG_Map$[$@DBG_Status] == "dbg_arena") { disablenpc "Healer#1-1"; disablenpc "Healer#1-2"; } else if($@DBG_Map$[$@DBG_Status] == "dbg_dom") { disablenpc "Healer#2-1"; disablenpc "Healer#2-2"; } disablenpc strnpcinfo(0); end; } dbg_arena,88,82,4 duplicate(#DBG_Heal) Healer#1-1 4_F_NURSE dbg_arena,311,232,4 duplicate(#DBG_Heal) Healer#1-2 4_F_NURSE dbg_dom,354,317,4 duplicate(#DBG_Heal) Healer#2-1 4_F_NURSE dbg_dom,349,100,4 duplicate(#DBG_Heal) Healer#2-2 4_F_NURSE // Battleground Arena - Player warped on the battlefield and prepare final stuff for the match - script DBG_Init -1,{ OnBGPrepare: sleep 2500; // Let the players be warped to the map before starting mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": The Match will start shortly.",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; sleep 3000; mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": Until 10 seconds before the start of the match, you won't be able to move or use skills.",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; sleep 3000; mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": Think about a good strategy to win and play fair.",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; sleep 3000; switch($@DBG_Status) { default: break; case 2: // Search & Destroy enablenpc "DBG_Target"; enablenpc "Target A#1"; enablenpc "Target B#2"; enablenpc "Bomb#SAD"; set .Planting_1,0; set .Planting_2,0; set .Bomb_Active_T1,0; set .Bomb_Active_T2,0; if(!.NoAnno) { mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": Team 1 has to destroy one of the targets by using the bomb, which can be picked up!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; sleep 3000; mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": Team 2 has to defend both targets and defuse the bomb, if it was planted.",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; sleep 3000; } break; case 3: // Domination enablenpc "DBG_DOM_Flag"; enablenpc "Flag A#1"; enablenpc "Flag B#2"; enablenpc "Flag C#3"; // Reseting Display ID to Neutral Flag setnpcdisplay "Flag A#1",1911; setnpcdisplay "Flag B#2",1911; setnpcdisplay "Flag C#3",1911; // Create Chat Room (Display Box) donpcevent "Flag A#1::OnDisplayBox"; donpcevent "Flag B#2::OnDisplayBox"; donpcevent "Flag C#3::OnDisplayBox"; if(!.NoAnno) { mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": There are 3 Flags to take, if one team has more members at a flag than the other, then the first team will get the flag!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; sleep 3000; mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": Holding Flags gives Points every 5 seconds. The more flags your team holds the more points you will get!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; sleep 3000; } break; case 4: // Rush // How many Lifes does the Attacker Team has in Rush? set getvariableofnpc(.Rush_Life,"DBGArena_Core"),45; if(!.NoAnno) { mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": Team 1 has to attack the other Team's Crystal to win, while they have to defend until the time limit has been reached!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; sleep 3000; mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": Team 1 has "+getvariableofnpc(.Rush_Life,"DBGArena_Core")+" Lifes. If they hit \"0\" Team 2 wins!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; sleep 3000; } break; case 5: // Capture the Flag enablenpc "DBG_CTF_Flag"; enablenpc "Team 1 Flag#1"; enablenpc "Team 2 Flag#2"; movenpc "Team 1 Flag#1",.CTF1_x,.CTF1_y; movenpc "Team 2 Flag#2",.CTF2_x,.CTF2_y; set getvariableofnpc(.Flag1_Base,"Team 1 Flag#1"),1; set getvariableofnpc(.Flag2_Base,"Team 2 Flag#2"),1; // Effect for Flag Holder set .f_effect,409; // Meteor Assault set .f_effect_t,1500; // Timer in milliseconds, when the effect will shown again if(!.NoAnno) { mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": Each Team has a flag to protect while stealing the enemies flag!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; sleep 3000; mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": The first team to bring the enemies flag to their own wins the round!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; sleep 3000; } break; } set .NoAnno,0; mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": The Match will start in 1 Minute!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; sleep 50000; // 50 sec mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": 10 Seconds left, you can now move and buff your members!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; donpcevent "DBGArena_Core::OnBGPlayerBlock"; donpcevent "#DBG_Heal::OnEnable"; sleep 10000; // 10 sec mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": The Match starts now! Good luck to both Teams!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; donpcevent "DBGArena_Core::OnBGArenaTimer"; // Start the Timer in DBGArena_Core for Time Limit if($@DBG_Status == 3) // Start flag timer for Domination initnpctimer; else if($@DBG_Status == 4) // Spawn Crystal for Rush bg_monster $@DBG_T2,$@DBG_Map$[$@DBG_Status],.mob[0],.mob[1],"Defend Crystal",1914,strnpcinfo(0)+"::OnRushMobDeath"; end; // Round Reset - Basically only for S&D / Rush / CTF OnRoundReset: if($@DBG_Status == 2 && .SAD_Win > 0) { set .@RS$,"SAD"; setd(".T"+.SAD_Win+"_Score"),getd(".T"+.SAD_Win+"_Score") + 1; mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": [Team "+.SAD_Win+"] has scored 1 Point!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; set .SAD_Win,0; } else if($@DBG_Status == 4 && .Rush_Win > 0) { set .@RS$,"Rush"; setd(".T"+.Rush_Win+"_Score"),getd(".T"+.Rush_Win+"_Score") + 1; mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": [Team "+.Rush_Win+"] has scored 1 Point!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; set .Rush_Win,0; } else if($@DBG_Status == 5 && .CTF_Win > 0) { set .@RS$,"CTF"; setd(".T"+.CTF_Win+"_Score"),getd(".T"+.CTF_Win+"_Score") + 1; mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": [Team "+.CTF_Win+"] has scored 1 Point!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; set .CTF_Win,0; } sleep 2000; donpcevent strnpcinfo(0)+"::OnBGDisable"; donpcevent strnpcinfo(0)+"::OnBGRoundScore"; set .rounds,.rounds + 1; mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": Round "+.rounds+" has finished!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; sleep 2000; if(.rounds < getd("."+.@RS$+"_RoundSwap")) { mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": Starting Round "+(.rounds+1)+" in a few seconds!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; set getvariableofnpc(.DBG_Reset,"DBGArena_Core"),1; set .NoAnno,1; // To prevent repeating the Announcements in the next round donpcevent "DBGArena_Core::OnBGArenaReset"; } else { if(.T1_Score > .T2_Score) set $@DBG_T1Score,$@DBG_T1Score + 1; else if(.T2_Score > .T1_Score) set $@DBG_T2Score,$@DBG_T2Score + 1; set .T1_Score,0; set .T2_Score,0; if(.Team_Swapped) { donpcevent strnpcinfo(0)+"::OnBGRoundScore"; donpcevent "DBGArena_Core::OnBGArenaScore"; set .Team_Swapped,0; end; } mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": End of the match! Switching Teams....",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; sleep 2000; set .rounds,0; // Swapping Teams set .@T1,$@DBG_T2; set .@T2,$@DBG_T1; set $@DBG_T1,.@T1; set $@DBG_T2,.@T2; set .Team_Swapped,1; // Reseting Round set getvariableofnpc(.DBG_Reset,"DBGArena_Core"),1; donpcevent "DBGArena_Core::OnBGArenaReset"; } end; // Battleground Arena - Update Score OnBGRoundScore: bg_updatescore $@DBG_Map$[$@DBG_Status],.T1_Score,.T2_Score; end; // Domination - Flag Timer OnTimer5000: // Every 5th second stopnpctimer; if(($@DBG_T1Score + .flags_pts[$@DBG_Flag_CT1]) < 100) set $@DBG_T1Score,$@DBG_T1Score + .flags_pts[$@DBG_Flag_CT1]; else set $@DBG_T1Score,100; if(($@DBG_T2Score + .flags_pts[$@DBG_Flag_CT2]) < 100) set $@DBG_T2Score,$@DBG_T2Score + .flags_pts[$@DBG_Flag_CT2]; else set $@DBG_T2Score,100; donpcevent "DBGArena_Core::OnBGArenaScore"; initnpctimer; end; // Rush - Crystal Death Event OnRushMobDeath: mapannounce $@DBG_Map$[$@DBG_Status],$@DBG_Mode$[$@DBG_Status]+": [Team 1] has destroyed the Crystal!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; set .Rush_Win,1; donpcevent strnpcinfo(0)+"::OnRoundReset"; end; OnFlagMark: deltimer strnpcinfo(0)+"::OnFlagMark"; if(!@Has_Flag) end; specialeffect2 .f_effect; addtimer .f_effect_t,strnpcinfo(0)+"::OnFlagMark"; end; OnBGDisable: switch($@DBG_Status) { default: break; case 2: // Search and Destroy stopnpctimer "DBG_Target"; stopnpctimer "Target A#1"; stopnpctimer "Target B#2"; movenpc "Bomb#SAD",.SAD_x,.SAD_y; disablenpc "DBG_Target"; disablenpc "Target A#1"; disablenpc "Target B#2"; disablenpc "Bomb#SAD"; break; case 3: // Domination stopnpctimer; disablenpc "DBG_DOM_Flag"; disablenpc "Flag A#1"; disablenpc "Flag B#2"; disablenpc "Flag C#3"; break; case 5: // Capture the Flag movenpc "Team 1 Flag#1",.CTF1_x,.CTF1_y; movenpc "Team 2 Flag#2",.CTF2_x,.CTF2_y; disablenpc "DBG_CTF_Flag"; disablenpc "Team 1 Flag#1"; disablenpc "Team 2 Flag#2"; break; } donpcevent "#DBG_Heal::OnDisable"; killmonsterall $@DBG_Map$[$@DBG_Status]; end; OnInit: // ======= Search and Destroy ===== // Saving original coordiantes of the bomb getmapxy(.@map$,.SAD_x,.SAD_y,BL_NPC,"Bomb#SAD"); // How many rounds until the teams are swapped? // Note: First round has the value 0 set .SAD_RoundSwap,2; // ======= Domination ===== // Flag Settings - Points // Default: [ ] = Flag Count // [0] = 0 Flags > 0 Pts (Obviously) // [1] = 1 Flag > 1 Pt // [2] = 2 Flags > 3 Pts // [3] = 3 Flags > 5 Pts setarray .flags_pts[0],0,1,3,5; // ======= Rush ===== // How many rounds until the teams are swapped? // Note: First round has the value 0 set .Rush_RoundSwap,2; // Mob Coordinates of Defender Team (Team 2) setarray .mob[0],328,150; // ======= Rush ===== // Saving original coordiantes of the flags getmapxy(.@map$,.CTF1_x,.CTF1_y,BL_NPC,"Team 1 Flag#1"); getmapxy(.@map$,.CTF2_x,.CTF2_y,BL_NPC,"Team 2 Flag#2"); // How many rounds until the teams are swapped? // Note: First round has the value 0 set .CTF_RoundSwap,2; end; } // Search and Destroy - Target NPC's - script DBG_Target -1,{ if(getd(".Bomb_Active_T"+strnpcinfo(2)) && @DBG_Team == 2) { progressbar "",.defuse; if(!playerattached()) end; // Check if the player is still attached, like got killed stopnpctimer strnpcinfo(0); mapannounce strnpcinfo(4),"Search & Destroy: Team 2 has succesfully defused the bomb at "+strnpcinfo(1)+".",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; setd(".Bomb_Active_T"+strnpcinfo(2)),0; setd(".b_T"+strnpcinfo(2)),0; set getvariableofnpc(.SAD_Win,"DBG_Init"),2; donpcevent "DBG_Init::OnRoundReset"; } else if(!getd(".Bomb_Active_T"+strnpcinfo(2)) && @DBG_Team == 1) { // Check if Attacker if(!@Has_Bomb) message strcharinfo(0),"You need to the bomb to destroy this target."; else if(getd(".Planting_"+strnpcinfo(2)) == 0) { addtimer 1000,strnpcinfo(0)+"::OnBombPlant"; getmapxy(.@map$,@x,@y,BL_PC); setd(".Planting_"+strnpcinfo(2)),1; } } end; OnBombPlant: deltimer strnpcinfo(0)+"::OnBombPlant"; getmapxy(.@map$,.@x,.@y,BL_PC); if(.@x != @x && .@y != @y) { message strcharinfo(0),"Search & Destroy: You are not allowed to move!"; set .plant_t,0; setd(".Planting_"+strnpcinfo(2)),0; set @x,0; set @y,0; end; } if(.plant_t < .plant) { addtimer 1000,strnpcinfo(0)+"::OnBombPlant"; npctalk "Planting complete in "+(.plant-.plant_t)+" seconds.",strnpcinfo(0); set .plant_t,.plant_t + 1; end; } set @x,0; set @y,0; mapannounce strnpcinfo(4),"Search & Destroy: Team 1 has planted the Bomb at "+strnpcinfo(1)+". "+.bomb+" seconds unil it explodes!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; setd(".Bomb_Active_T"+strnpcinfo(2)),1; set @Has_Bomb,0; set .plant_t,0; setd(".Planting_"+strnpcinfo(2)),0; initnpctimer strnpcinfo(0); end; OnTimer1000: stopnpctimer strnpcinfo(0); setd(".b_T"+strnpcinfo(2)),getd(".b_T"+strnpcinfo(2)) + 1; npctalk "Time left until explosion: "+(.bomb-getd(".b_T"+strnpcinfo(2)))+" seconds",strnpcinfo(0); misceffect 54; initnpctimer strnpcinfo(0); if(getd(".b_T"+strnpcinfo(2)) < .bomb || getd(".Bomb_Active_T"+strnpcinfo(2)) == 0) end; stopnpctimer strnpcinfo(0); setd(".Bomb_Active_T"+strnpcinfo(2)),0; specialeffect .explode; set getvariableofnpc(.SAD_Win,"DBG_Init"),1; donpcevent "DBG_Init::OnRoundReset"; end; OnInit: set .bomb,20; // Time until bomb explodes in seconds set .plant,5; // Required time to plant the bomb in seconds set .defuse,8; // Time to defuse the bomb set .explode,730; // Effect ID for explosion disablenpc strnpcinfo(0); end; } dbg_arena,199,191,4 duplicate(DBG_Target) Target A#1 1914 dbg_arena,199,106,4 duplicate(DBG_Target) Target B#2 1915 // Search & Destroy - Bomb dbg_arena,97,78,4 script Bomb#SAD 1904,{ if(@DBG_Team != 1) end; set @Has_Bomb,1; npctalk "["+strcharinfo(0)+"] has picked up the Bomb.",strnpcinfo(0),bc_area; sleep 500; disablenpc strnpcinfo(0); end; OnInit: set .npc$,strnpcinfo(0); disablenpc .npc$; end; } // Domination - Flag Template - script DBG_DOM_Flag -1,{ end; OnTouch: if(getd(".Flag"+strnpcinfo(2)+"_Group") == @DBG_Team) end; // Team x owns this Flag, end if(getd(".TakeOver_F"+strnpcinfo(2))) end; // TakeOver is in progress setd(".TakeOver_F"+strnpcinfo(2)),1; mapannounce strnpcinfo(4),"Domination: ["+strnpcinfo(1)+"] is being taken....",bc_area,$@DBG_Anno$[$@DBG_Status]; while( .@t < .flag_timer) { misceffect (766-.@t); set .@t,.@t + 1; sleep 1000; } setd(".TakeOver_F"+strnpcinfo(2)),0; getmapxy(.@map$,.@flag_x,.@flag_y,BL_NPC); set .@F_T1,bg_getareausers($@DBG_T1,strnpcinfo(4),(.@flag_x-3),(.@flag_y-3),(.@flag_x+3),(.@flag_y+3)); set .@F_T2,bg_getareausers($@DBG_T2,strnpcinfo(4),(.@flag_x-3),(.@flag_y-3),(.@flag_x+3),(.@flag_y+3)); if(!getd(".Flag"+strnpcinfo(2)+"_Group")) { // Neutral Flag if(.@F_T1 > .@F_T2) { set $@DBG_Flag_CT1,$@DBG_Flag_CT1 + 1; setd(".Flag"+strnpcinfo(2)+"_Group"),1; } else if(.@F_T2 > .@F_T1) { set $@DBG_Flag_CT2,$@DBG_Flag_CT2 + 1; setd(".Flag"+strnpcinfo(2)+"_Group"),2; } else { npctalk strnpcinfo(1)+": There are equal amount of players, therefore no one can take the flag!"; end; } } else if(getd(".Flag"+strnpcinfo(2)+"_Group") == 1) { // Team 1 has flag if(.@F_T1 < .@F_T2) { set $@DBG_Flag_CT1,$@DBG_Flag_CT1 - 1; set $@DBG_Flag_CT2,$@DBG_Flag_CT2 + 1; setd(".Flag"+strnpcinfo(2)+"_Group"),2; } else { npctalk strnpcinfo(1)+": There are equal amount or Team 1 has more players, therefore Team 1 keeps the flag!"; end; } } else if(getd(".Flag"+strnpcinfo(2)+"_Group") == 2) { // Team 2 has flag if(.@F_T2 < .@F_T1) { set $@DBG_Flag_CT1,$@DBG_Flag_CT1 + 1; set $@DBG_Flag_CT2,$@DBG_Flag_CT2 - 1; setd(".Flag"+strnpcinfo(2)+"_Group"),1; } else { npctalk strnpcinfo(1)+": There are equal amount or Team 2 has more players, therefore Team 2 keeps the flag!"; end; } } setnpcdisplay(strnpcinfo(0),strnpcinfo(0),getd(".T"+getd(".Flag"+strnpcinfo(2)+"_Group")+"_FlagID")); mapannounce strnpcinfo(4),"Domination: ["+strnpcinfo(1)+"] has been taken by Team "+getd(".Flag"+strnpcinfo(2)+"_Group")+"!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; delwaitingroom; OnDisplayBox: waitingroom strnpcinfo(1)+" - "+( (getd(".Flag"+strnpcinfo(2)+"_Group") == 0)?"[Neutral]":"[Team "+getd(".Flag"+strnpcinfo(2)+"_Group")+"]"),0; end; OnInit: set .T1_FlagID,1912; // ID to display when Team 1 has taken the Flag set .T2_FlagID,1913; // ID to display when Team 2 has taken the Flag set .flag_timer,10; // Timer to take an flag in seconds disablenpc strnpcinfo(0); end; } // Flags duplicates to be taken dbg_dom,209,291,4 duplicate(DBG_DOM_Flag) Flag A#1 1911,3,3 dbg_dom,274,204,4 duplicate(DBG_DOM_Flag) Flag B#2 1911,3,3 dbg_dom,267,131,4 duplicate(DBG_DOM_Flag) Flag C#3 1911,3,3 // Capture the Flag - Flag NPC's - script DBG_CTF_Flag -1,{ if(getd(".Flag"+strnpcinfo(2)+"_Base")) { // Is the flag at base? if(@DBG_Team == atoi(strnpcinfo(2)) && (@Has_Flag > 0 && @Has_Flag != @DBG_Team) ) { mapannounce strnpcinfo(4),"Capture the Flag: Team "+@DBG_Team+" has succesfully conquered the enemies Flag!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; set getvariableofnpc(.CTF_Win,"DBG_Init"),@DBG_Team; set @Has_Flag,0; donpcevent "DBG_Init::OnRoundReset"; } else if(@DBG_Team != atoi(strnpcinfo(2))) { disablenpc strnpcinfo(0); setd(".Flag"+strnpcinfo(2)+"_Base"),0; set @Has_Flag,atoi(strnpcinfo(2)); mapannounce strnpcinfo(4),"Capture the Flag: The Flag of Team "+strnpcinfo(2)+" has been taken by ["+strcharinfo(0)+"]!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; addtimer 5000,"DBG_Init::OnFlagMark"; } } else if(!getd(".Flag"+strnpcinfo(2)+"_Base")) { // Has the flag been dropped? if(@DBG_Team == atoi(strnpcinfo(2))) { // Is the player in the same team as the Flag belongs to? movenpc strnpcinfo(0),getd(".CTF"+strnpcinfo(2)+"_x"),getd(".CTF"+strnpcinfo(2)+"_y"); setd(".Flag"+strnpcinfo(2)+"_Base"),1; mapannounce strnpcinfo(4),"Capture the Flag: The Flag of Team "+@DBG_Team+" has been saved by ["+strcharinfo(0)+"]!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; } else { disablenpc strnpcinfo(0); set @Has_Flag,atoi(strnpcinfo(2)); specialeffect2 getvariableofnpc(.f_effect,"DBG_Init"); addtimer getvariableofnpc(.f_effect_t,"DBG_Init"),"DBG_Init::OnFlagMark"; mapannounce strnpcinfo(4),"Capture the Flag: The Flag of Team "+strnpcinfo(2)+" has been taken by ["+strcharinfo(0)+"]!",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; } } end; OnInit: // Saving original coordiantes and Names of the flags if(strnpcinfo(2) != "") { getmapxy(.@map$,getd(".CTF"+strnpcinfo(2)+"_x"),getd(".CTF"+strnpcinfo(2)+"_y"),BL_NPC); setd(".npc_F"+strnpcinfo(2)+"$"),strnpcinfo(0); } disablenpc strnpcinfo(0); end; } dbg_arena,62,150,4 duplicate(DBG_CTF_Flag) Team 1 Flag#1 1912 dbg_arena,328,150,4 duplicate(DBG_CTF_Flag) Team 2 Flag#2 1913 prontera,147,175,4 script Battleground Arena 100,{ mes .n$; mes "Welcome, "+strcharinfo(0)+"!"; mes "How can I help you?"; next; switch(select("- Start Arena:- Information:- Shop:- Leave")) { case 1: mes .n$; if($@DBG_Status) { mes "The Battleground Arena is currently active."; mes "Use \"@joinbgarena\" to join."; close; } if(.DBG_WoE && (agitcheck() || agitcheck2() || agitcheck3())) { mes "Currently the War of Emperium is active, therefore I can't start the Arena!"; close; } mes "Which Game Mode do you want to play?"; next; for ( set .@g,1; .@g < getarraysize($@DBG_Mode$); set .@g,.@g + 1) set .@gm_menu$,.@gm_menu$ + "- "+$@DBG_Mode$[.@g]+ ( ($@DBG_Mode$[.@g+1] != "")?":":""); set .@gm,select(.@gm_menu$); mes .n$; mes $@DBG_Mode$[.@gm]+", it is?"; if(select("- Yes:- No") - 1) close; next; mes .n$; mes "Okay, here we go."; set $@DBG_Status,.@gm; close2; announce "An warrior is calling out for others to participate in the Battleground Arena.",$@DBG_Anno_T,$@DBG_Anno$[$@DBG_Status]; sleep 3000; donpcevent "DBGArena_Core::OnBGArenaInit"; end; case 2: mes .n$; mes "About what do you want to learn more?"; next; switch(select("- Join Arena:- Game Modes:- Happy Hour:- Custom Commands:- Rewards:- Nevermind")) { case 1: // Join Arena mes .n$; mes "Every Warrior can start the Battleground Arena by selecting the Game Mode,"; mes (getvariableofnpc(.DBG_WoE,"DBGArena_Core") == 0?"even":"but not")+" when WoE is active."; mes "As soon it starts you will see the announcement."; break; // Games Modes case 2: mes .n$; mes "There are a total of "+(getarraysize($@DBG_Mode$) - 1)+" Game Modes."; mes "About which Game Mode do you want to know more?"; next; switch(select("- Team Deathmatch:- Search & Destroy:- Domination:- Rush:- Capture the Flag")) { case 1: // TDM mes .n$; mes "Team Deathmatch consists only of battling the other Team."; mes "The goal is to defeat more enemies than the other team until either the time limit or the required points have been reached."; break; case 2: // S&D mes .n$; mes "Search & Destroy consists of destroying 1 of 2 Targets."; mes "Team 1 has access to the bomb while Team 2 has to defend the targets."; break; case 3: // Domination mes .n$; mes "Domination consists of taking flags. There are a total of 3 flags to take."; mes "Each flag gives points every 5 seconds, the more flags are taken by an team the more points they will recieve."; break; case 4: // Rush mes .n$; mes "Rush consists of destroying an Crystal."; mes "Team 1 are the attackers and have limited lifes, while Team 2 has to defend the crystal until either the Time Limit or the attackers are out of lifes."; break; case 5: // CTF mes .n$; mes "Capture the Flag consists of taking the enemies flag and bring it to the own flag."; mes "If the own flag was taken, you have to take it back to score."; break; } next; mes .n$; switch(@menu) { default: mes "Time Limit per Match is: "+getvariableofnpc(.DBG_TLimit[@menu],"DBGArena_Core")+" "+ ( (getvariableofnpc(.DBG_TLimit[@menu],"DBGArena_Core") > 1)?"Minutes":"Minute"); mes "The required Points to win is: "+getvariableofnpc(.DBG_MPTS[@menu],"DBGArena_Core"); break; case 2: case 4: case 5: mes "There are multiply rounds per match and the Time Limit per round is:"; mes getvariableofnpc(.DBG_TLimit[@menu],"DBGArena_Core")+" "+ ( (getvariableofnpc(.DBG_TLimit[@menu],"DBGArena_Core") > 1)?"Minutes":"Minute"); mes "After each round, the match will restart until a certain amount of rounds have passed, then the teams will be swapped and the team which scores the most in these rounds, scores 1 total point."; mes "The required Points to win is: "+getvariableofnpc(.DBG_MPTS[@menu],"DBGArena_Core"); break; } break; // Happy Hour case 3: mes .n$; mes "During the day it can happen that \"Happy Hour\" will start."; mes "This means that the reward will be increased for this very hour."; break; // Custom Commands case 4: mes .n$; mes "There are following commands for the Battleground Arena:"; mes " > @bgarenainfo = Display the Score and Time left"; mes " > @joinbgarena = Joins the Battleground Arena"; mes " > @leavebgarena = Leaves the Battleground Arena"; if(getgroupid()) { mes " "; mes " For GM's exists:"; mes " > @startbgarena = Start the Battleground Arena"; mes " > @endbgarena = Ends the Battleground Arena"; } break; // Rewards case 5: mes .n$; mes "There are 4 different rewards awaiting you after each match."; mes "The reward amount itself depends on the Game Mode tho."; mes " "; mes " > Arena Points (for the Arena Shop)"; mes " > Valor Badges"; mes " > War Badges"; mes " > Bravery Badges"; break; // Nevermind case 6: break; } break; case 3: mes .n$; mes "I will now open the Battleground Arena Shop!"; mes "You have currently "+BGArenaPts+" Arena Points!"; mes "Note: The Discount Skill won't work on me!"; close2; callshop "DBG_Shop",1; npcshopattach "DBG_Shop"; end; case 4: break; } close; OnBuyItem: for ( set .@b,0; .@b < getarraysize(@bought_nameid); set .@b,.@b + 1) for ( set .@s,0; .@s < getarraysize(.bg_shop); set .@s,.@s + 2) if(@bought_nameid[.@b] == .bg_shop[.@s]) { if(checkweight(@bought_nameid[.@b],@bought_nameid[.@b]) == 0) { npctalk "Battleground Shop: You can't buy this many items, you would be overweight!!",strnpcinfo(0),bc_self; end; } set .@total,.@total + (.bg_shop[.@s+1]*@bought_quantity[.@b]); } if(.@total > BGArenaPts) { npctalk "Battleground Shop: I'm sorry, but you don't have the required Arena Points. You are missing "+(.@total-BGArenaPts)+" Points.",strnpcinfo(0),bc_self;; end; } for ( set .@i,0; .@i < getarraysize(@bought_nameid); set .@i,.@i + 1) getitem @bought_nameid[.@i],@bought_quantity[.@i]; set BGArenaPts,BGArenaPts - .@total; dispbottom "Battleground Shop: You have paied "+.@total+" Arena Points."; end; OnInit: set .n$,"["+strnpcinfo(0)+"]"; // Item ID,Price setarray .bg_shop[0],12020,2, // [0] == Cursed Water 12028,2, // [1] == Box of Thunder 12029,2, // [2] == Box of Gloom 12030,2, // [3] == Box of Resentment 12031,2, // [4] == Box of Drowsiness 12032,2, // [5] == Box of Stroms 12033,2, // [6] == Box of Sunlight 12034,2, // [7] == Box of Panting 12108,5, // [8] == Scroll Package 12215,5, // [9] == LV 10 Blessing Scroll 12216,5, // [10] == LV 10 Agi Scroll 12217,5, // [11] == LV 5 Aspersio Scroll 12218,5, // [12] == LV 5 Assumptio Scroll 12219,5, // [13] == LV 10 Wind Walker Scroll 12075,10, // [14] == Steamed Tongue 12080,10, // [15] == Dragon Breath Cocktail 12085,10, // [16] == Immortal Stew 12090,10, // [17] == Steamed Desert Scorpions 12095,10, // [18] == Hwergelmir's Tonic 12100,10, // [19] == Cooked Nice Tail's Tails 12114,4, // [20] == Elemental Converter[Fire] 12115,4, // [21] == Elemental Converter[Water] 12116,4, // [22] == Elemental Converter[Earth] 12117,4, // [23] == Elemental Converter[Wind] 12118,3, // [24] == Fireproof Potion 12119,3, // [25] == Coldproof Potion 12120,3, // [26] == Earthproof Potion 12121,3, // [27] == Thunderproof Potion 13543,10, // [28] == Chemical Protection Helm Scroll Box 13544,10, // [29] == Chemical Protection Shield Scroll Box 13545,10, // [30] == Chemical Protection Armor Scroll Box 13546,10, // [31] == Chemical Protection Weapon Scroll Box 7139,1, // [32] == Glistening Coat 13547,10, // [33] == Repair Weapon Scroll Box 14593,5; // [34] == Mystical Amplification Scroll npcshopdelitem "DBG_Shop",501; for ( set .@s,0; .@s < getarraysize(.bg_shop); set .@s,.@s + 2) npcshopadditem "DBG_Shop",.bg_shop[.@s],.bg_shop[.@s+1]; end; } - pointshop DBG_Shop -1,BGArenaPts,501:-1 // Base Flags - Only to display the Team's Flag // Template for saving lines only - script DBG_BaseFlag -1,{ end; } // Team 1 Base Flags on dbg_arena dbg_arena,80,81,4 duplicate(DBG_BaseFlag) Team 1 Base#arena1 1912 dbg_arena,95,81,4 duplicate(DBG_BaseFlag) Team 1 Base#arena2 1912 dbg_arena,95,68,4 duplicate(DBG_BaseFlag) Team 1 Base#arena3 1912 dbg_arena,80,68,4 duplicate(DBG_BaseFlag) Team 1 Base#arena4 1912 // Team 2 Base Flags on dbg_arena dbg_arena,304,230,4 duplicate(DBG_BaseFlag) Team 2 Base#arena1 1913 dbg_arena,318,230,4 duplicate(DBG_BaseFlag) Team 2 Base#arena2 1913 dbg_arena,318,218,4 duplicate(DBG_BaseFlag) Team 2 Base#arena3 1913 dbg_arena,304,218,4 duplicate(DBG_BaseFlag) Team 2 Base#arena4 1913 // Mapflags // Battleground Arena dbg_arena mapflag nosave dbg_arena mapflag noteleport dbg_arena mapflag nomemo dbg_arena mapflag nowarp dbg_arena mapflag nowarpto dbg_arena mapflag noreturn dbg_arena mapflag nogo dbg_arena mapflag nodrop dbg_arena mapflag nobranch dbg_arena mapflag nopenalty dbg_arena mapflag nozenypenalty dbg_arena mapflag novending dbg_arena mapflag nochat dbg_arena mapflag nightenabled dbg_arena mapflag battleground 2 // Battleground Arena - Domination dbg_dom mapflag nosave dbg_dom mapflag noteleport dbg_dom mapflag nomemo dbg_dom mapflag nowarp dbg_dom mapflag nowarpto dbg_dom mapflag noreturn dbg_dom mapflag nogo dbg_dom mapflag nodrop dbg_dom mapflag nobranch dbg_dom mapflag nopenalty dbg_dom mapflag nozenypenalty dbg_dom mapflag novending dbg_dom mapflag nochat dbg_dom mapflag nightenabled dbg_dom mapflag battleground 2
how to fix this error thanks
Link to comment
Share on other sites
0 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.