Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ------------------------------------------------------------------------------------------
- // ------ rAthena Script Release
- // Title: PvP [4v4] Rewrite
- // Author: jezznar
- // Version: 1.0 Jezznar
- // Search for "getitem" to change rewards and their quantity
- // ------------------------------------------------------------------------------------------
- prontera,145,186,6 script 7vs7 Recruiter 416,{
- set .@n$,"[^FF0000Party Battle Recruiter^000000]";
- set .@charid,getcharid(0);
- set .@rid,getcharid(3);
- mes .@n$;
- mes "Would you like to register for a 4 versus 4 Party Battle?";
- next;
- Select("Yes:No");
- if (@menu == 2)
- end;
- // Check if there is free slot
- if (getarraysize($Odin) >= 1 && getarraysize($Freya) >= 1) {
- mes "Sorry, there are no slots available right now. Please come back again later.";
- close;
- } else if (getmapusers("guild_vs3") > 0) { // Check if there is an on-going session
- mes .@n$;
- mes "There appears to be a match currently in session. Check back momentarily.";
- close;
- }
- // Check if character is already registered
- for (set .@x, 0; .@x < 1; set .@x, .@x + 1){
- if ($Odin[.@x] == .@charid){
- mes "You are already registered in slot "+(.@x+1)+" of the Odin Team.";
- if(getarraysize($Freya) <= 1){
- menu "Transfer to other side?",-;
- for( set .y, 0; .y < 1; set .y, y++){
- if(!attachrid($Freya[.y])){
- set $Freya[.y], $Odin[.@x];
- set $Odin[.@x], 0;
- }
- }
- }
- close;
- }
- else if ($Freya[.@x] == .@charid){
- mes "You are already registered in slot "+(.@x+1)+" of the Freya Team.";
- if(getarraysize($Odin) <= 1){
- menu "Transfer to other side?",-;
- for( set .y, 0; .y < 1; set .y, y++){
- if(!attachrid($Odin[.y])){
- set $Odin[.y], $Freya[.@x];
- set $Freya[.@x], 0;
- }
- }
- }
- close;
- }
- }
- mes .@n$;
- mes "Which side are you going to play for?";
- next;
- switch(select("Odin ("+(getarraysize($Odin))+"/1):Freya ("+(getarraysize($Freya))+"/1)")) {
- case 1:
- if (getarraysize($Odin) < 1) {
- if (getarraysize($Odin) == 0 && getarraysize($Freya) == 0 && .OnGMStart == 0) { // Check if he is the first one to register & not manually started by a GM
- initnpctimer;
- announce "The PvP[7v7] Event has been triggered by "+strcharinfo(0)+"! Join now!",bc_all;
- }
- set $Odin[getarraysize($Odin)], .@charid;
- set $OdinR[getarraysize($OdinR)], .@rid;
- npctalk strcharinfo(0)+" has entered the round on Odin's Side.";
- close;
- } else {
- mes "This team is full.";
- close;
- }
- break;
- case 2:
- if (getarraysize($Freya) < 1) {
- if (getarraysize($Odin) == 0 && getarraysize($Freya) == 0 && .OnGMStart == 0) { // Check if he is the first one to register & not manually started by a GM
- initnpctimer;
- announce "The PvP[7v7] Event has been triggered by "+strcharinfo(0)+"! Join now!",bc_all;
- }
- set $Freya[getarraysize($Freya)], .@charid;
- set $FreyaR[getarraysize($FreyaR)], .@rid;
- npctalk strcharinfo(0)+" has entered the round on Freya's Side.";
- close;
- } else {
- mes "This team is full.";
- close;
- }
- break;
- }
- if((getarraysize($Odin)) >= 1 && (getarraysize($Freya)) >= 1) {
- stopnpctimer;
- callsub OnEventStart;
- close;
- }
- close;
- end;
- OnEventStart:
- set $OdinCount, 1; // Set team alive player counter
- set $FreyaCount, 1; // Set team alive player counter
- npctalk "Both teams have been filled. All participants currently logged in will be transferred to the arena in ten seconds.";
- sleep2 10000;
- //Warp all participants to the event place - guild_vs3
- for(set .i,0; .i < 14; set .i,.i++){
- if(!attachrid($Freya[.i]) || !attachrid($Odin[.i])) { goto OnFailLack; }
- }
- for (set .@x, 0; .@x < 1; set .@x, .@x + 1) {
- warpchar "guild_vs3",18,50,$Odin[.@x];
- warpchar "guild_vs3",83,50,$Freya[.@x];
- }
- end;
- L_cancel:
- mes .@n$;
- mes "Do come back if you change your mind.";
- close;
- end;
- OnTimer10000:
- npctalk "Ten seconds have passed. Entry to the round ends in 20 seconds.";
- end;
- OnTimer20000:
- npctalk "Twenty seconds have passed. Entry to the round ends in 10 seconds.";
- end;
- OnTimer30000:
- npctalk "Thirty seconds have passed and thus I have canceled the round.";
- stopnpctimer;
- goto OnClear;
- end;
- OnFailLack:
- announce "7 vs 7 Event has failed due to a missing participant.",0;
- sleep 10000;
- announce "Event has been reset. Please register again.",0;
- set .OnGMStart, 0;
- cleararray $Odin,0,1;
- cleararray $Freya,0,1;
- end;
- OnClear:
- set .OnGMStart, 0;
- cleararray $Odin,0,1;
- cleararray $Freya,0,1;
- stopnpctimer;
- end;
- OnAtCommand:
- if (.@atcmd_parameters$[0] == "on"){
- initnpctimer;
- announce "A GM has started a PvP[7v7] Event! Join now!",bc_all;
- set .OnGMStart, 1;
- } else if (.@atcmd_parameters$[0] == "off"){
- stopnpctimer;
- announce "A GM has stopped a PvP[7v7] Event!",bc_all;
- for (set .@x, 0; .@x < 1; set .@x, .@x + 1) { // warp all characters out if a session was on-going
- warpchar "prontera",156,191,$Odin[.@x];
- warpchar "prontera",156,191,$Freya[.@x];
- }
- callsub OnClear;
- set .OnGMStart, 0;
- }
- end;
- OnInit:
- bindatcmd "4v4", strnpcinfo(0)+"::OnAtCommand";
- set .OnGMStart, 0;
- end;
- OnPCDieEvent:
- if(strcharinfo(3) == "guild_vs3") { warp "SavePoint",0,0;}
- end;
- OnPCKillEvent:
- if( strcharinfo(3) == "guild_vs3") {
- mapannounce "guild_vs3","PvP[7v7] Event:"+strcharinfo(0)+" has killed "+rid2name(killedrid)+".",1,0xD6A4E6;
- Getitem 607, 5; //Reward for killing a member of the other team
- for (set .@x, 0; .@x < 1; set .@x, .@x + 1) { // Decrease Team Alive Player Counter
- if ($OdinR[.@x] == killedrid)
- set $OdinCount, $OdinCount - 1;
- else if ($FreyaR[.@x] == killedrid)
- set $FreyaCount, $FreyaCount - 1;
- }
- mapannounce "guild_vs3","PvP[7v7] Event: Odin:"+$OdinCount+" Freya:"+$FreyaCount,1,0xD6A4E6;
- if ($OdinCount <= 0){ // Check if Team Odin is all dead
- mapannounce "guild_vs3","PvP[4v4] Event: The Odin Team has dominated this round!",1,0xD6A4E6;
- //Reward all of Team Freya for kill of Team Odin
- for (set .@x, 0; .@x < 1; set .@x, .@x + 1){
- detachrid; //detach killer rid
- attachrid($FreyaR[.@x]);
- getitem 607, 50; //reward for winning the round
- warp "SavePoint",0,0;
- detachrid;
- }
- callsub OnClear;
- }
- else if ($FreyaCount <= 0){ // Check if Team Freya is all dead
- mapannounce "guild_vs3","PvP[7v7] Event: The Freya Team has dominated this round!",1,0xD6A4E6;
- //Reward all of Team Freya for kill of Team Odin
- for (set .@x, 0; .@x < 1; set .@x, .@x + 1){
- detachrid; //detach killer rid
- attachrid($OdinR[.@x]);
- getitem 607, 50; //reward for winning the round
- warp "SavePoint",0,0;
- detachrid;
- }
- callsub OnClear;
- }
- }
- end;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement