yuhsing

Untitled

Mar 24th, 2013
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.60 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( .amount && .item_id ){
  46. message strcharinfo(0),"Retrieved "+callfunc( "ValueConvert", .amount )+" x "+getitemname( .item_id )+".";
  47. getitem .item_id,.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( .item_id )
  70. if( countitem( .item_id ) < .amount ){
  71. mes "You need "+callfunc( "ValueConvert", .amount )+" x "+getitemname( .item_id );
  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( .item_id ){
  82. set .@amount,( .amount * 2 );
  83. message strcharinfo(0),"Paid "+callfunc( "ValueConvert", .@amount )+" x "+getitemname( .item_id )+".";
  84. delitem .item_id,.@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 .amount,0,30000;
  137. if( .amount ) set .item_id,.@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( !.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. OnInit:
  172. // Minimum GM Level to access cp.
  173. set .gm_level,80;
  174. // Map Name List
  175. setarray .map_name$,"Map 1","Map 2";
  176. setarray .map_list$,"guild_vs1-3","guild_vs2-2";
  177.  
  178. // map flag initialize
  179. set .map_size,getarraysize( .map_list$ );
  180. for( set .@i,0; .@i < .map_size; set .@i,.@i + 1 ){
  181. set .map_name_menu$,.map_name_menu$ + .map_name$[.@i] +":";
  182. setmapflag .map_list$[.@i],mf_partylock;
  183. setmapflag .map_list$[.@i],mf_nogo;
  184. setmapflag .map_list$[.@i],mf_pvp;
  185. setmapflag .map_list$[.@i],mf_battleground,2;
  186. bg_updatescore .map_list$[.@i],.score[ 0 ],.score[ 1 ];
  187. }
  188.  
  189. // npc locations
  190. getmapxy( .npc_map$,.npc_x,.npc_y,1 );
  191. end;
  192.  
  193. display_event_info:
  194. mes "^FF0000[ PARTY MATCH EVENT ]^000000";
  195. mes "Status : ^777777"+(( !.status )?"^FF0000Not Running":( .status == 1 )?"Waiting Team 1":( .status == 2 )?"Waiting Team 2":"Running" )+"^000000";
  196. if( .status || getgmlevel() >= .gm_level ){
  197. mes "Party Member : ^777777"+.party_member+"^000000";
  198. if( .status == 2 ) mes "Location : ^777777"+.map_name$[.map]+"^000000";
  199. }
  200. mes " ";
  201. if( .amount ) mes "Required Item : ^777777"+callfunc( "ValueConvert", .amount )+" x "+getitemname( .item_id )+"^000000";
  202. if( .zeny ) mes "Required Zeny : ^777777"+callfunc( "ValueConvert", .zeny )+" Zeny^000000";
  203. if( .status == 2 ) mes "Registration Countdown : "+( 15 - .minute )+" minutes.";
  204. return;
  205.  
  206. count_party_member:
  207. set .@getarg,getarg(0);
  208.  
  209. getpartymember .@getarg,1;
  210. getpartymember .@getarg,2;
  211. for( set .@i,0; .@i < $@partymembercount; set .@i,.@i + 1 )
  212. if( isloggedin( $@partymemberaid[.@i],$@partymembercid[.@i] ) )
  213. set .@count,.@count + 1;
  214.  
  215. return .@count;
  216.  
  217. clear_variable:
  218. set .minute,0;
  219. set .status,0;
  220. deletearray .team;
  221. deletearray .score;
  222. end;
  223.  
  224. OnTimer60000:
  225. set .minute,.minute + 1;
  226. if( .minute < 15 ){
  227. announce "[ Party : "+getpartyname( .team[0] )+" ] is waiting for a "+.party_member+" vs "+.party_member+" event. ( "+( 15 - .minute )+" minutes to go )",0;
  228. initnpctimer;
  229. }else{
  230. stopnpctimer;
  231. announce "Event Cancelled, 2 Teams failed to register.",0;
  232. callsub clear_variable;
  233. }
  234. end;
  235.  
  236. OnEventStart:
  237. announce "Both team success to register for the events. Get ready while you're being warped within 1 minutes.",0;
  238. // sleep 55000;
  239.  
  240. for( set .@i,5; .@i; set .@i,.@i - 1 ){
  241. announce " ::: Warp within "+.@i+" seconds ::: ",0;
  242. sleep 1000;
  243. }
  244.  
  245. // re-count for party members..
  246. set .@count[0],callsub( count_party_member,.team[0] );
  247. set .@count[1],callsub( count_party_member,.team[1] );
  248.  
  249. // check party.
  250. if( .@count[0] != .party_member || .@count[1] != .party_member ){
  251. announce "Event stopped, one of the registered team doesnt meet the requirements of "+.party_member+" members.",0;
  252. }else{
  253. announce "Event Start now......",0;
  254. warpparty .map_list$[.map],0,0,.team[0];
  255. warpparty .map_list$[.map],0,0,.team[1];
  256. deletearray .score;
  257. bg_updatescore .map_list$[.map],.score[ 0 ],.score[ 1 ];
  258.  
  259. sleep 5000;
  260. mapannounce .map_list$[.map],"Kill all opponent enemy and win the events within 15 minute.",0;
  261.  
  262. sleep ( 10 * 60000 );
  263.  
  264. // check and set winner
  265. if( .score[0] > .score[1] ) set .winner,.team[0];
  266. else if( .score[0] < .score[1] ) set .winner,.team[1];
  267. else if( .score[0] == .score[1] ) set .winner,0;
  268.  
  269.  
  270. // if got winner
  271. if( .winner ){
  272. mapannounce .map_list$[.map],"WINNER Party : [ "+getpartyname( .winner )+" ] : Game end.",0;
  273.  
  274. set .@party_leader,getpartyleader( .winner,1 );
  275. if( attachrid( .@party_leader ) ){
  276. if( .zeny ){
  277. mapannounce .map_list$[.map],"Party Leader received "+callfunc( "ValueConvert", .zeny )+" Zeny",bc_blue;
  278. set Zeny,Zeny + ( .zeny * 2 );
  279. }
  280. if( .amount ){
  281. mapannounce .map_list$[.map],"Party Leader received "+callfunc( "ValueConvert", .amount )+" x "+getitemname( .item_id ),bc_blue;
  282. getitem .item_id,( .amount * 2 ),.@party_leader;
  283. }
  284. detachrid;
  285.  
  286. }else{
  287. mapannounce .map_list$[.map],"Fail to claim rewards because Party Leader not found / offline.",0;
  288. }
  289.  
  290. // draw game
  291. }else{
  292. mapannounce .map_list$[.map],"This Game is DRAW !!! No winner.",0;
  293. }
  294.  
  295. // clear map users.
  296. sleep 3500;
  297. mapwarp .map_list$[.map],.npc_map$,.npc_x,.npc_y;
  298. }
  299. callsub( clear_variable );
  300. end;
  301.  
  302. OnPCKillEvent:
  303. if( .status > 2 && strcharinfo(3) == .map_list$[.map] ){
  304. set .@team,( ( getcharid(1) == .team[0] )? 0:1 );
  305. mapannounce .map_list$[.map],"[ Party : "+getpartyname( .team[ .@team ] )+" ] "+strcharinfo(0)+" has "+( ( killedrid == getcharid(3) )?"commit suicide":"killed "+rid2name( killedrid ) )+" .",0;
  306.  
  307. set .score[ .@team ],.score[ .@team ] + 1;
  308. bg_updatescore .map_list$[.map],.score[ 0 ],.score[ 1 ];
  309.  
  310. if( attachrid( killedrid ) ){
  311. sleep2 1000;
  312. atcommand "@alive";
  313. warp "Save",0,0;
  314. detachrid;
  315. }
  316.  
  317. if( .score[0] >= .party_member || !.score[1] >= .party_member )
  318. awake strnpcinfo(0);
  319. }
  320. end;
  321. }
Advertisement
Add Comment
Please, Sign In to add comment