WaveMode.txt 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808
  1. //===== rAthena Script =======================================
  2. //= Wave Mode
  3. //===== Description: =========================================
  4. //= [Walkthrough Conversion]
  5. //= Wave Mode Forest and Sky Instances
  6. //- Officially monsters can use their skills
  7. // (NPC_SUMMONSLAVE, at least). NPC_EMOTION and
  8. // NPC_EMOTION_ON have been blocked since it disrupts the
  9. // walk system of the instance on rAthena.
  10. //- Note: The instance is currently disabled on KRO.
  11. //===== Changelogs: ==========================================
  12. //= 1.0 First version. [Capuche]
  13. //============================================================
  14. // Simple function to move the monster when idle.
  15. // Move the monster to the next coordinates + end the script on successful; kill the monster + return on failure
  16. // callfunc( "F_mobidle", <npc name + idle label>, <size coord>, <defined x array>, <x shift>, <defined y array>, <defined spot-spot distance array> );
  17. function script F_mobidle {
  18. sleep2 1000; // stop if no RID
  19. .@game_id = getattachedrid();
  20. .@dist_min = 300;
  21. .@size = getarg(1);
  22. .@dx = getarg(3);
  23. getunitdata .@game_id, .@data;
  24. for ( .@i = 0; .@i < .@size; .@i++ ) {
  25. .@dist_to_spot[.@i] = distance( .@data[UMOB_X], .@data[UMOB_Y], (getelementofarray( getarg(2),.@i ) + .@dx), getelementofarray( getarg(4),.@i ) );
  26. if (.@dist_min >= .@dist_to_spot[.@i]) {
  27. .@dist_min = .@dist_to_spot[.@i];
  28. .@index = .@i;
  29. }
  30. }
  31. if (.@dist_min <= 1) {
  32. .@index++;
  33. if (.@index >= .@size) {
  34. unitskilluseid .@game_id,301,1,.@game_id,1,false,41; // SA_INSTANTDEATH
  35. return;
  36. }
  37. }
  38. else if (.@index < (.@size -1)) {
  39. .@total[0] = .@dist_min + getelementofarray( getarg(5), .@index );
  40. .@total[1] = .@dist_to_spot[.@index + 1] + getelementofarray( getarg(5), .@index+1 );
  41. if (.@total[0] > .@total[1])
  42. .@index = .@index + 1;
  43. }
  44. if (.@dist_to_spot[.@index] > 14) {
  45. unitkill .@game_id;
  46. end;
  47. }
  48. if (!.@data[UMOB_TARGETID]) {
  49. unitwalk .@game_id, (getelementofarray( getarg(2),.@index ) + .@dx), getelementofarray( getarg(4),.@index );
  50. sleep2 50; // for now a delay between unitwalk and mob_setidleevent is needed
  51. }
  52. mob_setidleevent .@game_id, getarg(0);
  53. end;
  54. }
  55. prontera,146,75,1 script Zonda Rep#pron 4_F_ZONDAGIRL,{
  56. .@player_name$ = strcharinfo(0);
  57. getmapxy .@map_name$,.@x,.@y, BL_PC;
  58. if (is_party_leader() == true) {
  59. .@party_id = getcharid(1);
  60. getpartymember .@party_id, 1;
  61. getpartymember .@party_id, 2;
  62. for ( .@i = 0; .@i < $@partymembercount; .@i++ ) {
  63. if (isloggedin($@partymemberaid[.@i], $@partymembercid[.@i]) == 1)
  64. .@count_online++;
  65. }
  66. .@menu_entry$ = "Request entry.";
  67. }
  68. mes "[Belka]";
  69. mes "Welcome to Zonda, where innovation begins. What can I do for you?";
  70. next;
  71. switch( select( "Why are you here?", .@menu_entry$, "Enter ^6B9900<Wave Mode - Forest>^000000.", "Enter ^6B9900<Wave Mode - Sky>^000000.", "Cancel." ) ) {
  72. case 1:
  73. mes "[Belka]";
  74. mes "We now offer a new service. Have you heard about the dimensional rifts?";
  75. next;
  76. mes "[Belka]";
  77. mes "In case you haven't, many organizations and scientists study the rifts formed between dimensions.";
  78. next;
  79. mes "[Belka]";
  80. mes "One of them is my company, Zonda, and after long, painstaking research...";
  81. next;
  82. mes "[Belka]";
  83. mes "We've developed two different dimensional rifts that we call Wave Modes - Forest and Sky!";
  84. next;
  85. mes "[Belka]";
  86. mes "Do you have any questions about Zonda's ambitious new project, Wave Mode?";
  87. while(true) {
  88. next;
  89. switch( select( "About ^6B9900<Wave Mode - Forest>^000000", "About ^6B9900<Wave Mode - Sky>^000000", "No." ) ) {
  90. case 1:
  91. mes "[Belka]";
  92. mes "The ^6B9900<Wave Mode - Forest>^000000";
  93. mes "Introducing the first Wave Mode service, Zonda's objective is to work with your party members to keep monster waves from reaching the other side of the bridge.";
  94. next;
  95. mes "[Belka]";
  96. mes "Monsters will advance without fighting, but the party will fail if 20 monsters are let go..";
  97. break;
  98. case 2:
  99. mes "[Belka]";
  100. mes "The ^6B9900<Wave Mode - Sky>^000000";
  101. mes "Available once a day. Like the other Wave Mode, keep the monsters away from reaching the other side of the map.";
  102. next;
  103. mes "[Belka]";
  104. mes "Feel free to come back with your party.";
  105. break;
  106. case 3:
  107. mes "[Belka]";
  108. mes "Thank you for visiting Zonda, where innovation begins.";
  109. close;
  110. }
  111. next;
  112. mes "[Belka]";
  113. mes "Any other questions?";
  114. }
  115. case 2:
  116. mes "[Belka]";
  117. mes "Which Wave Mode would you like to enter: Forest or Sky?";
  118. next;
  119. .@s = select( "Enter ^6B9900<Wave Mode - Forest>^000000.", "Enter ^6B9900<Wave Mode - Sky>^000000." ) - 1;
  120. setarray .@instance_name$[0], "Wave Mode - Forest", "Wave Mode - Sky";
  121. mes "[Belka]";
  122. mes "" + .@count_online + " party " + (.@count_online == 1 ? "member" : "members") + " found " + .@player_name$ + ", right? To enter the ^6B9900<" + .@instance_name$[.@s] + ">^000000, please sign here.";
  123. next;
  124. select("Sign.");
  125. mes "[Belka]";
  126. mes "" + .@player_name$ + " has requested to enter the ^6B9900<" + .@instance_name$[.@s] + ">^000000. Please come back when it's your turn to enter.";
  127. if (instance_create(.@instance_name$[.@s]) < 0) {
  128. mes "Party Name: " + getpartyname( getcharid(1) );
  129. mes "Party Leader: " + strcharinfo(0);
  130. mes "^0000ff" + .@instance_name$[.@s] + " ^000000 - Reservation Failed.";
  131. close;
  132. }
  133. close;
  134. case 3:
  135. switch( instance_enter("Wave Mode - Forest") ) {
  136. case IE_OTHER:
  137. mes "[Belka]";
  138. mes "An unknown error has occurred.";
  139. close;
  140. case IE_NOINSTANCE:
  141. case IE_NOMEMBER:
  142. mes "[Belka]";
  143. mes "Please wait for ^6B9900<Wave Mode - Forest>^000000 stabilization.";
  144. close;
  145. case IE_OK:
  146. mapannounce .@map_name$, "" + .@player_name$ + " of the party " + getpartyname(getcharid(1)) + " is entering <Wave Mode - Forest>.", bc_map,0xFF99;
  147. // warp "1@def01",50,21;
  148. break;
  149. }
  150. break;
  151. case 4:
  152. switch( instance_enter("Wave Mode - Sky") ) {
  153. case IE_OTHER:
  154. mes "[Belka]";
  155. mes "An unknown error has occurred.";
  156. close;
  157. case IE_NOINSTANCE:
  158. case IE_NOMEMBER:
  159. mes "[Belka]";
  160. mes "Currently the ^6B9900<Wave Mode - Sky>^000000 is being stabilized for your convenience. Please wait.";
  161. close;
  162. case IE_OK:
  163. mapannounce .@map_name$, "" + .@player_name$ + " of the party " + getpartyname(getcharid(1)) + " is entering <Wave Mode - Sky>.", bc_map,0xFF99;
  164. // warp "1@def02",29,35;
  165. break;
  166. }
  167. break;
  168. case 5:
  169. mes "[Belka]";
  170. mes "Thank you for visiting Zonda, where innovation begins.";
  171. close;
  172. }
  173. wave_mode_map$ = .@map_name$;
  174. wave_mode_x = .@x;
  175. wave_mode_y = .@y;
  176. end;
  177. }
  178. payon,166,98,1 duplicate(Zonda Rep#pron) Zonda Rep#pay 4_F_ZONDAGIRL
  179. moc_para01,45,89,3 duplicate(Zonda Rep#pron) Zonda Rep#para 4_F_ZONDAGIRL
  180. morocc,168,271,4 duplicate(Zonda Rep#pron) Zonda Rep#mor 4_F_ZONDAGIRL
  181. // Wave mode forest
  182. 1@def01,50,21,0 script #wave_mode_forest_entrance HIDDEN_WARP_NPC,1,1,{
  183. end;
  184. OnTouch:
  185. disablenpc instance_npcname("#wave_mode_forest_entrance");
  186. initnpctimer;
  187. end;
  188. OnTimer2000:
  189. mapannounce 'map_def01$, "We would like to thank all loyal customers of the Cool Event Corporation.", bc_map;
  190. end;
  191. OnTimer7000:
  192. mapannounce 'map_def01$, "<Wave mode - Forest> prevent monsters from reaching the other side of the bridge.", bc_map;
  193. end;
  194. OnTimer12000:
  195. mapannounce 'map_def01$, "If 20 monsters reach the other side, the game is over.", bc_map;
  196. end;
  197. OnTimer17000:
  198. mapannounce 'map_def01$, "Ok, here they come.", bc_map;
  199. end;
  200. OnTimer22000:
  201. stopnpctimer;
  202. donpcevent instance_npcname("#wave_mode_forest_system") + "::OnStart";
  203. end;
  204. }
  205. 1@def01,1,1,0 script #wave_mode_forest_system -1,{
  206. end;
  207. OnStart:
  208. initnpctimer;
  209. end;
  210. OnTimer1000:
  211. mapannounce 'map_def01$, "3", bc_map;
  212. end;
  213. OnTimer2000:
  214. mapannounce 'map_def01$, "2", bc_map;
  215. end;
  216. OnTimer3000:
  217. mapannounce 'map_def01$, "1", bc_map;
  218. end;
  219. OnTimer4000:
  220. 'wave++;
  221. if ('wave % 5)
  222. mapannounce 'map_def01$, "-- Wave " + 'wave + " --", bc_map;
  223. else
  224. mapannounce 'map_def01$, "!! Champions summoned !!", bc_map;
  225. donpcevent 'npc_name$ + "::OnSpawn";
  226. end;
  227. OnTimer24000:
  228. mapannounce 'map_def01$, "Next monsters will come out soon. Get ready.", bc_map;
  229. initnpctimer;
  230. end;
  231. OnStop:
  232. stopnpctimer;
  233. end;
  234. }
  235. 1@def01,1,1,0 script #wave_mode_forest_spawn -1,{
  236. end;
  237. OnSpawn:
  238. switch( 'wave % 70 ) {
  239. case 1:
  240. 'mob_id = 2401; // G_PORING
  241. break;
  242. case 2:
  243. 'mob_id = 2582; // G_LUNATIC
  244. break;
  245. case 3:
  246. 'mob_id = 2573; // G_CHONCHON
  247. break;
  248. case 4:
  249. 'mob_id = 2590; // G_ROCKER
  250. break;
  251. case 5:
  252. 'mob_id = 2699; // C1_PORING
  253. break;
  254. case 6:
  255. 'mob_id = 2577; // G_FABRE
  256. break;
  257. case 7:
  258. 'mob_id = 1747; // G_SNAKE
  259. break;
  260. case 8:
  261. 'mob_id = 2595; // G_STAINER
  262. break;
  263. case 9:
  264. 'mob_id = 2576; // G_CREAMY
  265. break;
  266. case 10:
  267. 'mob_id = 2678; // C3_RODA_FROG
  268. break;
  269. case 11:
  270. 'mob_id = 2572; // G_CARAMEL
  271. break;
  272. case 12:
  273. 'mob_id = 1603; // G_BIGFOOT
  274. break;
  275. case 13:
  276. 'mob_id = 2589; // G_POPORING
  277. break;
  278. case 14:
  279. 'mob_id = 2578; // G_HORN
  280. break;
  281. case 15:
  282. 'mob_id = 2670; // C5_SCORPION
  283. break;
  284. case 16:
  285. 'mob_id = 2601; // G_YOYO
  286. break;
  287. case 17:
  288. 'mob_id = 2575; // G_COCO
  289. break;
  290. case 18:
  291. 'mob_id = 2583; // G_MARTIN
  292. break;
  293. case 19:
  294. 'mob_id = 2600; // G_WOLF
  295. break;
  296. case 20:
  297. 'mob_id = 2705; // C2_POISON_SPORE
  298. break;
  299. case 21:
  300. 'mob_id = 1430; // G_ARGOS
  301. break;
  302. case 22:
  303. 'mob_id = 2597; // G_STEEL_CHONCHON
  304. break;
  305. case 23:
  306. 'mob_id = 1431; // G_BAPHOMET_
  307. break;
  308. case 24:
  309. 'mob_id = 2591; // G_SAVAGE
  310. break;
  311. case 25:
  312. 'mob_id = 2857; // C5_DENIRO
  313. break;
  314. case 26:
  315. 'mob_id = 1457; // G_MANTIS
  316. break;
  317. case 27:
  318. 'mob_id = 1424; // G_SIDE_WINDER
  319. break;
  320. case 28:
  321. 'mob_id = 1429; // G_ARGIOPE
  322. break;
  323. case 29:
  324. 'mob_id = 1441; // G_PENOMENA
  325. break;
  326. case 30:
  327. 'mob_id = 2648; // C3_SOLDIER_SKELETON
  328. break;
  329. case 31:
  330. 'mob_id = 1422; // G_HUNTER_FLY
  331. break;
  332. case 32:
  333. 'mob_id = 2585; // G_MOLE
  334. break;
  335. case 33:
  336. 'mob_id = 2592; // G_SIORAVA
  337. break;
  338. case 34:
  339. 'mob_id = 2571; // G_BUTOIJO
  340. break;
  341. case 35:
  342. 'mob_id = 2673; // C3_SAVAGE
  343. break;
  344. case 36:
  345. 'mob_id = 2574; // G_CIVIL_SERVANT
  346. break;
  347. case 37:
  348. 'mob_id = 1459; // G_MARIONETTE
  349. break;
  350. case 38:
  351. 'mob_id = 1565; // G_WILD_GINSENG
  352. break;
  353. case 39:
  354. 'mob_id = 2602; // G_ZIPPER_BEAR
  355. break;
  356. case 40:
  357. 'mob_id = 2644; // C4_STALACTIC_GOLEM
  358. break;
  359. case 41:
  360. 'mob_id = 2588; // G_PITMAN
  361. break;
  362. case 42:
  363. 'mob_id = 1624; // G_WASTE_STOVE
  364. break;
  365. case 43:
  366. 'mob_id = 2570; // G_BREEZE
  367. break;
  368. case 44:
  369. 'mob_id = 1573; // G_ELDER
  370. break;
  371. case 45:
  372. 'mob_id = 2811; // C3_GRAND_PECO
  373. break;
  374. case 46:
  375. 'mob_id = 2598; // G_UNGOLIANT
  376. break;
  377. case 47:
  378. 'mob_id = 1606; // G_GARM_BABY
  379. break;
  380. case 48:
  381. 'mob_id = 1794; // G_ROWEEN
  382. break;
  383. case 49:
  384. 'mob_id = 2596; // G_STAPO
  385. break;
  386. case 50:
  387. 'mob_id = 2838; // C5_EVIL_DRUID
  388. break;
  389. case 51:
  390. 'mob_id = 2569; // G_ANOPHELES
  391. break;
  392. case 52:
  393. 'mob_id = 2584; // G_MINERAL
  394. break;
  395. case 53:
  396. 'mob_id = 2599; // G_WILD_RIDER
  397. break;
  398. case 54:
  399. 'mob_id = 1531; // G_EVIL_CLOUD_HERMIT
  400. break;
  401. case 55:
  402. 'mob_id = 2612; // C5_WOOD_GOBLIN
  403. break;
  404. case 56:
  405. 'mob_id = 2587; // G_OBSIDIAN
  406. break;
  407. case 57:
  408. 'mob_id = 1564; // G_WICKED_NYMPH
  409. break;
  410. case 58:
  411. 'mob_id = 2586; // G_NERAID
  412. break;
  413. case 59:
  414. 'mob_id = 1483; // G_RYBIO
  415. break;
  416. case 60:
  417. 'mob_id = 2888; // C2_BANASPATY
  418. break;
  419. case 61:
  420. 'mob_id = 2593; // G_SIROMA
  421. break;
  422. case 62:
  423. 'mob_id = 2580; // G_KAHO
  424. break;
  425. case 63:
  426. 'mob_id = 1600; // G_HEATER
  427. break;
  428. case 64:
  429. 'mob_id = 1791; // G_GALION
  430. break;
  431. case 65:
  432. 'mob_id = 2629; // C3_UNGOLIANT
  433. break;
  434. case 66:
  435. 'mob_id = 2581; // G_LUDE
  436. break;
  437. case 67:
  438. 'mob_id = 2579; // G_HYLOZOIST
  439. break;
  440. case 68:
  441. 'mob_id = 1549; // G_LAVA_GOLEM
  442. break;
  443. case 69:
  444. 'mob_id = 2594; // G_SNOWIER
  445. break;
  446. default:
  447. 'mob_id = 2730; // C2_NOVUS
  448. break;
  449. }
  450. initnpctimer;
  451. end;
  452. OnTimer1000:
  453. stopnpctimer;
  454. if (('wave % 5) == 0) { // champion
  455. donpcevent 'npc_name$ + "::OnSpawn0";
  456. donpcevent 'npc_name$ + "::OnSpawn1";
  457. donpcevent 'npc_name$ + "::OnSpawn2";
  458. donpcevent 'npc_name$ + "::OnSpawn3";
  459. donpcevent 'npc_name$ + "::OnSpawn4";
  460. end;
  461. }
  462. if ('wave == 1) // first wave at x = 51
  463. .@dx = 3;
  464. else
  465. .@dx = 2;
  466. for ( .@i = 0; .@i < 24; .@i++ ) {
  467. donpcevent 'npc_name$ + "::OnSpawn" + .@dx;
  468. sleep 300;
  469. }
  470. // total ~7 secs
  471. end;
  472. OnSpawn0: callsub( S_Spawn, 0 );
  473. OnSpawn1: callsub( S_Spawn, 1 );
  474. OnSpawn2: callsub( S_Spawn, 2 );
  475. OnSpawn3: callsub( S_Spawn, 3 );
  476. OnSpawn4: callsub( S_Spawn, 4 );
  477. S_Spawn:
  478. .@x = 48 + getarg(0);
  479. monster 'map_def01$,.@x,74, "Invader!", 'mob_id,1;
  480. .@gid = $@mobid[0];
  481. setunitdata .@gid, UMOB_MODE, ( MD_CANMOVE|MD_NORANDOMWALK );
  482. setunitdata .@gid, UMOB_IGNORE_CELL_STACK_LIMIT, true;
  483. mob_setidleevent .@gid, 'npc_name$ + "::OnIdle" + getarg(0);
  484. end;
  485. OnIdle0: callsub( S_Idle, 0 );
  486. OnIdle1: callsub( S_Idle, 1 );
  487. OnIdle2: callsub( S_Idle, 2 );
  488. OnIdle3: callsub( S_Idle, 3 );
  489. OnIdle4: callsub( S_Idle, 4 );
  490. S_Idle:
  491. callfunc( "F_mobidle", ('npc_name$ + "::OnIdle" + getarg(0)), 'size_coord, 'x_mob, getarg(0), 'y_mob, 'dist_spot_AZ );
  492. 'mob_escaped++;
  493. if ('mob_escaped <= 20)
  494. mapannounce 'map_def01$, "" + 'mob_escaped + " " + ('mob_escaped == 1 ? "monster has" : "monsters have") + " escaped.", bc_map;
  495. if ('mob_escaped == 20)
  496. donpcevent instance_npcname("#wave_mode_forest_out") + "::OnFail";
  497. end;
  498. }
  499. // 1@def01,50,23,0 script #wave_mode_forest_warp WARPNPC,2,2,{
  500. 1@def01,50,30,0 script #wave_mode_forest_warp WARPNPC,2,2,{// official warp out
  501. end;
  502. OnTouch:
  503. if (wave_mode_map$ == "")
  504. warp "prontera",0,0;
  505. else {
  506. warp wave_mode_map$, wave_mode_x, wave_mode_y;
  507. wave_mode_map$ = "";
  508. wave_mode_x = wave_mode_y = 0;
  509. }
  510. end;
  511. }
  512. 1@def01,1,1,0 script #wave_mode_forest_out -1,{
  513. end;
  514. OnFail:
  515. donpcevent instance_npcname("#wave_mode_forest_system") + "::OnStop";
  516. mapannounce 'map_def01$, "You have failed the <Wave mode - Forest> challenge.", bc_map;
  517. enablenpc instance_npcname("#wave_mode_forest_warp");
  518. initnpctimer;
  519. end;
  520. OnTimer1000:
  521. mapannounce 'map_def01$, "<Wave mode - Forest> service has closed. You will be returned to the place you entered if you use the warp at the entrance.", bc_map;
  522. end;
  523. OnTimer30000:
  524. stopnpctimer;
  525. instance_destroy();
  526. end;
  527. OnInstanceInit:
  528. 'wave = 'mob_escaped = 0;
  529. 'map_def01$ = instance_mapname("1@def01");
  530. 'npc_name$ = instance_npcname("#wave_mode_forest_spawn");
  531. disablenpc instance_npcname("#wave_mode_forest_system");
  532. disablenpc instance_npcname("#wave_mode_forest_warp");
  533. disablenpc instance_npcname("#wave_mode_forest_out");
  534. setarray 'x_mob[0], 48, 48, 48, 48, 48, 48, 48;
  535. setarray 'y_mob[0], 74, 65, 56, 48, 40, 31, 23;
  536. 'size_coord = getarraysize('y_mob);
  537. for ( .@i = 0; .@i < 'size_coord -1; .@i++ ) {
  538. .@dist_mob[.@i+1] = distance( 'x_mob[.@i], 'y_mob[.@i], 'x_mob[.@i+1], 'y_mob[.@i+1] );
  539. .@total_mob += .@dist_mob[.@i+1];
  540. }
  541. for ( .@i = 0; .@i < 'size_coord -1; .@i++ )
  542. 'dist_spot_AZ[.@i] = .@total_mob - .@dist_mob[.@i];
  543. end;
  544. }
  545. // Wave mode sky
  546. 1@def02,30,35,0 script #wave_mode_sky_entrance WARPNPC,1,1,{
  547. end;
  548. OnTouch:
  549. if ('status_instance == 1)
  550. end;
  551. else if ('status_instance == 0) {
  552. 'status_instance = 1;
  553. initnpctimer;
  554. disablenpc instance_npcname("#wave_mode_sky_entrance");
  555. }
  556. else if ('status_instance == 2) {
  557. if (wave_mode_map$ == "")
  558. warp "prontera",0,0;
  559. else {
  560. warp wave_mode_map$, wave_mode_x, wave_mode_y;
  561. wave_mode_map$ = "";
  562. wave_mode_x = wave_mode_y = 0;
  563. }
  564. }
  565. end;
  566. OnTimer4000:
  567. stopnpctimer;
  568. donpcevent instance_npcname("#wave_mode_sky_system") + "::OnStart";
  569. end;
  570. }
  571. 1@def02,1,1,0 script #wave_mode_sky_system -1,{
  572. end;
  573. OnStart:
  574. initnpctimer;
  575. mapannounce 'map_def02$, "We would like to thank all costumers who always use Zonda Agency.", bc_map;
  576. end;
  577. OnTimer1000:
  578. mapannounce 'map_def02$, "3", bc_map;
  579. end;
  580. OnTimer2000:
  581. mapannounce 'map_def02$, "2", bc_map;
  582. end;
  583. OnTimer3000:
  584. mapannounce 'map_def02$, "1", bc_map;
  585. end;
  586. OnTimer4000:
  587. 'wave_num++;
  588. if ('wave_num % 5) {
  589. donpcevent 'npc_name_mob$ + "::OnSpawn";
  590. donpcevent 'npc_name_mercenary$ + "::OnStart";
  591. donpcevent 'npc_name_mercenary$ + "::OnStart";
  592. }
  593. else {
  594. donpcevent 'npc_name_treasure$ + "::OnStart";
  595. }
  596. end;
  597. OnTimer24000:
  598. mapannounce 'map_def02$, "Next monster wave will come out soon. Get ready.", bc_map;
  599. initnpctimer;
  600. end;
  601. OnStop:
  602. stopnpctimer;
  603. end;
  604. }
  605. 1@def02,1,1,0 script #wave_mode_sky_treasure -1,{
  606. end;
  607. OnStart:
  608. if ('treasure_num < 5)
  609. 'treasure_num++;
  610. mapannounce 'map_def02$, "!! " + 'treasure_num + " treasure box appeared !!", bc_map;
  611. for ( .@i = 0; .@i < 'treasure_num; .@i++ ) {
  612. monster 'map_def02$,0,0, "Treasure box",3075,1; // WA_TREASURE
  613. 'treasure_gid[.@i] = $@mobid[0];
  614. }
  615. initnpctimer;
  616. end;
  617. OnTimer16500: callsub( S_Dice, ET_DICE3 );
  618. OnTimer17500: callsub( S_Dice, ET_DICE2 );
  619. OnTimer18500: callsub( S_Dice, ET_DICE1 );
  620. OnTimer19500:
  621. for ( .@i = 0; .@i < 'treasure_num; .@i++ ) {
  622. if (unitexists('treasure_gid[.@i]))
  623. unitskilluseid 'treasure_gid[.@i],301,1,'treasure_gid[.@i],-1; // SA_INSTANTDEATH
  624. }
  625. donpcevent 'npc_name_treasure$ + "::OnStop";
  626. end;
  627. S_Dice:
  628. .@emotion_num = getarg(0);
  629. for ( .@i = 0; .@i < 'treasure_num; .@i++ ) {
  630. if (unitexists('treasure_gid[.@i]))
  631. emotion .@emotion_num, 'treasure_gid[.@i];
  632. }
  633. end;
  634. OnStop:
  635. deletearray 'treasure_gid[0], 'treasure_num;
  636. stopnpctimer;
  637. end;
  638. }
  639. 1@def02,1,1,0 script #wave_mode_sky_mercenary -1,{
  640. end;
  641. OnStart:
  642. monster 'map_def02$,29,35, "Mercenary", 3086,1, "",0,AI_WAVEMODE; // WA_MERCENARY
  643. .@gid = $@mobid[0];
  644. emotion ET_SURPRISE, .@gid;
  645. setunitdata .@gid, UMOB_IGNORE_CELL_STACK_LIMIT, true;
  646. mob_setidleevent .@gid, 'npc_name_mercenary$ + "::OnIdle";
  647. sleep 45000;
  648. if (unitexists(.@gid))
  649. unitskilluseid .@gid,301,1,.@gid,1,false; // SA_INSTANTDEATH
  650. end;
  651. OnIdle:
  652. callfunc( "F_mobidle", ('npc_name_mercenary$ + "::OnIdle"), 'size_coord, 'x_merc, 0, 'y_merc, 'dist_spot_ZA );
  653. end;
  654. }
  655. 1@def02,1,1,0 script #wave_mode_sky_mob_spawn -1,{
  656. end;
  657. OnSpawn:
  658. mapannounce 'map_def02$, "-- Wave " + 'wave_num + " --", bc_map;
  659. .@i = ('wave_num % 10) - 1;
  660. setarray .@mob_list[0],
  661. 3076, // WA_MONSTER_1
  662. 3077, // WA_MONSTER_2
  663. 3078, // WA_MONSTER_3
  664. 3079, // WA_MONSTER_4
  665. 3080, // WA_MONSTER_5 (skipped)
  666. 3081, // WA_MONSTER_6
  667. 3082, // WA_MONSTER_7
  668. 3083, // WA_MONSTER_8
  669. 3084, // WA_MONSTER_9
  670. 3085; // WA_MONSTER_10 (skipped)
  671. 'mob_id = .@mob_list[.@i];
  672. initnpctimer;
  673. end;
  674. OnTimer1000: callsub( S_Spawn, true ); // aggressive
  675. OnTimer1500: callsub( S_Spawn, false ); // passive
  676. OnTimer2000: callsub( S_Spawn, true );
  677. OnTimer2500: callsub( S_Spawn, false );
  678. OnTimer3000: callsub( S_Spawn, true );
  679. OnTimer3500: callsub( S_Spawn, false );
  680. OnTimer4000: callsub( S_Spawn, true );
  681. OnTimer4500: callsub( S_Spawn, false );
  682. OnTimer5000: callsub( S_Spawn, true );
  683. OnTimer5500: callsub( S_Spawn, false );
  684. OnTimer6000: callsub( S_Spawn, true );
  685. OnTimer6500: callsub( S_Spawn, false );
  686. OnTimer7000: callsub( S_Spawn, true );
  687. OnTimer7500: callsub( S_Spawn, false );
  688. OnTimer8000: callsub( S_Spawn, true );
  689. OnTimer8500:
  690. stopnpctimer;
  691. end;
  692. S_Spawn:
  693. monster 'map_def02$,48,67, "Go!", 'mob_id,1;
  694. if (getarg(0) == true)
  695. setunitdata $@mobid[0], UMOB_MODE, ( MD_CANMOVE|MD_NORANDOMWALK|MD_AGGRESSIVE|MD_CANATTACK );
  696. .@gid = $@mobid[0];
  697. emotion ET_SURPRISE, .@gid;
  698. setunitdata .@gid, UMOB_IGNORE_CELL_STACK_LIMIT, true;
  699. mob_setidleevent .@gid, 'npc_name_mob$ + "::OnIdle";
  700. end;
  701. OnIdle:
  702. // monster are walking to the nearest next spot
  703. callfunc( "F_mobidle", ('npc_name_mob$ + "::OnIdle"), 'size_coord, 'x_mob, 0, 'y_mob, 'dist_spot_AZ );
  704. 'mob_escaped++;
  705. if ('mob_escaped <= 20)
  706. mapannounce 'map_def02$, "" + 'mob_escaped + " " + ('mob_escaped == 1 ? "monster has" : "monsters have") + " escaped.", bc_map;
  707. if ('mob_escaped == 20)
  708. donpcevent instance_npcname("#wave_mode_sky_out") + "::OnFail";
  709. end;
  710. }
  711. 1@def02,1,1,0 script #wave_mode_sky_out -1,{
  712. end;
  713. OnFail:
  714. // monsters timers continue
  715. donpcevent instance_npcname("#wave_mode_sky_system") + "::OnStop";
  716. mapannounce 'map_def02$, "You have failed the <Wave mode - Sky> challenge.", bc_map;
  717. 'status_instance = 2;
  718. enablenpc instance_npcname("#wave_mode_sky_entrance");
  719. initnpctimer;
  720. end;
  721. OnTimer1000:
  722. mapannounce 'map_def02$, "<Wave mode - Sky> service has closed. You will be returned to the place you entered if you use the warp at the entrance.", bc_map;
  723. end;
  724. OnTimer30000:
  725. stopnpctimer;
  726. instance_destroy();
  727. end;
  728. OnInstanceInit:
  729. deletearray 'treasure_gid[0], 'treasure_num;
  730. 'wave_num = 'treasure_num = 'status_instance = 'mob_escaped = 0;
  731. 'map_def02$ = instance_mapname("1@def02");
  732. 'npc_name_mob$ = instance_npcname("#wave_mode_sky_mob_spawn");
  733. 'npc_name_treasure$ = instance_npcname("#wave_mode_sky_treasure");
  734. 'npc_name_mercenary$ = instance_npcname("#wave_mode_sky_mercenary");
  735. disablenpc instance_npcname("#wave_mode_sky_out");
  736. setarray 'x_mob[0], 48, 38, 30, 30, 29, 38, 47, 51, 50, 42, 33, 29;
  737. setarray 'y_mob[0], 67, 67, 64, 58, 52, 52, 51, 45, 36, 36, 36, 35;
  738. setarray 'x_merc[0], 29, 33, 42, 50, 51, 47, 38, 29, 30, 30, 38, 47;
  739. setarray 'y_merc[0], 35, 36, 36, 36, 45, 51, 52, 52, 58, 64, 67, 67;
  740. 'size_coord = getarraysize('x_mob);
  741. for ( .@i = 0; .@i < 'size_coord -1; .@i++ ) {
  742. .@dist_mob[.@i+1] = distance( 'x_mob[.@i], 'y_mob[.@i], 'x_mob[.@i+1], 'y_mob[.@i+1] );
  743. .@total_mob += .@dist_mob[.@i+1];
  744. .@dist_merc[.@i+1] = distance( 'x_merc[.@i], 'y_merc[.@i], 'x_merc[.@i+1], 'y_merc[.@i+1] );
  745. .@total_merc += .@dist_merc[.@i+1];
  746. }
  747. for ( .@i = 0; .@i < 'size_coord -1; .@i++ ) {
  748. 'dist_spot_AZ[.@i] = .@total_mob - .@dist_mob[.@i];
  749. 'dist_spot_ZA[.@i] = .@total_merc - .@dist_merc[.@i];
  750. }
  751. end;
  752. }