Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2014
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.73 KB | None | 0 0
  1.  
  2. // just ignore if there are any overwrite
  3. function script F_InsertComma {
  4. set .@str$, getarg(0);
  5. for (set .@i,getstrlen(.@str$)-3; .@i>0; set .@i,.@i-3)
  6. set .@str$, insertchar(.@str$,",",.@i);
  7. return .@str$;
  8. }
  9.  
  10.  
  11. cmd_fild02,88,96,6 script Digging Supervisor 803,{
  12.  
  13. mes .npc_name$;
  14. if( digquest == 1 ){
  15. mes "What are you still doing here?";
  16. next;
  17. mes .npc_name$;
  18. mes "Here are the digging spots.";
  19. callsub( OnShowSpot );
  20. }
  21. else{
  22. mes "Hello. I am Digane, the supervisor here on the digging site.";
  23. do{
  24. next;
  25. mes .npc_name$;
  26. mes "What can I do for you today?";
  27. next;
  28. .@i = 0;
  29. .@option = select( "What is Digging ?","Start Digging","What do I need for digging?","Cancel" );
  30. mes .npc_name$;
  31. switch( .@option ){
  32. case 1:
  33. do{
  34. if( .@i ) mes .npc_name$;
  35. mes .information$[.@i];
  36. .@i++;
  37. if( ( .@i >= .information_size ) ) break;
  38. next;
  39. }while( 1 );
  40. break;
  41. case 2:
  42. mes "Okay let me check if you have your equipments first....";
  43. next;
  44. mes "[ Digane ]";
  45. .@fail = 0;
  46. if( .required_item )
  47. if( countitem( .required_item ) < 1 ) .@fail++;
  48. if( Zeny < .required_zeny ) .@fail++;
  49. if( .@fail ){
  50. mes "I told you you must have these ";
  51. if( .required_item )
  52. mes "^FF00001 x "+getitemname( .required_item )+"^000000";
  53. if( .required_zeny )
  54. mes "^FF0000"+F_InsertComma( .required_zeny )+" Zeny^000000";
  55. mes "on your to start digging.";
  56. }
  57. else{
  58. mes "Okay here are the digging spots.";
  59. mes "Goodluck.";
  60. if( .required_zeny )
  61. Zeny -= .required_zeny;
  62. digquest = 1;
  63. message strcharinfo(0),"Digging enabled.";
  64. callsub( OnShowSpot );
  65. }
  66. break;
  67. case 3:
  68. do{
  69. if( .@i ) mes .npc_name$;
  70. mes .information2$[.@i];
  71. .@i++;
  72. if( ( .@i >= .information2_size ) ) break;
  73. next;
  74. }while( 1 );
  75. default: break;
  76. }
  77. }while( .@option < 4 && .@option != 2 );
  78. }
  79. close;
  80.  
  81.  
  82. OnInit:
  83. // npc name
  84. .npc_name$ = "[ Digane ]";
  85. // required zeny
  86. .required_zeny = 1000;
  87. // required item
  88. .required_item = 7016;
  89. // how many dig npc
  90. .total_dig_npc = 8;
  91.  
  92. // reward list+ rate
  93. setarray .reward_list,16134,14135,14596,14380,14440,14448,14343,14287,14288,13606,13890,12109,14234,12214,13989,13807,13855,13809,12031,12029,13889,12034,12030,12032,12033,12028,7005,13851,7102,13849,13849,14232;
  94. setarray .reward_rate,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50;
  95. .reward_list_size = getarraysize( .reward_list );
  96.  
  97. setarray .information$,
  98. "Various items can be obtained from this digging site made by the government of Comodo.",
  99. "Any adventurer who wish to try digging can do so just by talking to me and paying the fee.",
  100. "Any items you will find is yours to keep.",
  101. "We have ^FF0000"+.total_dig_npc+" Digging Spots^000000 here and you can dig on those spots one at a time.",
  102. "Just be careful on landmines, you might encounter one.";
  103. .information2_size = getarraysize( .information$ );
  104.  
  105. setarray .information2$,
  106. "I need ^FF0000"+F_InsertComma( .required_zeny )+" Zeny^000000 for the digging fee.",
  107. "You will need a material to dig on those sands.",
  108. "On each dig that you will perform you will need a ^FF0000"+getitemname( .required_item )+"^000000",
  109. "I heard that zombie prisoners drop them so you might want to get some from them first.",
  110. "You can only use the spoon once since it gets broken easily when it hits solid objects like boxes and some other stuffs.",
  111. "All items that you will find is yours to keep but you will need to talk to me everytime you want to start digging again.",
  112. "After you finish digging, you will be sent back here automatically.";
  113. .information2_size = getarraysize( .information2$ );
  114. getmapxy( .npc_map$,.npc_x,.npc_y,1 );
  115. end;
  116.  
  117. OnShowSpot:
  118. for( .@i = 1; .@i <= .total_dig_npc; .@i++ )
  119. if( !getmapxy( .@map$,.@x,.@y,1,"Digging Spot#"+.@i ) )
  120. viewpoint 1,.@x,.@y,.@i,0xFF0000;
  121. return;
  122.  
  123. }
  124.  
  125. // dig npc
  126. - script dig_spot -1,{
  127. // doevent "Digging Supervisor::OnDig";
  128. function dig_process;
  129.  
  130. OnDig:
  131. if( !digquest ){
  132. mes "A digging spot. People usually dig here on this spot.";
  133. }
  134. else{
  135. for( .@i = 1; .@i <= 3; .@i++ ){
  136. for( .@x = 0; .@x < .@i; .@x++ )
  137. mes "*shook*";
  138. next;
  139. }
  140. dig_process( .required_item );
  141. }
  142. close;
  143.  
  144.  
  145. // dig_process( <item_id> );
  146. function dig_process {
  147. .@item_id = getarg(0);
  148.  
  149. .@rand = rand( 152 );
  150. digquest = 0;
  151.  
  152. // found landmine
  153. if(
  154. ( .rand >= 10 && .@rand <= 20 ) ||
  155. ( .@rand >= 45 && .@rand <= 46 && rand(100) > 3 ) ||
  156. ( .@rand >= 52 && .@rand <= 62 ) ||
  157. ( .@rand >= 91 && .@rand <= 114 ) ||
  158. ( .@rand >= 131 && .@rand <= 150 )
  159. ){
  160. message strcharinfo(0),"You found a landmine.";
  161. specialeffect2 EF_IGN_STR;
  162. unitkill getcharid(3);
  163. close;
  164. }
  165.  
  166. // found nothing
  167. else if(
  168. .@rand <= 10 ||
  169. ( .@rand >= 47 && .@rand <= 67 ) ||
  170. ( .@rand >= 87 && .@rand <= 129 )
  171. ){
  172. message strcharinfo(0),"You found nothing.";
  173. }
  174.  
  175. // found an item - 20~45, 68~86
  176. else{
  177. message strcharinfo(0),"You found an item!!";
  178. next;
  179. if( .@item_id ){
  180. if( countitem( .@item_id ) < 1 )
  181. .@fail++;
  182. }
  183. if( .@fail ){
  184. mes "But you don't have a "+getitemname( .@item_id )+" on you.";
  185. }
  186. else{
  187. mes "Your ^FF0000"+getitemname( .@item_id )+"^000000 broke as you tried to dig and reach the item.";
  188. delitem .@item_id,1;
  189. .@random = rand(100);
  190. do{
  191. .@random = rand( .reward_list_size );
  192. }while( .@random < .reward_rate[.@random] );
  193. .@reward = .reward_list[ .@random ];
  194. getitem .@reward,1;
  195. mes "Gained "+getitemname( .@reward );
  196. }
  197. }
  198. announce "Digane: Okay you're done. Come back here now.",bc_self;
  199. close2;
  200. warp .npc_map$,.npc_x,.npc_y;
  201. return;
  202. }
  203.  
  204. OnInit:
  205. .required_item = 7016;
  206. getmapxy( .npc_map$,.npc_x,.npc_y,1,"Digging Supervisor" );
  207.  
  208. // reward list+ rate
  209. setarray .reward_list,16134,14135,14596,14380,14440,14448,14343,14287,14288,13606,13890,12109,14234,12214,13989,13807,13855,13809,12031,12029,13889,12034,12030,12032,12033,12028,7005,13851,7102,13849,13849,14232;
  210. setarray .reward_rate,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50;
  211. .reward_list_size = getarraysize( .reward_list );
  212. end;
  213.  
  214. }
  215.  
  216. // duplicates dig spot
  217.  
  218. cmd_fild02,51,97,5 duplicate(dig_spot) Digging Spot#1 111
  219. cmd_fild02,162,180,5 duplicate(dig_spot) Digging Spot#2 111
  220. cmd_fild02,122,174,5 duplicate(dig_spot) Digging Spot#3 111
  221. cmd_fild02,68,202,5 duplicate(dig_spot) Digging Spot#4 111
  222. cmd_fild02,232,93,5 duplicate(dig_spot) Digging Spot#5 111
  223. cmd_fild02,210,135,5 duplicate(dig_spot) Digging Spot#6 111
  224. cmd_fild02,286,126,5 duplicate(dig_spot) Digging Spot#7 111
  225. cmd_fild02,323,82,5 duplicate(dig_spot) Digging Spot#8 111
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement