yuhsing

Untitled

Mar 28th, 2013
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.89 KB | None | 0 0
  1.  
  2. // 1. 3v3 an 5v5 menu to choose from
  3. // 2. Party leader must already have party of 3 or 5 so he can talk to NPC to register.
  4. // 3. If he still do not have party the NPC will say to make party with 3 or 5 members.
  5. // 4. Once he registers the NPC will announce that party (partyname) is waiting for a 3v3 or 5v5 event (whatever he registered on)
  6. // 5. Announcement will be every minute until 15 mins then cancel the registration. Cancellation of registration is also announced when after 15 mins.
  7. // 6. used maps will be guild_vs1-3 and guild_vs2-2. The first to register will choose which map to use and it will be included in the announcement.
  8. // 7. Now the joining party with 3 or 5 members will talk to NPC and if they are complete they are accepted. if they are not complete then the NPC will say to make party with 3 or 5 members (whatever is needed by the first registered party).
  9. // 8. Both teams will be warped at the same time and that is already the start of the match. But Announcement first of "In 1 minute both party A (partyname) and Party B (partyname) will be warped to the Arena and start the match.". Then after 1 minute countdown of "Party recalling in 5", 4 3 2 1 before warp.
  10. // 9. both party leaders will have to pay 3 pcs or 5pcs item 7179 upon registering. Whoever wins will get all 6 pcs (or 10 pcs) 7179 from the NPC. Its like a bet match.
  11.  
  12.  
  13.  
  14. function script ValueConvert {
  15. set .@num, atoi(""+getarg(0));
  16. if ( .@num == 0 || .@num >= 2147483647 ) return getarg(0);
  17. set .@l, getstrlen(""+.@num);
  18. for ( set .@i,0; .@i < .@l; set .@i, .@i + 1 ) {
  19. set .@num$, .@num % pow(10,.@i+1) / pow(10,.@i) + .@num$;
  20. if ( (.@i+1) % 3 == 0 && .@i+1 != .@l ) set .@num$, ","+ .@num$;
  21. }
  22. return .@num$;
  23. }
  24.  
  25.  
  26. prontera,155,181,5 script Sample#myro 757,{
  27. set .@gmlevel,getgmlevel();
  28. set .@partyid,getcharid(1);
  29.  
  30. callsub display_event_info;
  31. next;
  32. switch( select( ( .status == 1 )?"Register":( .status == 2 )?"Join / Quit Match":"",
  33. ( .@gmlevel < .gm_level || .status )?"":"Configurations",
  34. ( .@gmlevel < .gm_level || !.status )?"":"Stop Event" ) ){
  35.  
  36. Case 1:
  37. if( getcharid(0) != getpartyleader( .@partyid,2 ) ){
  38. mes "Only Party Leader can register.";
  39. }else if( .@partyid == .team[0] ){
  40. if( !.team[1] ){
  41. if( select("Quit Match","Cancel") == 1 ){
  42. set .team[0],0;
  43. set .status,1;
  44. stopnpctimer;
  45. if( $match_amount && $match_itemid ){
  46. message strcharinfo(0),"Retrieved "+callfunc( "ValueConvert", $match_amount )+" x "+getitemname( $match_itemid )+".";
  47. getitem $match_itemid,$match_amount;
  48. }
  49. if( $zeny ){
  50. message strcharinfo(0),"Retrieved "+callfunc( "ValueConvert", $zeny )+" Zeny.";
  51. set Zeny,Zeny + $zeny;
  52. }
  53. }
  54.  
  55. }else{
  56. mes "Cant quit since team 2 already joined.";
  57. }
  58. close;
  59. }else{
  60.  
  61. set .@count,callsub( count_party_member,.@partyid );
  62. if( .@count != $party_member ){
  63. mes "Please make a party of ^FF0000"+$party_member+" online members^000000.";
  64. mes " ";
  65. mes "You have "+.@count+" members online now.";
  66.  
  67. }else{
  68.  
  69. if( $match_itemid )
  70. if( countitem( $match_itemid ) < $match_amount ){
  71. mes "You need "+callfunc( "ValueConvert", $match_amount )+" x "+getitemname( $match_itemid );
  72. close;
  73. }
  74.  
  75. if( $zeny )
  76. if( Zeny < $zeny ){
  77. mes "You need "+callfunc( "ValueConvert", $zeny )+" Zeny";
  78. close;
  79. }
  80.  
  81. if( $match_itemid ){
  82. set .@amount,$match_amount;
  83. message strcharinfo(0),"Paid "+callfunc( "ValueConvert", .@amount )+" x "+getitemname( $match_itemid )+".";
  84. delitem $match_itemid,.@amount;
  85. }
  86.  
  87. if( $zeny ){
  88. message strcharinfo(0),"Total of "+callfunc( "ValueConvert", $zeny )+" Zeny deducted.";
  89. set Zeny,Zeny - $zeny;
  90. }
  91.  
  92. switch( .status ){
  93. Case 1:
  94. mes "You may decide the map now.";
  95. set .map,select( .map_name_menu$ ) - 1;
  96. mes "Your team has been registered.";
  97. set .team[0],.@partyid;
  98. set .status,2;
  99. set .minute,0;
  100. initnpctimer;
  101. break;
  102. Case 2:
  103. mes "Your team has joined the match.";
  104. set .team[1],.@partyid;
  105. set .status,3;
  106. stopnpctimer;
  107. close2;
  108. donpcevent strnpcinfo(0)+"::OnEventStart";
  109. end;
  110. break;
  111. default:
  112. mes "Registration closed.";
  113. close;
  114. }
  115. }
  116. }
  117. break;
  118. Case 2:
  119. while( 1 ){
  120.  
  121. callsub display_event_info;
  122. next;
  123. switch( select( "Edit Party Member","Required Item","Required Zeny","^FF0000Start Event^000000" ) ){
  124. Case 1:
  125. mes "Enter the Amount of Party Member required.";
  126. mes "^777777( 0 ~ 10 )^000000";
  127. input $party_member,0,10;
  128. break;
  129. Case 2:
  130. mes "Enter item ID :";
  131. do{
  132. input .@input;
  133. }while( getitemname( .@input ) == "null" );
  134. mes "Enter Amount : "+getitemname( .@input );
  135. mes "^777777( 0 ~ "+callfunc( "ValueConvert", 30000 )+" )^000000";
  136. input $match_amount,0,30000;
  137. if( $match_amount ) set $match_itemid,.@input;
  138. break;
  139. Case 3:
  140. mes "Enter Zeny amount :";
  141. mes "^777777( 0 ~ "+callfunc( "ValueConvert", 10000000 )+" )^000000";
  142. input $zeny,0,10000000;
  143. break;
  144. Case 4:
  145. if( $party_member < 1 ){
  146. mes "^FF0000Invalid^000000. Minimum 1 Party Member.";
  147. }else if( !$match_amount && !$zeny ){
  148. mes "^FF0000Invalid^000000. Required 1 item or Zeny.";
  149. }else{
  150. mes "Event started.";
  151. announce "An Event has been started by GM, registration are now opened.",0;
  152. set .status,1;
  153. close;
  154. }
  155. break;
  156. }
  157. next;
  158. }
  159. break;
  160. Case 3:
  161. mes "Event Cancelled";
  162. close2;
  163. announce "Event has been cancelled by GM.",0;
  164. mapwarp .map_list$[.map],.npc_map$,.npc_x,.npc_y;
  165. callsub( clear_variable );
  166. end;
  167. default: break;
  168. }
  169. close;
  170.  
  171.  
  172.  
  173. OnInit:
  174. // Minimum GM Level to access cp.
  175. set .gm_level,80;
  176. // Map Name List
  177. setarray .map_name$,"Map 1","Map 2";
  178. setarray .map_list$,"guild_vs1-3","guild_vs2-2";
  179.  
  180. // map flag initialize
  181. set .map_size,getarraysize( .map_list$ );
  182. for( set .@i,0; .@i < .map_size; set .@i,.@i + 1 ){
  183. set .map_name_menu$,.map_name_menu$ + .map_name$[.@i] +":";
  184. setmapflag .map_list$[.@i],mf_partylock;
  185. setmapflag .map_list$[.@i],mf_nogo;
  186. setmapflag .map_list$[.@i],mf_pvp;
  187. setmapflag .map_list$[.@i],mf_battleground,2;
  188. bg_updatescore .map_list$[.@i],.score[ 0 ],.score[ 1 ];
  189. }
  190.  
  191. // npc locations
  192. getmapxy( .npc_map$,.npc_x,.npc_y,1 );
  193. end;
  194.  
  195. display_event_info:
  196. mes "^FF0000[ PARTY MATCH EVENT ]^000000";
  197. mes "Status : ^777777"+(( !.status )?"^FF0000Not Running":( .status == 1 )?"Waiting Team 1":( .status == 2 )?"Waiting Team 2":"Running" )+"^000000";
  198. if( .status || getgmlevel() >= .gm_level ){
  199. mes "Party Member : ^777777"+$party_member+"^000000";
  200. if( .status == 2 ) mes "Location : ^777777"+.map_name$[.map]+"^000000";
  201. }
  202. mes " ";
  203. if( $match_amount ) mes "Required Item : ^777777"+callfunc( "ValueConvert", $match_amount )+" x "+getitemname( $match_itemid )+"^000000";
  204. if( $zeny ) mes "Required Zeny : ^777777"+callfunc( "ValueConvert", $zeny )+" Zeny^000000";
  205. if( .status == 2 ) mes "Registration Countdown : "+( 15 - .minute )+" minutes.";
  206. return;
  207.  
  208. count_party_member:
  209. set .@getarg,getarg(0);
  210.  
  211. getpartymember .@getarg,1;
  212. getpartymember .@getarg,2;
  213. for( set .@i,0; .@i < $@partymembercount; set .@i,.@i + 1 )
  214. if( isloggedin( $@partymemberaid[.@i],$@partymembercid[.@i] ) )
  215. set .@count,.@count + 1;
  216.  
  217. return .@count;
  218.  
  219. clear_variable:
  220. set .minute,0;
  221. set .status,0;
  222. deletearray .team;
  223. deletearray .score;
  224. end;
  225.  
  226. OnTimer60000:
  227. set .minute,.minute + 1;
  228. if( .minute < 15 ){
  229. announce "[ Party : "+getpartyname( .team[0] )+" ] is waiting for a "+$party_member+" vs "+$party_member+" event. ( "+( 15 - .minute )+" minutes to go )",0;
  230. initnpctimer;
  231. }else{
  232. stopnpctimer;
  233. announce "Event Cancelled, 2 Teams failed to register.",0;
  234. callsub clear_variable;
  235. }
  236. end;
  237.  
  238. OnEventStart:
  239. announce "Both team success to register for the events. Get ready while you're being warped within 1 minutes.",0;
  240. sleep 55000;
  241.  
  242. for( set .@i,5; .@i; set .@i,.@i - 1 ){
  243. announce " ::: Warp within "+.@i+" seconds ::: ",0;
  244. sleep 1000;
  245. }
  246.  
  247. // re-count for party members..
  248. set .@count[0],callsub( count_party_member,.team[0] );
  249. set .@count[1],callsub( count_party_member,.team[1] );
  250.  
  251. // check party.
  252. if( .@count[0] != $party_member || .@count[1] != $party_member ){
  253. announce "Event stopped, one of the registered team doesnt meet the requirements of "+$party_member+" members.",0;
  254. }else{
  255. announce "Event Start now......",0;
  256. warpparty .map_list$[.map],0,0,.team[0];
  257. warpparty .map_list$[.map],0,0,.team[1];
  258. deletearray .score;
  259. bg_updatescore .map_list$[.map],.score[ 0 ],.score[ 1 ];
  260.  
  261. sleep 5000;
  262. mapannounce .map_list$[.map],"Kill all opponent enemy and win the events within 15 minute.",0;
  263.  
  264. sleep ( 10 * 60000 );
  265.  
  266. // check and set winner
  267. if( .score[0] > .score[1] ) set .winner,.team[0];
  268. else if( .score[0] < .score[1] ) set .winner,.team[1];
  269. else if( .score[0] == .score[1] ) set .winner,0;
  270.  
  271.  
  272. // if got winner
  273. if( .winner ){
  274. mapannounce .map_list$[.map],"WINNER Party : [ "+getpartyname( .winner )+" ] : Game end.",0;
  275.  
  276. set .@party_leader,getpartyleader( .winner,1 );
  277. if( attachrid( .@party_leader ) ){
  278. if( $zeny ){
  279. mapannounce .map_list$[.map],"Party Leader received "+callfunc( "ValueConvert", $zeny )+" Zeny",bc_blue;
  280. set Zeny,Zeny + ( $zeny * 2 );
  281. }
  282. if( $match_amount ){
  283. mapannounce .map_list$[.map],"Party Leader received "+callfunc( "ValueConvert", $match_amount )+" x "+getitemname( $match_itemid ),bc_blue;
  284. getitem $match_itemid,( $match_amount * 2 ),.@party_leader;
  285. }
  286. detachrid;
  287.  
  288. }else{
  289. mapannounce .map_list$[.map],"Fail to claim rewards because Party Leader not found / offline.",0;
  290. }
  291.  
  292. // draw game
  293. }else{
  294. mapannounce .map_list$[.map],"This Game is DRAW !!! No winner.",0;
  295. }
  296.  
  297. // clear map users.
  298. sleep 3500;
  299. mapwarp .map_list$[.map],.npc_map$,.npc_x,.npc_y;
  300. }
  301. callsub( clear_variable );
  302.  
  303. // OnMinute00:
  304. if( $party_member && ( $match_amount || $zeny ) && !.status ){
  305. announce "Registration are now opened.",0;
  306. set .status,1;
  307. }
  308. end;
  309.  
  310. OnPCKillEvent:
  311. if( .status > 2 && strcharinfo(3) == .map_list$[.map] ){
  312. set .@team,( ( getcharid(1) == .team[0] )? 0:1 );
  313. mapannounce .map_list$[.map],"[ Party : "+getpartyname( .team[ .@team ] )+" ] "+strcharinfo(0)+" has "+( ( killedrid == getcharid(3) )?"commit suicide":"killed "+rid2name( killedrid ) )+" .",0;
  314.  
  315. set .score[ .@team ],.score[ .@team ] + 1;
  316. bg_updatescore .map_list$[.map],.score[ 0 ],.score[ 1 ];
  317.  
  318. if( attachrid( killedrid ) ){
  319. sleep2 1000;
  320. atcommand "@alive";
  321. warp "Save",0,0;
  322. detachrid;
  323. }
  324.  
  325. if( .score[0] >= $party_member || !.score[1] >= $party_member )
  326. awake strnpcinfo(0);
  327. }
  328. end;
  329. }
Advertisement
Add Comment
Please, Sign In to add comment