yuhsing

Untitled

Dec 19th, 2012
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.16 KB | None | 0 0
  1.  
  2.  
  3.  
  4.  
  5. function script setCoordinate {
  6. .@npc_id = getnpcid(0);
  7.  
  8. .@map$ = getvariableofnpc( .map$,"Sample#main");
  9. if( getarg(0) == 0 ){
  10. do{
  11. .@x = rand( 0,250 );
  12. .@y = rand( 0,250 );
  13. }while( !checkcell( .@map$,.@x,.@y,cell_chkpass ) );
  14.  
  15. }else{
  16. .@x = 1;
  17. .@y = 1;
  18. }
  19. unitwarp .@npc_id,.@map$,.@x,.@y;
  20. return;
  21. }
  22.  
  23. - script Sample#main -1,{
  24. OnInit:
  25. .map$ = "xmas_fild01";
  26. .event_minute = 1;
  27.  
  28. // mapflags
  29. setarray .@mapflag[0],0,1,2,3,9,13,22,33,34,42,45;
  30. .@mf_size = getarraysize( .@mapflag );
  31. for( .@i = 0; .@i < .@mf_size; .@i++ )
  32. setmapflag .map$,.@mapflag[.@i]
  33. end;
  34.  
  35.  
  36. OnPCLoadMapEvent:
  37. if( strcharinfo(3) == .map$ && .status && getcharid(2) ){
  38. @collected_points = 0;
  39. .@guild_size = getarraysize( .guild_list );
  40.  
  41. for( .@i = 0; .@i <= .@guild_size; .@i++ )
  42. if( .@i == .@guild_size ){
  43. .guild_list[.@i] = getcharid(2);
  44. break;
  45. }else if( .guild_list[.@i] == getcharid(2) ){
  46. break;
  47. }
  48. @guild_index = .@i;
  49. }
  50. end;
  51.  
  52. OnWhisperGlobal:
  53. OnMinute00:
  54.  
  55. // start event if not started yet
  56. if( !.status ){
  57.  
  58. // remove all player
  59. mapwarp .map$,"prontera",155,181;
  60.  
  61. // clear data
  62. deletearray .winner;
  63. deletearray .guild_list;
  64. deletearray .guild_score;
  65.  
  66. // event start
  67. .status = 1;
  68.  
  69. announce "event start",0;
  70. donpcevent "::OnEventStart";
  71.  
  72. sleep2 ( .event_minute * 60000 );
  73.  
  74. // event end
  75. .status = 0;
  76. announce "event end",0;
  77. donpcevent "::OnEventEnd";
  78.  
  79. // Check for highest score guild with minimum of 1 point
  80. for( .@i = 0; .@i < getarraysize( .guild_list ); .@i++ )
  81. if( .guild_score[.@i] && .guild_score[.@i] >= .winner[1] ){
  82. .winner[0] = .guild_list[.@i];
  83. .winner[1] = .guild_score[.@i];
  84. }
  85.  
  86. // announce winner guild
  87. if( getarraysize( .winner ) == 2 ){
  88. announce "Guild "+getguildname( .winner[0] )+" win the game with "+.winner[1]+" scores.",0;
  89. }
  90. }
  91. end;
  92.  
  93. // update points when clicked
  94. OnCollectPoint:
  95. if( .status && getcharid(2) && @collected_points ){
  96. .guild_score[ @guild_index ] += @collected_points;
  97. @collected_points = 0;
  98. announce "Guild "+getguildname( .guild_list[ @guild_index ] )+" scored "+.guild_score[ @guild_index ]+" points already.",0;
  99. }
  100. end;
  101. }
  102.  
  103.  
  104. xmas_fild01,73,73,4 script Point Collector 757,{
  105. doevent "Sample#main::OnCollectPoint";
  106. }
  107.  
  108.  
  109.  
  110.  
  111.  
  112. prontera,1,1,1 script item#0 723,{
  113. if( getvariableofnpc( .status,"Sample#main") && getcharid(2) ){
  114. progressbar "ffffff",1;
  115.  
  116. // generate points
  117. .@point = rand( 1,4 );
  118. @collected_points += .@point;
  119. mes "this item have ^0055ff"+.@point+" points^000000.";
  120. mes " ";
  121. mes "total points : ^ff0000"+@collected_points+" points^000000";
  122.  
  123. // hide npc and re-coordinate the npc
  124. hideonnpc strnpcinfo(0);
  125. close2;
  126. setCoordinate( 0,getnpcid(0) );
  127. sleep ( ( 10 + .@point * 20 ) * 100 );
  128. hideoffnpc strnpcinfo(0);
  129. }
  130. end;
  131.  
  132. OnEventStart:
  133. setCoordinate( 0,getnpcid(0) );
  134. end;
  135.  
  136. OnEventEnd:
  137. setCoordinate( 1,getnpcid(0) );
  138. end;
  139. }
  140.  
  141.  
  142. // dummy npc for "item" and map & coordinate are not important.
  143. xmas_fild01,1,1,1 duplicate(item#0) item#1 723
  144. xmas_fild01,1,1,1 duplicate(item#0) item#2 723
  145. xmas_fild01,1,1,1 duplicate(item#0) item#3 723
  146. xmas_fild01,1,1,1 duplicate(item#0) item#4 723
Advertisement
Add Comment
Please, Sign In to add comment