Hello !
I`m trying add the Chris' Dynamic BG in my server, but when the match start, and the char teleport, my server crash (i use the last version of Rathena):
this is my code :
//===== rAthena Script =======================================
//= Dynamic Battleground Arena
//===== By ===================================================
//= llchrisll
//===== Version ==============================================
//= 1.0 - Initial Version
//===== Tested With ==========================================
//= rAthena 04/29/2020 Revision
//= GIT Hash: 4829f3775d5371e65d6648cf05b6f0c2810bb664
//===== 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
[email protected]_Mode$[1],"Team Deathmatch","Search & Destroy","Domination","Rush","Capture the Flag";
// BG Maps for each Mode
// Note: [0] = is to prevent errors when
[email protected]_Status is reseted by Arena Ending mid-way like by a player leaving
setarray
[email protected]_Map$[0],"dbg_arena","dbg_arena","dbg_arena","dbg_dom","dbg_arena","dbg_arena";
// BG Announce Colors per Mode
setarray
[email protected]_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
[email protected]_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],1,1,1,1,1;
// 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,1;
// 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
[email protected]_T1Score,0;
set
[email protected]_T2Score,0;
donpcevent strnpcinfo(0)+"::OnBGArenaScore";
set .DBG_Prepare,1;
set .t,0;
// Checking for exisiting battle groups
if(
[email protected]_T1) {
set
[email protected]_t1,bg_get_data(
[email protected]_T1,1); // Saving Player Amount of Team 1
copyarray .Team1[0],
[email protected][0],
[email protected]_t1; // and copy the Game IDs into the "join" array .Team1
bg_destroy
[email protected]_T1;
set
[email protected]_T1,0;
for ( set
[email protected],0;
[email protected] < getarraysize(.Team1); set
[email protected],
[email protected] + 1)
if(attachrid(.Team1[
[email protected]]) == 1) // Attach the current Game ID for getcharid()
setarray .Team1[
[email protected]],getcharid(3); // Overwrite the Game ID with the Account ID
}
if(
[email protected]_T2) {
set
[email protected]_t2,bg_get_data(
[email protected]_T2,1); // Saving Player Amount of Team 2
copyarray .Team2[0],
[email protected][0],
[email protected]_t2; // and copy the Game IDs into the "join" array .Team2
bg_destroy
[email protected]_T2;
set
[email protected]_T2,0;
for ( set
[email protected],0;
[email protected] < getarraysize(.Team2); set
[email protected],
[email protected] + 1)
if(attachrid(.Team2[
[email protected]]) == 1) // Attach the current Game ID for getcharid()
setarray .Team2[
[email protected]],getcharid(3); // Overwrite the Game ID with the Account ID
}
if(
[email protected]_Status) {
donpcevent "DBGArena_Vote::OnBGVoteInit";
end;
}
// Creating BG Group ID's
set
[email protected]_T1,bg_create(
[email protected]_Map$[
[email protected]_Status],.team1_x[
[email protected]_Status],.team1_y[
[email protected]_Status],strnpcinfo(0)+"::OnBGLeave",strnpcinfo(0)+"::OnBGArenaDeath");
set
[email protected]_T2,bg_create(
[email protected]_Map$[
[email protected]_Status],.team2_x[
[email protected]_Status],.team2_y[
[email protected]_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: "
[email protected]_Mode$[
[email protected]_Status],
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_Status];
// Check if there are existing players in the queue
if(getarraysize(.Team1) > 0 || getarraysize(.Team2) > 0)
announce "Battleground Arena: "
[email protected]_Mode$[
[email protected]_Status]+" - Team 1: "+getarraysize(.Team1)+"/"+.DBG_PlayersMax[
[email protected]_Status]+" : Team 2: "+getarraysize(.Team2)+"/"+.DBG_PlayersMax[
[email protected]_Status],
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_Status];
set .BGJoin,1;
sleep (.BG_JoinTime*60*1000);
set .BGJoin,0;
if( (getarraysize(.Team1) + getarraysize(.Team2) ) < .DBG_PlayersMin[
[email protected]_Status]) {
announce "Battleground Arena: Time is over! But there are not enough participants to start/continue the match!",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_Status];
donpcevent strnpcinfo(0)+"::OnBGArenaEnd"; // End the whole Battleground
end;
}
for ( set
[email protected],0;
[email protected] < getarraysize(.Team1); set
[email protected],
[email protected] + 1)
if(isloggedin(.Team1[
[email protected]])) {
if(attachrid(.Team1[
[email protected]]) == 0) continue;
bg_join(
[email protected]_T1);
detachrid;
}
for ( set
[email protected],0;
[email protected] < getarraysize(.Team2); set
[email protected],
[email protected] + 1)
if(isloggedin(.Team2[
[email protected]])) {
if(attachrid(.Team2[
[email protected]]) == 0) continue;
bg_join(
[email protected]_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
[email protected]_T1,
[email protected]_Map$[
[email protected]_Status],.team1_x[
[email protected]_Status],.team1_y[
[email protected]_Status];
bg_warp
[email protected]_T2,
[email protected]_Map$[
[email protected]_Status],.team2_x[
[email protected]_Status],.team2_y[
[email protected]_Status];
set .DBG_Reset,0;
set .t,0;
}
set
[email protected]_pl,bg_get_data(
[email protected]_T1,1);
for ( set
[email protected],0;
[email protected] <
[email protected]_pl; set
[email protected],
[email protected] + 1) {
pcblockmove
[email protected][
[email protected]],1; // Disable Movement
pcblockskill
[email protected][
[email protected]],1; // Disable Skills
}
set
[email protected]_pl,bg_get_data(
[email protected]_T2,1);
for ( set
[email protected],0;
[email protected] <
[email protected]_pl; set
[email protected],
[email protected] + 1) {
pcblockmove
[email protected][
[email protected]],1; // Disable Movement
pcblockskill
[email protected][
[email protected]],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[
[email protected]_Status]) {
mapannounce
[email protected]_Map$[
[email protected]_Status],
[email protected]_Mode$[
[email protected]_Status]+" - Time Limit: "+(.DBG_TLimit[
[email protected]_Status] - .t)+" Minute"+ ( ((.DBG_TLimit[
[email protected]_Status] - .t) > 1)?"s":"") +" left!",bc_all,
[email protected]_Anno$[
[email protected]_Status];
initnpctimer;
// If an Match is active and timer has been reached
} else if(.DBG_Match && .t == .DBG_TLimit[
[email protected]_Status]) {
mapannounce
[email protected]_Map$[
[email protected]_Status],
[email protected]_Mode$[
[email protected]_Status]+": The Match is over! Time Limit has been reached!",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_Status];
if(
[email protected]_Status != 1 ||
[email protected]_Status != 3) { // S&D + Rush + CTF has round based matches
if(
[email protected]_Status == 2) // S&D: Declare Team 2 as winner
set getvariableofnpc(.SAD_Win,"DBG_Init"),2;
else if(
[email protected]_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(
[email protected]_Status && !.DBG_Prepare)
if(getmapusers(
[email protected]_Map$[
[email protected]_Status]) < .DBG_PlayersMin[
[email protected]_Status])
donpcevent strnpcinfo(0)+"::OnBGArenaEnd";
end;
// Battleground Arena - Death Event
OnBGArenaDeath:
mapannounce
[email protected]_Map$[
[email protected]_Status],"["+rid2name(killerrid)+"] has killed ["+strcharinfo(0)+"]!",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_Status];
switch(
[email protected]_Status) {
default: break;
case 1: // TDM
if(@DBG_Team == 1) // Killed player is in Team 1, increase Team 2's Score
set
[email protected]_T2Score,
[email protected]_T2Score + 1;
else if(@DBG_Team == 2) // Killed player is in Team 2, increase Team 1's Score
set
[email protected]_T1Score,
[email protected]_T1Score + 1;
break;
case 2: // Search & Destroy
if(
[email protected]_Bomb) end;
getmapxy(
[email protected]$,
[email protected]_x,
[email protected]_y,BL_NPC);
movenpc "Bomb#SAD",
[email protected]_x,
[email protected]_y;
mapannounce
[email protected]_Map$[
[email protected]_Status],
[email protected]_Mode$[
[email protected]_Status]+": The bomb has been dropped!",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_Status];
set @Has_Bomb,0;
enablenpc "Bomb#SAD";
set
[email protected]_pl,bg_get_data(
[email protected]_T1,1);
copyarray
[email protected]_ids[getarraysize(
[email protected]_ids)],
[email protected][0],
[email protected]_pl;
set
[email protected]_pl,bg_get_data(
[email protected]_T2,1);
copyarray
[email protected]_ids[getarraysize(
[email protected]_ids)],
[email protected][0],
[email protected]_pl;
for ( set
[email protected],0;
[email protected] < getarraysize(
[email protected]_ids); set
[email protected],
[email protected] + 1)
if(attachrid(
[email protected]_ids[
[email protected]]))
viewpoint 0,
[email protected]_x,
[email protected]_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
[email protected]_Map$[
[email protected]_Status],
[email protected]_Mode$[
[email protected]_Status]+": Team 1 has lost all of their lifes! Team 2 wins this round!",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_Status];
set getvariableofnpc(.Rush_Win,"DBG_Init"),2;
donpcevent "DBG_Init::OnRoundReset";
end;
}
mapannounce
[email protected]_Map$[
[email protected]_Status],
[email protected]_Mode$[
[email protected]_Status]+": Team 2 has "+.Rush_Life+" lifes left!",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_Status];
break;
case 5: // Capture the Flag
if(
[email protected]_Flag) end;
getmapxy(
[email protected]$,
[email protected]_x,
[email protected]_y,BL_NPC);
set
[email protected]$,"Team "
[email protected]_Flag+" Flag#"
[email protected]_Flag;
movenpc
[email protected]$,
[email protected]_x,
[email protected]_y;
mapannounce
[email protected]_Map$[
[email protected]_Status],
[email protected]_Mode$[
[email protected]_Status]+": The Flag of Team "
[email protected]_Team+" has been dropped!",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_Status];
set @Has_Flag,0;
enablenpc
[email protected]$;
set
[email protected]_pl,bg_get_data(
[email protected]_T1,1);
copyarray
[email protected]_ids[getarraysize(
[email protected]_ids)],
[email protected][0],
[email protected]_pl;
set
[email protected]_pl,bg_get_data(
[email protected]_T2,1);
copyarray
[email protected]_ids[getarraysize(
[email protected]_ids)],
[email protected][0],
[email protected]_pl;
for ( set
[email protected],0;
[email protected] < getarraysize(
[email protected]_ids); set
[email protected],
[email protected] + 1)
if(attachrid(
[email protected]_ids[
[email protected]]))
viewpoint 0,
[email protected]_x,
[email protected]_y,3,0xFF0000;
end;
}
donpcevent strnpcinfo(0)+"::OnBGArenaScore";
end;
OnBGArenaScore:
bg_updatescore
[email protected]_Map$[
[email protected]_Status],
[email protected]_T1Score,
[email protected]_T2Score;
if(
[email protected]_T1Score >= .DBG_MPTS[
[email protected]_Status] ||
[email protected]_T2Score >= .DBG_MPTS[
[email protected]_Status] || .DBG_End)
donpcevent strnpcinfo(0)+"::OnBGMatchEnd";
end;
// Match ended = Give rewards
OnBGMatchEnd:
//
[email protected]_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 >
[email protected]_item[]
stopnpctimer;
set .t,0;
switch(
[email protected]_Status) {
case 0: debugmes "OnBGMatchEnd -
[email protected]_Status = 0 > Error"; break; // Shouldn't happen
case 1: // TDM
setarray
[email protected]_win[0],10,5,5,5;
setarray
[email protected]_lose[0],5,2,2,2;
break;
case 2: // Search & Destroy
setarray
[email protected]_win[0],15,8,8,8;
setarray
[email protected]_lose[0],7,4,4,4;
break;
case 3: // Domination
setarray
[email protected]_win[0],20,10,10,10;
setarray
[email protected]_lose[0],10,8,8,8;
break;
case 4: // Rush
setarray
[email protected]_win[0],15,8,8,8;
setarray
[email protected]_lose[0],7,4,4,4;
break;
case 5: // Capture the Flag
setarray
[email protected]_win[0],15,8,8,8;
setarray
[email protected]_lose[0],7,4,4,4;
break;
}
donpcevent "DBG_Init::OnBGDisable"; // Disable NPC's
// Decide Winners and reset score
if(
[email protected]_T1Score <
[email protected]_T2Score) {
DBG_Reward(
[email protected]_T2,.DBG_HH_Rate,
[email protected]_win[0],
[email protected]_win[1],
[email protected]_win[2],
[email protected]_win[3]);
DBG_Reward(
[email protected]_T1,.DBG_HH_Rate,
[email protected]_lose[0],
[email protected]_lose[1],
[email protected]_lose[2],
[email protected]_lose[3]);
announce "Battleground Arena: Team 2 has won this match!",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_Status];
} else if(
[email protected]_T2Score <
[email protected]_T1Score) {
DBG_Reward(
[email protected]_T1,.DBG_HH_Rate,
[email protected]_win[0],
[email protected]_win[1],
[email protected]_win[2],
[email protected]_win[3]);
DBG_Reward(
[email protected]_T2,.DBG_HH_Rate,
[email protected]_lose[0],
[email protected]_lose[1],
[email protected]_lose[2],
[email protected]_lose[3]);
announce "Battleground Arena: Team 1 has won this match!",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_Status];
} else {
DBG_Reward(
[email protected]_T1,.DBG_HH_Rate,
[email protected]_lose[0],
[email protected]_lose[1],
[email protected]_lose[2],
[email protected]_lose[3]);
DBG_Reward(
[email protected]_T2,.DBG_HH_Rate,
[email protected]_lose[0],
[email protected]_lose[1],
[email protected]_lose[2],
[email protected]_lose[3]);
announce "Battleground Arena: It's an draw ! Nobody has won this match!",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_Status];
}
mapwarp
[email protected]_Map$[
[email protected]_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(
[email protected]_Status || !.DBG_Match) end;
donpcevent "DBG_Init::OnBGDisable";
mapwarp
[email protected]_Map$[
[email protected]_Status],"prontera",156,191;
deletearray .Team1[0],getarraysize(.Team1);
deletearray .Team2[0],getarraysize(.Team2);
if(
[email protected]_T1) {
set
[email protected]_t,bg_get_data(
[email protected]_T1,1); // Saving Player Amount of Team 1
bg_destroy
[email protected]_T1;
set
[email protected]_T1,0;
for ( set
[email protected],0;
[email protected] <
[email protected]_t; set
[email protected],
[email protected] + 1)
if(isloggedin(
[email protected][
[email protected]]) == 1 && attachrid(
[email protected][
[email protected]]) == 1) {
bg_leave;
set @DBG_Team,0;
pcblockmove getcharid(3),0;
pcblockskill getcharid(3),0;
detachrid;
}
}
if(
[email protected]_T2) {
set
[email protected]_t,bg_get_data(
[email protected]_T2,1); // Saving Player Amount of Team 2
bg_destroy
[email protected]_T2;
set
[email protected]_T2,0;
for ( set
[email protected],0;
[email protected] <
[email protected]_t; set
[email protected],
[email protected] + 1)
if(isloggedin(
[email protected][
[email protected]]) == 1 && attachrid(
[email protected][
[email protected]]) == 1) {
bg_leave;
set @DBG_Team,0;
pcblockmove getcharid(3),0;
pcblockskill getcharid(3),0;
detachrid;
}
}
set
[email protected]_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!",
[email protected]_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[
[email protected]_Status]) {
setarray .Team1[getarraysize(.Team1)],getcharid(3);
set @DBG_Team,1;
} else if(getarraysize(.Team2) <= getarraysize(.Team1) && getarraysize(.Team2) < .DBG_PlayersMax[
[email protected]_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: "
[email protected]_Mode$[
[email protected]_Status]+" - Team 1: "+getarraysize(.Team1)+"/"+.DBG_PlayersMax[
[email protected]_Status]+" : Team 2: "+getarraysize(.Team2)+"/"+.DBG_PlayersMax[
[email protected]_Status],
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_Status];
end;
// Battleground Arena - @leavebgarena command & Quit Event
OnBGLeave:
if(
[email protected]_Status ||
[email protected]_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
[email protected],0;
[email protected] < getarraysize(.Team1); set
[email protected],
[email protected] + 1)
if(getcharid(3) == .Team1[
[email protected]])
deletearray .Team1[
[email protected]],1;
else if(@DBG_Team == 2)
for ( set
[email protected],0;
[email protected] < getarraysize(.Team1); set
[email protected],
[email protected] + 1)
if(getcharid(3) == .Team1[
[email protected]])
deletearray .Team1[
[email protected]],1;
} else if(.DBG_Match) {
bg_leave;
warp "prontera",156,191;
pcblockmove getcharid(3),0;
pcblockskill getcharid(3),0;
if(getmapusers(
[email protected]_Map$[
[email protected]_Status]) < .DBG_PlayersMin[
[email protected]_Status]) {
announce "Battleground Arena: There are not enough participants to continue the match.",
[email protected]_Anno_T;
set .DBG_End,1;
donpcevent strnpcinfo(0)+"::OnBGArenaScore";
}
}
set @DBG_Team,0;
announce "Battleground Arena: ["+strcharinfo(0)+"] has left the battlefield!",
[email protected]_Anno_T;
end;
// Battleground Arena - @bgarenainfo command
OnBGInfo:
if(
[email protected]_Status)
message strcharinfo(0),"Battleground Arena: Inactive";
else {
message strcharinfo(0),"Battleground Arena: "
[email protected]_Mode$[
[email protected]_Status]+" - "
[email protected]_T1Score+" : "
[email protected]_T2Score;
if(.DBG_Match)
message strcharinfo(0),"Battleground Arena: Time Limit - "+(.DBG_TLimit[
[email protected]_Status] - .t)+" Minute"+ ( ((.DBG_TLimit[
[email protected]_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
[email protected]_pl,bg_get_data(
[email protected]_T1,1);
copyarray
[email protected]_ids[getarraysize(
[email protected]_ids)],
[email protected][0],
[email protected]_pl;
set
[email protected]_pl,bg_get_data(
[email protected]_T2,1);
copyarray
[email protected]_ids[getarraysize(
[email protected]_ids)],
[email protected][0],
[email protected]_pl;
for ( set
[email protected],0;
[email protected] < getarraysize(
[email protected]_ids); set
[email protected],
[email protected] + 1)
if(attachrid(
[email protected]_ids[
[email protected]])) {
pcblockmove getcharid(3),0; // Enable Movement
pcblockskill getcharid(3),0; // Enable Skills
if(
[email protected]_Status == 2) { // S&D
getmapxy(
[email protected]_a$,
[email protected]_x,
[email protected]_y,BL_NPC,"Target A#1");
getmapxy(
[email protected]_b$,
[email protected]_x,
[email protected]_y,BL_NPC,"Target B#2");
viewpoint 1,
[email protected]_x,
[email protected]_y,1,0xFF0000;
viewpoint 1,
[email protected]_x,
[email protected]_y,2,0x00FF00;
} else if(
[email protected]_Status == 3) { // Domination
getmapxy(
[email protected]_a$,
[email protected]_x,
[email protected]_y,BL_NPC,"Flag A#1");
getmapxy(
[email protected]_b$,
[email protected]_x,
[email protected]_y,BL_NPC,"Flag B#2");
getmapxy(
[email protected]_c$,
[email protected]_x,
[email protected]_y,BL_NPC,"Flag C#3");
viewpoint 1,
[email protected]_x,
[email protected]_y,1,0xFF0000;
viewpoint 1,
[email protected]_x,
[email protected]_y,2,0x00FF00;
viewpoint 1,
[email protected]_x,
[email protected]_y,3,0x0000FF;
} else if(
[email protected]_Status == 4) { // Rush
getmapxy(
[email protected]$,
[email protected]_x,
[email protected]_y,BL_NPC,"Defend Crystal");
viewpoint 1,
[email protected]_x,
[email protected]_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
[email protected]_item[0],7773,7829,7828;
set
[email protected]_count,bg_get_data(getarg(0),1);
// Loop through the players and give them the reward
for ( set
[email protected],0;
[email protected] <
[email protected]_count; set
[email protected],
[email protected] + 1) {
attachrid(
[email protected][
[email protected]]);
set BGArenaPts,BGArenaPts + (getarg(2)*getarg(1));
dispbottom "Battleground Arena: You have recieved "+(getarg(2)*getarg(1))+"x Battleground Arena Points.";
for ( set
[email protected],0;
[email protected] < getarraysize(
[email protected]_item); set
[email protected],
[email protected] + 1)
getitem
[email protected]_item[
[email protected]],getarg(
[email protected]+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(
[email protected]_Mode$) - 1));
if(
[email protected]_Status) // Save previous Game Mode as 2nd Vote Option
set .bg_v2,
[email protected]_Status;
else
set .bg_v2,rand(1,(getarraysize(
[email protected]_Mode$) - 1));
set .bg_v3,rand(1,(getarraysize(
[email protected]_Mode$) - 1));
// Checking of duplicate Vote Entries
while(1) {
set
[email protected],0;
set
[email protected],0;
if(.bg_v1 == .bg_v2 || .bg_v1 == .bg_v3) set
[email protected],1;
if(.bg_v3 == .bg_v2 || .bg_v3 == .bg_v1) set
[email protected],1;
if(
[email protected]) set .bg_v1,rand(1,(getarraysize(
[email protected]_Mode$) - 1));
if(
[email protected]) set .bg_v3,rand(1,(getarraysize(
[email protected]_Mode$) - 1));
if(
[email protected] &&
[email protected])
break;
sleep 100; // Preventing infinite loop
}
announce "Battleground Arena: Game Mode Voting is now possible. Use \"@votebgarena\" to vote for an Game Mode.",
[email protected]_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.",
[email protected]_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 - "
[email protected]_Mode$[.bg_v1]+" = "+.bg_v1_ct+" | "
[email protected]_Mode$[.bg_v2]+" = "+.bg_v2_ct+" | "
[email protected]_Mode$[.bg_v3]+" = "+.bg_v3_ct,
[email protected]_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
[email protected],1;
else if(.bg_v2_ct == .bg_v3_ct && .bg_v2_ct > .bg_v1_ct)
set
[email protected],2;
else if(.bg_v3_ct == .bg_v1_ct && .bg_v3_ct > .bg_v2_ct)
set
[email protected],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
[email protected],1;
else if(.bg_v2_ct > .bg_v1_ct && .bg_v2_ct > .bg_v3_ct)
set
[email protected],2;
else if(.bg_v3_ct > .bg_v1_ct && .bg_v3_ct > .bg_v2_ct)
set
[email protected],3;
set
[email protected]_Status,getd(".bg_v"
[email protected]);
donpcevent "DBGArena_Core::OnBGArenaPrepare";
end;
}
initnpctimer;
end;
OnBGVote:
if(!.Vote) {
message strcharinfo(0),"Battleground Arena: There is currently no voting running.";
end;
}
if(
[email protected]_parameters$[0] == "") {
message strcharinfo(0),"Battleground Arena: Current Votings: "+.bg_v1_ct+" : "
[email protected]_Mode$[.bg_v1]+" (1) | "+.bg_v2_ct+" : "
[email protected]_Mode$[.bg_v2]+" (2) | "+.bg_v3_ct+" : "
[email protected]_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
[email protected],atoi(
[email protected]_parameters$[0]);
setd(".bg_v"
[email protected]+"_ct"),getd(".bg_v"
[email protected]+"_ct") + 1;
message strcharinfo(0),"Battleground Arena: Vote has been confirmed. You have voted for \""
[email protected]_Mode$[getd(".bg_v"
[email protected])]+"\".";
}
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(
[email protected]_Map$[
[email protected]_Status] == "dbg_arena") {
enablenpc "Healer#1-1";
enablenpc "Healer#1-2";
} else if(
[email protected]_Map$[
[email protected]_Status] == "dbg_dom") {
enablenpc "Healer#2-1";
enablenpc "Healer#2-2";
}
end;
OnDisable:
if(
[email protected]_Map$[
[email protected]_Status] == "dbg_arena") {
disablenpc "Healer#1-1";
disablenpc "Healer#1-2";
} else if(
[email protected]_Map$[
[email protected]_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
[email protected]_Map$[
[email protected]_Status],
[email protected]_Mode$[
[email protected]_Status]+": The Match will start shortly.",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_Status];
sleep 3000;
mapannounce
[email protected]_Map$[
[email protected]DBG_Status],
[email protected]_Mode$[
[email protected]_Status]+": Until 10 seconds before the start of the match, you won't be able to move or use skills.",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_Status];
sleep 3000;
mapannounce
[email protected]_Map$[
[email protected]_Status],
[email protected]_Mode$[
[email protected]_Status]+": Think about a good strategy to win and play fair.",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_Status];
sleep 3000;
switch(
[email protected]_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
[email protected]_Map$[
[email protected]_Status],
[email protected]_Mode$[
[email protected]_Status]+": Team 1 has to destroy one of the targets by using the bomb, which can be picked up!",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_Status];
sleep 3000;
mapannounce
[email protected]_Map$[
[email protected]_Status],
[email protected]_Mode$[
[email protected]_Status]+": Team 2 has to defend both targets and defuse the bomb, if it was planted.",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_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
[email protected]_Map$[
[email protected]_Status],
[email protected]_Mode$[
[email protected]_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!",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_Status];
sleep 3000;
mapannounce
[email protected]_Map$[
[email protected]_Status],
[email protected]_Mode$[
[email protected]_Status]+": Holding Flags gives Points every 5 seconds. The more flags your team holds the more points you will get!",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_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
[email protected]_Map$[
[email protected]_Status],
[email protected]_Mode$[
[email protected]_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!",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_Status];
sleep 3000;
mapannounce
[email protected]_Map$[
[email protected]_Status],
[email protected]_Mode$[
[email protected]_Status]+": Team 1 has "+getvariableofnpc(.Rush_Life,"DBGArena_Core")+" Lifes. If they hit \"0\" Team 2 wins!",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_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
[email protected]_Map$[
[email protected]_Status],
[email protected]_Mode$[
[email protected]_Status]+": Each Team has a flag to protect while stealing the enemies flag!",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_Status];
sleep 3000;
mapannounce
[email protected]_Map$[
[email protected]_Status],
[email protected]_Mode$[
[email protected]_Status]+": The first team to bring the enemies flag to their own wins the round!",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_Status];
sleep 3000;
}
break;
}
set .NoAnno,0;
mapannounce
[email protected]_Map$[
[email protected]_Status],
[email protected]_Mode$[
[email protected]_Status]+": The Match will start in 1 Minute!",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_Status];
sleep 50000; // 50 sec
mapannounce
[email protected]_Map$[
[email protected]_Status],
[email protected]_Mode$[
[email protected]_Status]+": 10 Seconds left, you can now move and buff your members!",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_Status];
donpcevent "DBGArena_Core::OnBGPlayerBlock";
donpcevent "#DBG_Heal::OnEnable";
sleep 10000; // 10 sec
mapannounce
[email protected]_Map$[
[email protected]_Status],
[email protected]_Mode$[
[email protected]_Status]+": The Match starts now! Good luck to both Teams!",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_Status];
donpcevent "DBGArena_Core::OnBGArenaTimer"; // Start the Timer in DBGArena_Core for Time Limit
if(
[email protected]_Status == 3) // Start flag timer for Domination
initnpctimer;
else if(
[email protected]_Status == 4) // Spawn Crystal for Rush
bg_monster
[email protected]_T2,
[email protected]_Map$[
[email protected]_Status],.mob[0],.mob[1],"Defend Crystal",1914,strnpcinfo(0)+"::OnRushMobDeath";
end;
// Round Reset - Basically only for S&D / Rush / CTF
OnRoundReset:
if(
[email protected]_Status == 2 && .SAD_Win > 0) {
set
[email protected]$,"SAD";
setd(".T"+.SAD_Win+"_Score"),getd(".T"+.SAD_Win+"_Score") + 1;
mapannounce
[email protected]_Map$[
[email protected]_Status],
[email protected]_Mode$[
[email protected]_Status]+": [Team "+.SAD_Win+"] has scored 1 Point!",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_Status];
set .SAD_Win,0;
} else if(
[email protected]_Status == 4 && .Rush_Win > 0) {
set
[email protected]$,"Rush";
setd(".T"+.Rush_Win+"_Score"),getd(".T"+.Rush_Win+"_Score") + 1;
mapannounce
[email protected]_Map$[
[email protected]_Status],
[email protected]_Mode$[
[email protected]_Status]+": [Team "+.Rush_Win+"] has scored 1 Point!",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_Status];
set .Rush_Win,0;
} else if(
[email protected]_Status == 5 && .CTF_Win > 0) {
set
[email protected]$,"CTF";
setd(".T"+.CTF_Win+"_Score"),getd(".T"+.CTF_Win+"_Score") + 1;
mapannounce
[email protected]_Map$[
[email protected]_Status],
[email protected]_Mode$[
[email protected]_Status]+": [Team "+.CTF_Win+"] has scored 1 Point!",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_Status];
set .CTF_Win,0;
}
sleep 2000;
donpcevent strnpcinfo(0)+"::OnBGDisable";
donpcevent strnpcinfo(0)+"::OnBGRoundScore";
set .rounds,.rounds + 1;
mapannounce
[email protected]_Map$[
[email protected]_Status],
[email protected]_Mode$[
[email protected]_Status]+": Round "+.rounds+" has finished!",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_Status];
sleep 2000;
if(.rounds < getd("."
[email protected]$+"_RoundSwap")) {
mapannounce
[email protected]_Map$[
[email protected]_Status],
[email protected]_Mode$[
[email protected]_Status]+": Starting Round "+(.rounds+1)+" in a few seconds!",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_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
[email protected]_T1Score,
[email protected]_T1Score + 1;
else if(.T2_Score > .T1_Score)
set
[email protected]_T2Score,
[email protected]_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
[email protected]_Map$[
[email protected]_Status],
[email protected]_Mode$[
[email protected]_Status]+": End of the match! Switching Teams....",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_Status];
sleep 2000;
set .rounds,0;
// Swapping Teams
set
[email protected],
[email protected]_T2;
set
[email protected],
[email protected]_T1;
set
[email protected]_T1,
[email protected];
set
[email protected]_T2,
[email protected];
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
[email protected]_Map$[
[email protected]_Status],.T1_Score,.T2_Score;
end;
// Domination - Flag Timer
OnTimer5000: // Every 5th second
stopnpctimer;
if((
[email protected]_T1Score + .flags_pts[
[email protected]_Flag_CT1]) < 100)
set
[email protected]_T1Score,
[email protected]_T1Score + .flags_pts[
[email protected]_Flag_CT1];
else
set
[email protected]_T1Score,100;
if((
[email protected]_T2Score + .flags_pts[
[email protected]_Flag_CT2]) < 100)
set
[email protected]_T2Score,
[email protected]_T2Score + .flags_pts[
[email protected]_Flag_CT2];
else
set
[email protected]_T2Score,100;
donpcevent "DBGArena_Core::OnBGArenaScore";
initnpctimer;
end;
// Rush - Crystal Death Event
OnRushMobDeath:
mapannounce
[email protected]_Map$[
[email protected]_Status],
[email protected]_Mode$[
[email protected]_Status]+": [Team 1] has destroyed the Crystal!",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_Status];
set .Rush_Win,1;
donpcevent strnpcinfo(0)+"::OnRoundReset";
end;
OnFlagMark:
deltimer strnpcinfo(0)+"::OnFlagMark";
if(
[email protected]_Flag) end;
specialeffect2 .f_effect;
addtimer .f_effect_t,strnpcinfo(0)+"::OnFlagMark";
end;
OnBGDisable:
switch(
[email protected]_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
[email protected]_Map$[
[email protected]_Status];
end;
OnInit:
// ======= Search and Destroy =====
// Saving original coordiantes of the bomb
getmapxy(
[email protected]$,.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(
[email protected]$,.CTF1_x,.CTF1_y,BL_NPC,"Team 1 Flag#1");
getmapxy(
[email protected]$,.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)+".",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_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(
[email protected]_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(
[email protected]$,@x,@y,BL_PC);
setd(".Planting_"+strnpcinfo(2)),1;
}
}
end;
OnBombPlant:
deltimer strnpcinfo(0)+"::OnBombPlant";
getmapxy(
[email protected]$,
[email protected],
[email protected],BL_PC);
if(
[email protected] != @x &&
[email protected] != @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!",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_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,
[email protected]_Anno$[
[email protected]_Status];
while(
[email protected] < .flag_timer) {
misceffect (
[email protected]);
set
[email protected],
[email protected] + 1;
sleep 1000;
}
setd(".TakeOver_F"+strnpcinfo(2)),0;
getmapxy(
[email protected]$,
[email protected]_x,
[email protected]_y,BL_NPC);
set
[email protected]_T1,bg_getareausers(
[email protected]_T1,strnpcinfo(4),(
[email protected]_x-3),(
[email protected]_y-3),(
[email protected]_x+3),(
[email protected]_y+3));
set
[email protected]_T2,bg_getareausers(
[email protected]_T2,strnpcinfo(4),(
[email protected]_x-3),(
[email protected]_y-3),(
[email protected]_x+3),(
[email protected]_y+3));
if(!getd(".Flag"+strnpcinfo(2)+"_Group")) { // Neutral Flag
if(
[email protected]_T1 >
[email protected]_T2) {
set
[email protected]_Flag_CT1,
[email protected]_Flag_CT1 + 1;
setd(".Flag"+strnpcinfo(2)+"_Group"),1;
} else if(
[email protected]_T2 >
[email protected]_T1) {
set
[email protected]_Flag_CT2,
[email protected]_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(
[email protected]_T1 <
[email protected]_T2) {
set
[email protected]_Flag_CT1,
[email protected]_Flag_CT1 - 1;
set
[email protected]_Flag_CT2,
[email protected]_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(
[email protected]_T2 <
[email protected]_T1) {
set
[email protected]_Flag_CT1,
[email protected]_Flag_CT1 + 1;
set
[email protected]_Flag_CT2,
[email protected]_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")+"!",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_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 "
[email protected]_Team+" has succesfully conquered the enemies Flag!",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_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)+"]!",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_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 "
[email protected]_Team+" has been saved by ["+strcharinfo(0)+"]!",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_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)+"]!",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_Status];
}
}
end;
OnInit:
// Saving original coordiantes and Names of the flags
if(strnpcinfo(2) != "") {
getmapxy(
[email protected]$,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(
[email protected]_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
[email protected],1;
[email protected] < getarraysize(
[email protected]_Mode$); set
[email protected],
[email protected] + 1)
set
[email protected]_menu$,
[email protected]_menu$ + "- "
[email protected]_Mode$[
[email protected]]+ ( (
[email protected]_Mode$[
[email protected]+1] != "")?":":"");
set
[email protected],select(
[email protected]_menu$);
mes .n$;
mes
[email protected]_Mode$[
[email protected]]+", it is?";
if(select("- Yes:- No") - 1) close;
next;
mes .n$;
mes "Okay, here we go.";
set
[email protected]_Status,
[email protected];
close2;
announce "An warrior is calling out for others to participate in the Battleground Arena.",
[email protected]_Anno_T,
[email protected]_Anno$[
[email protected]_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(
[email protected]_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
[email protected],0;
[email protected] < getarraysize(@bought_nameid); set
[email protected],
[email protected] + 1)
for ( set
[email protected],0;
[email protected] < getarraysize(.bg_shop); set
[email protected],
[email protected] + 2)
if(@bought_nameid[
[email protected]] == .bg_shop[
[email protected]]) {
if(checkweight(@bought_nameid[
[email protected]],@bought_nameid[
[email protected]]) == 0) {
npctalk "Battleground Shop: You can't buy this many items, you would be overweight!!",strnpcinfo(0),bc_self;
end;
}
set
[email protected],
[email protected] + (.bg_shop[
[email protected]+1]*@bought_quantity[
[email protected]]);
}
if(
[email protected] > BGArenaPts) {
npctalk "Battleground Shop: I'm sorry, but you don't have the required Arena Points. You are missing "+(
[email protected])+" Points.",strnpcinfo(0),bc_self;;
end;
}
for ( set
[email protected],0;
[email protected] < getarraysize(@bought_nameid); set
[email protected],
[email protected] + 1)
getitem @bought_nameid[
[email protected]],@bought_quantity[
[email protected]];
set BGArenaPts,BGArenaPts -
[email protected];
dispbottom "Battleground Shop: You have paied "
[email protected]+" 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
[email protected],0;
[email protected] < getarraysize(.bg_shop); set
[email protected],
[email protected] + 2)
npcshopadditem "DBG_Shop",.bg_shop[
[email protected]],.bg_shop[
[email protected]+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
Anyone can help me with this?
Tks a lot.