morroc_raceway.txt 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. //===== rAthena Script =======================================
  2. //= Morroc Raceway
  3. //===== By: ==================================================
  4. //= acky
  5. //===== Current Version: =====================================
  6. //= 1.3
  7. //===== Compatible With: =====================================
  8. //= rAthena Project
  9. //===== Description: =========================================
  10. //= Lets players race around Morroc (pvp_y_1-5)
  11. //===== Additional Comments: =================================
  12. //= If there are more than 3 players, at least 3 people
  13. //= must finish before a new race can be started.
  14. //=
  15. //= If there are less than 3 players, at least 1 person
  16. //= must finish before a new race can be started.
  17. //=
  18. //= Removed permanent global variables
  19. //= 1.2 Removed Duplicates [Silent]
  20. //= 1.3 Replaced effect numerics with constants. [Samuray22]
  21. //============================================================
  22. //Warps you into race way
  23. morocc,166,105,6 script Race Girl#01 116,{
  24. mes "[Race Girl]";
  25. mes "Would you like to visit ^0000FFMorroc Raceway^000000?";
  26. next;
  27. menu "Yes",L_Warp,"No",-;
  28. mes "[Race Girl]";
  29. mes "Alright, talk to me again when you want to go.";
  30. close;
  31. L_Warp:
  32. warp "pvp_y_1-5",165,256;
  33. close;
  34. }
  35. //Warps you out of raceway
  36. pvp_y_1-5,169,265,5 script Race Girl#02 116,{
  37. mes "[Race Girl]";
  38. mes "Welcome to Morroc Raceway!";
  39. next;
  40. menu "Information",-,"Leave",L_Warp,"Cancel",L_Cancel;
  41. mes "[Race Girl]";
  42. mes "Someone must click on the Starter NPC to start the race.";
  43. next;
  44. mes "[Race Girl]";
  45. mes "Once the race is started, run around Morroc anti-clockwise.";
  46. next;
  47. mes "[Race Girl]";
  48. mes "You must reach all the checkpoints - No cheating!";
  49. close;
  50. L_Warp:
  51. warp "morocc",165,101;
  52. L_Cancel:
  53. mes "[Race Girl]";
  54. mes "Come again soon!";
  55. close;
  56. }
  57. //Counts down and starts race
  58. pvp_y_1-5,145,269,5 script Starter 733,{
  59. if ($@race != 0) goto L_Started;
  60. if ($@counting != 0) goto L_Started;
  61. if ($@racecount == 1) goto L_Started;
  62. L_Menu:
  63. mes "[Race Starter]";
  64. mes "Please stay on the Eastern side of me.";
  65. menu "Start Race",L_Count,"Cancel",-;
  66. close;
  67. L_Count:
  68. set $@counting,1;
  69. mes "Counting down...";
  70. addtimer 1000, "Starter::OnCount1000";
  71. addtimer 2000, "Starter::OnCount2000";
  72. addtimer 3000, "Starter::OnCount3000";
  73. addtimer 4000, "Starter::OnCount4000";
  74. announce strcharinfo(0) + "Started a countdown",1;
  75. announce "Get ready to race!",1;
  76. close;
  77. OnCount1000:
  78. announce "[3]",1;
  79. end;
  80. OnCount2000:
  81. announce "[2]",1;
  82. end;
  83. OnCount3000:
  84. announce "[1]",1;
  85. end;
  86. OnCount4000:
  87. emotion e_go;
  88. specialeffect EF_CHIMTO;
  89. announce "[GO!]",1;
  90. set $@race,1;
  91. set $@position,0;
  92. set $@counting,0;
  93. set $@raceid,rand(100000,999999);
  94. end;
  95. L_Started:
  96. if ((getmapusers("pvp_y_1-5") < 3) && ($@position > 0)) goto L_Menu;
  97. if ($@position > 2) goto L_Menu;
  98. mes "[Starter]";
  99. mes "Race in progress";
  100. close;
  101. OnInit:
  102. set $@race,0;
  103. set $@position,0;
  104. set $@racecount,0;
  105. end;
  106. }
  107. //Checkpoint 1
  108. pvp_y_1-5,144,262,5 script Check Point 1 111,0,5,{
  109. end;
  110. OnTouch:
  111. if (@raceid != $@raceid) goto L_Started;
  112. if (@race == 6) goto L_Finished;
  113. if ($@race == 1) goto L_Started;
  114. mes "The race has not started, please move back.";
  115. close;
  116. L_Started:
  117. set @race,1;
  118. set @raceid,$@raceid;
  119. end;
  120. L_Finished:
  121. mes "You have already completed the race.";
  122. close;
  123. }
  124. //Checkpoint 2
  125. pvp_y_1-5,73,247,5 script Check Point 2 111,6,6,{
  126. end;
  127. OnTouch:
  128. if (@race != 1) goto L_Miss;
  129. set @race,2;
  130. announce "[" + strcharinfo(0) +"] has reached Checkpoint [1]",1;
  131. end;
  132. L_Miss:
  133. mes "You have missed a Checkpoint. Please go back.";
  134. close;
  135. }
  136. //Checkpoint 3
  137. pvp_y_1-5,77,44,5 script Check Point 3 111,6,6,{
  138. end;
  139. OnTouch:
  140. if (@race != 2) goto L_Miss;
  141. set @race,3;
  142. announce "[" + strcharinfo(0) +"] has reached Checkpoint [2]",1;
  143. end;
  144. L_Miss:
  145. mes "You have missed a Checkpoint. Please go back.";
  146. close;
  147. }
  148. //Checkpoint 3
  149. pvp_y_1-5,249,60,5 script Check Point 4 111,6,6,{
  150. end;
  151. OnTouch:
  152. if (@race != 3) goto L_Miss;
  153. set @race,4;
  154. announce "[" + strcharinfo(0) +"] has reached Checkpoint [3]",1;
  155. end;
  156. L_Miss:
  157. mes "You have missed a Checkpoint. Please go back.";
  158. close;
  159. }
  160. //Checkpoint 4
  161. pvp_y_1-5,255,256,5 script Check Point 5 111,6,6,{
  162. end;
  163. OnTouch:
  164. if (@race != 4) goto L_Miss;
  165. set @race,5;
  166. announce "[" + strcharinfo(0) +"] has reached Checkpoint [4]",1;
  167. end;
  168. L_Miss:
  169. mes "You have missed a Checkpoint. Please go back.";
  170. close;
  171. }
  172. //Finish Line
  173. pvp_y_1-5,174,244,5 script Finish Line 111,6,6,{
  174. end;
  175. OnTouch:
  176. if (@raceid != $@raceid) goto L_WrongRace;
  177. if (@race != 5) goto L_Miss;
  178. set @race,6;
  179. set $@position,$@position+1;
  180. announce "[" + strcharinfo(0) +"] has reached The Finish line! [Position: " + $@position + "]",1;
  181. end;
  182. L_Miss:
  183. mes "You have missed a Checkpoint. Please go back.";
  184. close;
  185. L_WrongRace:
  186. mes "You are not in this race.";
  187. close;
  188. }
  189. //Check Point Marker Flags
  190. pvp_y_1-5,144,267,4 script Check Point 1#01 722,{
  191. end;
  192. }
  193. pvp_y_1-5,144,257,4 script Check Point 1#02 722,{
  194. end;
  195. }
  196. pvp_y_1-5,70,252,3 script Check Point 2#01 722,{
  197. end;
  198. }
  199. pvp_y_1-5,77,243,3 script Check Point 2#02 722,{
  200. end;
  201. }
  202. pvp_y_1-5,81,48,1 script Check Point 3#01 722,{
  203. end;
  204. }
  205. pvp_y_1-5,72,40,1 script Check Point 3#02 722,{
  206. end;
  207. }
  208. pvp_y_1-5,244,65,7 script Check Point 4#01 722,{
  209. end;
  210. }
  211. pvp_y_1-5,252,57,7 script Check Point 4#02 722,{
  212. end;
  213. }
  214. pvp_y_1-5,259,260,5 script Check Point 5#01 722,{
  215. end;
  216. }
  217. pvp_y_1-5,251,252,5 script Check Point 5#02 722,{
  218. end;
  219. }
  220. pvp_y_1-5,174,249,4 script Finish Line#01 722,{
  221. end;
  222. }
  223. pvp_y_1-5,174,238,4 script Finish Line#02 722,{
  224. end;
  225. }