Advertisement
Guest User

PVP4v4-Jezznar

a guest
Sep 30th, 2015
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.63 KB | None | 0 0
  1. // ------------------------------------------------------------------------------------------
  2. // ------ rAthena Script Release
  3. // Title: PvP [4v4] Rewrite
  4. // Author: jezznar
  5. // Version: 1.0 Jezznar
  6. // Search for "getitem" to change rewards and their quantity
  7. // ------------------------------------------------------------------------------------------
  8. prontera,145,186,6 script 7vs7 Recruiter 416,{
  9. set .@n$,"[^FF0000Party Battle Recruiter^000000]";
  10. set .@charid,getcharid(0);
  11. set .@rid,getcharid(3);
  12. mes .@n$;
  13. mes "Would you like to register for a 4 versus 4 Party Battle?";
  14. next;
  15. Select("Yes:No");
  16. if (@menu == 2)
  17. end;
  18. // Check if there is free slot
  19. if (getarraysize($Odin) >= 1 && getarraysize($Freya) >= 1) {
  20. mes "Sorry, there are no slots available right now. Please come back again later.";
  21. close;
  22. } else if (getmapusers("guild_vs3") > 0) { // Check if there is an on-going session
  23. mes .@n$;
  24. mes "There appears to be a match currently in session. Check back momentarily.";
  25. close;
  26. }
  27.  
  28. // Check if character is already registered
  29. for (set .@x, 0; .@x < 1; set .@x, .@x + 1){
  30. if ($Odin[.@x] == .@charid){
  31. mes "You are already registered in slot "+(.@x+1)+" of the Odin Team.";
  32. if(getarraysize($Freya) <= 1){
  33. menu "Transfer to other side?",-;
  34. for( set .y, 0; .y < 1; set .y, y++){
  35. if(!attachrid($Freya[.y])){
  36. set $Freya[.y], $Odin[.@x];
  37. set $Odin[.@x], 0;
  38. }
  39. }
  40. }
  41. close;
  42. }
  43. else if ($Freya[.@x] == .@charid){
  44. mes "You are already registered in slot "+(.@x+1)+" of the Freya Team.";
  45. if(getarraysize($Odin) <= 1){
  46. menu "Transfer to other side?",-;
  47. for( set .y, 0; .y < 1; set .y, y++){
  48. if(!attachrid($Odin[.y])){
  49. set $Odin[.y], $Freya[.@x];
  50. set $Freya[.@x], 0;
  51. }
  52. }
  53. }
  54. close;
  55. }
  56. }
  57.  
  58.  
  59.  
  60. mes .@n$;
  61. mes "Which side are you going to play for?";
  62. next;
  63.  
  64. switch(select("Odin ("+(getarraysize($Odin))+"/1):Freya ("+(getarraysize($Freya))+"/1)")) {
  65. case 1:
  66. if (getarraysize($Odin) < 1) {
  67. if (getarraysize($Odin) == 0 && getarraysize($Freya) == 0 && .OnGMStart == 0) { // Check if he is the first one to register & not manually started by a GM
  68. initnpctimer;
  69. announce "The PvP[7v7] Event has been triggered by "+strcharinfo(0)+"! Join now!",bc_all;
  70. }
  71. set $Odin[getarraysize($Odin)], .@charid;
  72. set $OdinR[getarraysize($OdinR)], .@rid;
  73. npctalk strcharinfo(0)+" has entered the round on Odin's Side.";
  74. close;
  75.  
  76. } else {
  77. mes "This team is full.";
  78. close;
  79. }
  80. break;
  81. case 2:
  82. if (getarraysize($Freya) < 1) {
  83. if (getarraysize($Odin) == 0 && getarraysize($Freya) == 0 && .OnGMStart == 0) { // Check if he is the first one to register & not manually started by a GM
  84. initnpctimer;
  85. announce "The PvP[7v7] Event has been triggered by "+strcharinfo(0)+"! Join now!",bc_all;
  86. }
  87. set $Freya[getarraysize($Freya)], .@charid;
  88. set $FreyaR[getarraysize($FreyaR)], .@rid;
  89. npctalk strcharinfo(0)+" has entered the round on Freya's Side.";
  90. close;
  91. } else {
  92. mes "This team is full.";
  93. close;
  94. }
  95. break;
  96. }
  97.  
  98. if((getarraysize($Odin)) >= 1 && (getarraysize($Freya)) >= 1) {
  99. stopnpctimer;
  100. callsub OnEventStart;
  101. close;
  102. }
  103.  
  104. close;
  105. end;
  106.  
  107.  
  108. OnEventStart:
  109. set $OdinCount, 1; // Set team alive player counter
  110. set $FreyaCount, 1; // Set team alive player counter
  111. npctalk "Both teams have been filled. All participants currently logged in will be transferred to the arena in ten seconds.";
  112. sleep2 10000;
  113. //Warp all participants to the event place - guild_vs3
  114. for(set .i,0; .i < 14; set .i,.i++){
  115. if(!attachrid($Freya[.i]) || !attachrid($Odin[.i])) { goto OnFailLack; }
  116. }
  117. for (set .@x, 0; .@x < 1; set .@x, .@x + 1) {
  118. warpchar "guild_vs3",18,50,$Odin[.@x];
  119. warpchar "guild_vs3",83,50,$Freya[.@x];
  120. }
  121. end;
  122.  
  123. L_cancel:
  124. mes .@n$;
  125. mes "Do come back if you change your mind.";
  126. close;
  127. end;
  128.  
  129.  
  130.  
  131. OnTimer10000:
  132. npctalk "Ten seconds have passed. Entry to the round ends in 20 seconds.";
  133. end;
  134. OnTimer20000:
  135. npctalk "Twenty seconds have passed. Entry to the round ends in 10 seconds.";
  136. end;
  137. OnTimer30000:
  138. npctalk "Thirty seconds have passed and thus I have canceled the round.";
  139. stopnpctimer;
  140. goto OnClear;
  141. end;
  142.  
  143. OnFailLack:
  144. announce "7 vs 7 Event has failed due to a missing participant.",0;
  145. sleep 10000;
  146. announce "Event has been reset. Please register again.",0;
  147. set .OnGMStart, 0;
  148. cleararray $Odin,0,1;
  149. cleararray $Freya,0,1;
  150. end;
  151.  
  152. OnClear:
  153. set .OnGMStart, 0;
  154. cleararray $Odin,0,1;
  155. cleararray $Freya,0,1;
  156. stopnpctimer;
  157. end;
  158.  
  159. OnAtCommand:
  160. if (.@atcmd_parameters$[0] == "on"){
  161. initnpctimer;
  162. announce "A GM has started a PvP[7v7] Event! Join now!",bc_all;
  163. set .OnGMStart, 1;
  164. } else if (.@atcmd_parameters$[0] == "off"){
  165. stopnpctimer;
  166. announce "A GM has stopped a PvP[7v7] Event!",bc_all;
  167. for (set .@x, 0; .@x < 1; set .@x, .@x + 1) { // warp all characters out if a session was on-going
  168. warpchar "prontera",156,191,$Odin[.@x];
  169. warpchar "prontera",156,191,$Freya[.@x];
  170. }
  171. callsub OnClear;
  172. set .OnGMStart, 0;
  173. }
  174. end;
  175.  
  176.  
  177. OnInit:
  178. bindatcmd "4v4", strnpcinfo(0)+"::OnAtCommand";
  179. set .OnGMStart, 0;
  180. end;
  181.  
  182. OnPCDieEvent:
  183. if(strcharinfo(3) == "guild_vs3") { warp "SavePoint",0,0;}
  184. end;
  185.  
  186.  
  187. OnPCKillEvent:
  188. if( strcharinfo(3) == "guild_vs3") {
  189. mapannounce "guild_vs3","PvP[7v7] Event:"+strcharinfo(0)+" has killed "+rid2name(killedrid)+".",1,0xD6A4E6;
  190. Getitem 607, 5; //Reward for killing a member of the other team
  191. for (set .@x, 0; .@x < 1; set .@x, .@x + 1) { // Decrease Team Alive Player Counter
  192. if ($OdinR[.@x] == killedrid)
  193. set $OdinCount, $OdinCount - 1;
  194. else if ($FreyaR[.@x] == killedrid)
  195. set $FreyaCount, $FreyaCount - 1;
  196. }
  197. mapannounce "guild_vs3","PvP[7v7] Event: Odin:"+$OdinCount+" Freya:"+$FreyaCount,1,0xD6A4E6;
  198. if ($OdinCount <= 0){ // Check if Team Odin is all dead
  199. mapannounce "guild_vs3","PvP[4v4] Event: The Odin Team has dominated this round!",1,0xD6A4E6;
  200. //Reward all of Team Freya for kill of Team Odin
  201. for (set .@x, 0; .@x < 1; set .@x, .@x + 1){
  202. detachrid; //detach killer rid
  203. attachrid($FreyaR[.@x]);
  204. getitem 607, 50; //reward for winning the round
  205. warp "SavePoint",0,0;
  206. detachrid;
  207. }
  208. callsub OnClear;
  209. }
  210. else if ($FreyaCount <= 0){ // Check if Team Freya is all dead
  211. mapannounce "guild_vs3","PvP[7v7] Event: The Freya Team has dominated this round!",1,0xD6A4E6;
  212. //Reward all of Team Freya for kill of Team Odin
  213. for (set .@x, 0; .@x < 1; set .@x, .@x + 1){
  214. detachrid; //detach killer rid
  215. attachrid($OdinR[.@x]);
  216. getitem 607, 50; //reward for winning the round
  217. warp "SavePoint",0,0;
  218. detachrid;
  219. }
  220. callsub OnClear;
  221. }
  222. }
  223. end;
  224. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement