yuhsing

Untitled

Apr 18th, 2013
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.95 KB | None | 0 0
  1.  
  2.  
  3. prontera,1,1,5 script Save Me#portal 100,2,2,{
  4. OnTouch:
  5. npctalk "Have you seen my pet somewhere here ?";
  6. doevent "Lost Monster::OnPortalReach";
  7. end;
  8. }
  9.  
  10.  
  11. prontera,1,1,5 script Save Me#mob::Lost Monster 111,{
  12.  
  13. deltimer "Lost Monster::OnPCLoadMapEvent";
  14.  
  15. if( .status ){
  16. mes "You came to save me ?";
  17.  
  18. if( .saviour$ != "" ){
  19. mes "But .. ^0055FF"+.saviour$+"^000000 is here to help me already.";
  20. }else{
  21. mes "But my parent told me not to trust someone easily....";
  22. mes " ";
  23. mes "^FF0000* unless you give me "+getitemname( .lure_list[ .item_index ] )+" *^000000";
  24. if( select( "Alright, Take it..","Nope" ) == 1 )
  25. if( countitem( .lure_list[ .item_index ] ) ){
  26. delitem .lure_list[ .item_index ],1;
  27. .saviour$ = strcharinfo(0);
  28. npctalk "This is great ~";
  29. close2;
  30. npcspeed rand( 250,350 );
  31.  
  32. getmapxy( .@npc_map2$,.@npc_x2,.@npc_y2,1,"Save Me#portal" );
  33. viewpoint 1,.@npc_x2,.@npc_y2,1,0x00EEFF;
  34.  
  35. while( .saviour$ != "" ){
  36. getmapxy( .@to_map$,.@to_x,.@to_y,0,.saviour$ );
  37. npcwalkto .@to_x,.@to_y;
  38. specialeffect2 460,AREA,.saviour$;
  39. sleep2 1000;
  40. .@second++;
  41. if( .@second >= rand( 10,15 ) ){
  42. .saviour$ = "";
  43. npctalk "Please wait, I need more "+getitemname( .lure_list[ .item_index ] )+" for my stamina.";
  44. break;
  45. }
  46. }
  47. viewpoint 2,.@npc_x2,.@npc_y2,1,0x00EEFF;
  48. getmapxy( .@npc_map2$,.@npc_x2,.@npc_y2,1,strnpcinfo(0) );
  49. viewpoint 1,.@npc_x2,.@npc_y2,1,0x00EEFF;
  50. npcstop;
  51. end;
  52.  
  53. }else{
  54. close2;
  55. npctalk "You're cheater...!! You dont have it..";
  56. }
  57. }
  58. }else
  59. npctalk "Why are you here ?";
  60. close;
  61.  
  62.  
  63. OnInit:
  64. // mob list + lure list
  65. setarray .mob_list[0],1002,1007,1009,1010,1011,1012,1013,1019,1031,1052,1063;
  66. .mob_list_size = getarraysize( .mob_list );
  67. setarray .lure_list[0],507,508,509,510,511,512,513,514,515,516,517,518,519;
  68. .lure_list_size = getarraysize( .lure_list );
  69.  
  70. // map list + max coordinates
  71. setarray .map_list$[0],"moc_pryd01","moc_pryd02","moc_pryd05","in_sphinx1","in_sphinx2","in_sphinx4";
  72. .map_list_size = getarraysize( .map_list$ );
  73. setarray .map_x[0],193,193,225,293,293,233;
  74. setarray .map_y[0],193,193,225,293,293,233;
  75.  
  76. // event duration
  77. .minute = 30;
  78.  
  79. // required min. distance between 2 npcs to win
  80. .range = 5;
  81.  
  82. // determine max range
  83. while( .@i < .map_list_size ){
  84. .npc_max_distance[ .@i ] = distance( 5,5,.map_x[.@i],.map_y[.@i] );
  85. // debugmes ".map : "+.map_list$[.@i]+" | distance "+.npc_max_distance[.@i];
  86. .@i++;
  87. }
  88.  
  89. .mob_npc_id[0] = getnpcid( 0,"Lost Monster" );
  90. .mob_npc_id[1] = getnpcid( 0,"Save Me#portal" );
  91.  
  92. end;
  93.  
  94.  
  95. OnEventStart:
  96. .status = 1;
  97. hideoffnpc "Lost Monster";
  98. hideoffnpc "Save Me#portal";
  99. .saviour$ = "";
  100. .item_index = rand( .lure_list_size );
  101. .map_index = rand( .map_list_size );
  102. setmapflag .map_list$[ .map_index ],mf_loadevent;
  103. setmapflag .map_list$[ .map_index ],mf_pvp;
  104. setmapflag .map_list$[ .map_index ],mf_noteleport;
  105. .mob_index = rand( .mob_list_size );
  106. setnpcdisplay( "Lost Monster",.mob_list[ .mob_index ] );
  107. .npc_min_range = rand( 130,.npc_max_distance[ .map_index ] );
  108.  
  109. mapwarp .map_list$[ .map_index ],"prontera",155,181;
  110. // generate coordinate for both npc
  111. callsub( setCoordinate,3,.npc_min_range );
  112.  
  113. announce "The "+getmonsterinfo( .mob_list[ .mob_index ],MOB_NAME )+" is lost inside the "+.map_list$[ .map_index ]+". Hint : '"+getitemname( .lure_list[ .item_index ] )+"'",0;
  114.  
  115. // pause event until event end
  116. sleep ( .minute * 60000 );
  117.  
  118. // check for winner
  119. if( .winner$ != "" ){
  120. mapannounce .map_list$[ .map_index ],"We got a Winner : "+.winner$,0;
  121. }else{
  122. announce "Nobody has saved the "+getmonsterinfo( .mob_list[ .mob_index ],MOB_NAME ),0;
  123. }
  124.  
  125. OnEventEnd:
  126. .status = 0;
  127. hideonnpc "Lost Monster";
  128. hideonnpc "Save Me#portal";
  129. removemapflag .map_list$[ .map_index ],mf_loadevent;
  130. removemapflag .map_list$[ .map_index ],mf_pvp;
  131. removemapflag .map_list$[ .map_index ],mf_noteleport;
  132. end;
  133.  
  134. OnPCLoadMapEvent:
  135. deltimer "Lost Monster::OnPCLoadMapEvent";
  136. if( strcharinfo(3) == .map_list$[ .map_index ] && .status ){
  137. mes "You'll need some ^FF0000"+getitemname( .lure_list[ .item_index ] )+"^000000 to lure "+getmonsterinfo( .mob_list[ .mob_index ],MOB_NAME )+" to follow you.";
  138. dispbottom "You'll need some '"+getitemname( .lure_list[ .item_index ] )+"' to lure "+getmonsterinfo( .mob_list[ .mob_index ],MOB_NAME )+" to follow you.";
  139. // addtimer 1000,strnpcinfo(0)+"::OnPCLoadMapEvent";
  140. if( .saviour$ == strcharinfo(0) ){
  141. .@npc_name$ = "Save Me#portal";
  142. }else{
  143. .@npc_name$ = "Lost Monster";
  144. }
  145. getmapxy( .@npc_map0$,.@npc_x0,.@npc_y0,1,.@npc_name$ );
  146. viewpoint 1,.@npc_x0,.@npc_y0,1,0x00EEFF;
  147. }
  148. close;
  149.  
  150. setCoordinate:
  151. .@getarg[0] = getarg(0);
  152. .@getarg[1] = getarg(1);
  153.  
  154. do{
  155. .@x[0] = rand( .map_x[ .map_index ] );
  156. .@y[0] = rand( .map_y[ .map_index ] );
  157. .@x[1] = rand( .map_x[ .map_index ] );
  158. .@y[1] = rand( .map_y[ .map_index ] );
  159. }while( distance( .@x[0],.@y[0],.@x[1],.@y[1] ) < .@getarg[1] ||
  160. !checkcell( .map_list$[ .map_index ],.@x[0],.@y[0],cell_chkpass ) ||
  161. !checkcell( .map_list$[ .map_index ],.@x[1],.@y[1],cell_chkpass ) );
  162.  
  163. // move npc to generated coordinate
  164. if( .@getarg[0] & 1 ) unitwarp .mob_npc_id[0],.map_list$[ .map_index ],.@x[0],.@y[0];
  165. if( .@getarg[0] & 2 ) unitwarp .mob_npc_id[1],.map_list$[ .map_index ],.@x[1],.@y[1];
  166.  
  167. return;
  168.  
  169. OnPortalReach:
  170. if( .status ){
  171. getmapxy( .@npc_map1$,.@npc_x1,.@npc_y1,1,"Lost Monster" );
  172. getmapxy( .@npc_map2$,.@npc_x2,.@npc_y2,1,"Save Me#portal" );
  173. if( distance( .@npc_x1,.@npc_y1,.@npc_x2,.@npc_y2 ) > .range ){
  174. announce "Where's the "+getmonsterinfo( .mob_list[ .mob_index ],MOB_NAME )+" ?",bc_self;
  175. }else{
  176. .winner$ = strcharinfo(0);
  177. mes "You saved it.";
  178. // getitem 30001,5;
  179. awake strnpcinfo(0);
  180. close2;
  181. donpcevent strnpcinfo(0)+"::OnEventEnd";
  182. end;
  183. }
  184. }
  185. close;
  186. }
Advertisement
Add Comment
Please, Sign In to add comment