Guest User

Untitled

a guest
Oct 2nd, 2014
349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.45 KB | None | 0 0
  1. //===== Athena Script ========================================
  2. //= Poring Race System
  3. //===== By: ==================================================
  4. //= Masao
  5. //= Original Script from Zell_ff8 & xianz
  6. //===== Current Version: =====================================
  7. //= 1.0
  8. //===== Compatible With: =====================================
  9. //= Any eAthena SVN
  10. //===== Description: =========================================
  11. //= Poring Race
  12. //===== Additional Comments: =================================
  13. //= Version 1.0 if there are any Bugs please let me know.
  14. //= Thanks to goddameit for helping me with the prize distribution.
  15. //============================================================
  16.  
  17. prontera.gat,0,0,0 script PraceAnnouncer -1,{
  18.  
  19. OnClock0000:
  20. OnClock0646:
  21. OnClock0800:
  22. OnClock1200:
  23. OnClock1600:
  24. OnClock2000:
  25. set $accessPrace,1;
  26. initnpctimer "Race Manager#prace0";
  27. announce "The Poringrace is now open!",0;
  28. end;
  29. }
  30.  
  31. prontera,141,184,6 script Poringrace Warper 909,{
  32.  
  33. set .@name$,"[Warper]";
  34. if ($accessPrace == 0) goto L_PraceOff;
  35.  
  36. mes .@name$;
  37. mes "Would you like to be warped onto the Poringrace Map??";
  38. menu "Yes, please!",-,"No, thanks.",L_Cancel;
  39. close2;
  40. warp "p_track01.gat",74,42;
  41. end;
  42.  
  43. L_Cancel:
  44. mes .@name$;
  45. mes "Ok, bye.";
  46. close;
  47.  
  48. L_PraceOff:
  49. set @Hour, gettime(3);
  50. set @Minute, gettime(2);
  51. set @PraceTime, gettime(3) + 4;
  52. if (gettime(3) == 1) set @PraceTime, @PraceTime-1;
  53. if (gettime(3) == 2) set @PraceTime, @PraceTime-2;
  54. if (gettime(3) == 3) set @PraceTime, @PraceTime-3;
  55. if (gettime(3) == 5) set @PraceTime, @PraceTime-1;
  56. if (gettime(3) == 6) set @PraceTime, @PraceTime-2;
  57. if (gettime(3) == 7) set @PraceTime, @PraceTime-3;
  58. if (gettime(3) == 9) set @PraceTime, @PraceTime-1;
  59. if (gettime(3) == 10) set @PraceTime, @PraceTime-2;
  60. if (gettime(3) == 11) set @PraceTime, @PraceTime-3;
  61. if (gettime(3) == 13) set @PraceTime, @PraceTime-1;
  62. if (gettime(3) == 14) set @PraceTime, @PraceTime-2;
  63. if (gettime(3) == 15) set @PraceTime, @PraceTime-3;
  64. if (gettime(3) == 17) set @PraceTime, @PraceTime-1;
  65. if (gettime(3) == 18) set @PraceTime, @PraceTime-2;
  66. if (gettime(3) == 19) set @PraceTime, @PraceTime-3;
  67. if (gettime(3) == 21) set @PraceTime, @PraceTime-1;
  68. if (gettime(3) == 22) set @PraceTime, @PraceTime-2;
  69. if (gettime(3) == 23) set @PraceTime, @PraceTime-3;
  70. mes .@name$;
  71. mes "The Poringrace is closed right now..";
  72. mes "The next Race takes place on "+@PraceTime+".";
  73. mes "And right now it is "+@Hour+":"+@Minute+".";
  74. close;
  75. }
  76.  
  77. p_track01,58,41,2 script Race Manager#prace0 765,{
  78.  
  79. set .@name$,"[Race Manager]";
  80. set .@prace_zeny,10000;
  81. if ($prace_random < 1) callsub OnInit;
  82. if (@prace_bet == 1) goto L_AlreadyPlaying;
  83.  
  84. getmapxy(.@mapname$,.@mapx1,.@mapy,1,"Poring#prace1");
  85. getmapxy(.@mapname$,.@mapx2,.@mapy,1,"Angeling#prace2");
  86. getmapxy(.@mapname$,.@mapx3,.@mapy,1,"Metaling#prace3");
  87. getmapxy(.@mapname$,.@mapx4,.@mapy,1,"Deviling#prace4");
  88. getmapxy(.@mapname$,.@mapx5,.@mapy,1,"Santa Poring#prace5");
  89. getmapxy(.@mapname$,.@mapx6,.@mapy,1,"Poporing#prace6");
  90. if (.@mapx1 != 58 || .@mapx2 != 58 || .@mapx3 != 58 || .@mapx4 != 58 || .@mapx5 != 58 || .@mapx6 != 58) {
  91. mes .@name$;
  92. mes "The Race alreday begun...";
  93. close;
  94. }
  95.  
  96. mes .@name$;
  97. mes "On which Poring would you like to bet??";
  98. mes "It only costs you "+.@prace_zeny+" Zeny to make a bet.";
  99. next;
  100. menu "Poring",L_P1,"Angeling",L_P2,"Metaling",L_P3,"Deviling",L_P4,"Santa Poring",L_P5,"Poporing",L_P6,"Keines",-;
  101.  
  102. mes .@name$;
  103. mes "Have a nice day.";
  104. close;
  105.  
  106. L_P1:
  107. if (Zeny < .@prace_zeny) goto L_NoZeny;
  108. set Zeny,Zeny-.@prace_zeny;
  109. set @prace_winner$,"Poring";
  110. goto L_Ready;
  111. L_P2:
  112. if (Zeny < .@prace_zeny) goto L_NoZeny;
  113. set Zeny,Zeny-.@prace_zeny;
  114. set @prace_winner$,"Angeling";
  115. goto L_Ready;
  116. L_P3:
  117. if (Zeny < .@prace_zeny) goto L_NoZeny;
  118. set Zeny,Zeny-.@prace_zeny;
  119. set @prace_winner$,"Metaling";
  120. goto L_Ready;
  121. L_P4:
  122. if (Zeny < .@prace_zeny) goto L_NoZeny;
  123. set Zeny,Zeny-.@prace_zeny;
  124. set @prace_winner$,"Deviling";
  125. goto L_Ready;
  126. L_P5:
  127. if (Zeny < .@prace_zeny) goto L_NoZeny;
  128. set Zeny,Zeny-.@prace_zeny;
  129. set @prace_winner$,"Santa Poring";
  130. goto L_Ready;
  131. L_P6:
  132. if (Zeny < .@prace_zeny) goto L_NoZeny;
  133. set Zeny,Zeny-.@prace_zeny;
  134. set @prace_winner$,"Poporing";
  135. goto L_Ready;
  136.  
  137. L_Ready:
  138. set $@prace_bets,$@prace_bets+1;
  139. set $prace_bidders[$@prace_bets],getcharid(3);
  140. set @prace_bet,1;
  141. mes .@name$;
  142. mes "I've got "+$@prace_bets+" bets so far.";
  143. npctalk "I've got "+strcharinfo(0)+"'s bet for this race!";
  144. close;
  145.  
  146. L_AlreadyPlaying:
  147. mes .@name$;
  148. mes "You've already chosen ^00bb00"+@prace_winner$+"^000000.";
  149. close;
  150.  
  151. L_NoZeny:
  152. mes .@name$;
  153. mes "You do not have enough zeny.";
  154. close;
  155.  
  156. OnInit:
  157. set $prace_random,70;
  158. set $prace_random2,600;
  159. set $prace_winner$,"";
  160. set $@prace_bets,0;
  161. set $prace_bidders,0;
  162. end;
  163.  
  164. OnTimer60000:
  165. mapannounce "p_track01","3 minutes until the Race starts!",1,0xFFAB54;
  166. end;
  167.  
  168. OnTimer120000:
  169. mapannounce "p_track01","2 minutes until the Race starts!",1,0xFFAB54;
  170. end;
  171.  
  172. OnTimer180000:
  173. mapannounce "p_track01","1 minute until the Race starts!",1,0xFFAB54;
  174. end;
  175.  
  176. OnTimer240000:
  177. mapannounce "p_track01","Porings, on your marks... get ready...",1,0xFFAB54;
  178. end;
  179.  
  180. OnTimer241000:
  181. mapannounce "p_track01","...1...",1,0xFFAB54;
  182. end;
  183.  
  184. OnTimer242000:
  185. mapannounce "p_track01","...2...",1,0xFFAB54;
  186. end;
  187.  
  188. OnTimer243000:
  189. donpcevent "Race Manager#prace0::OnStartRace";
  190. mapannounce "p_track01","...3...",1,0xFFAB54;
  191. end;
  192.  
  193. OnTimer243500:
  194. mapannounce "p_track01","Goooo!!!",1,0xFFAB54;
  195. end;
  196.  
  197. OnTimer303500:
  198. set $prace_winner$,"";
  199. set $@prace_bets,0;
  200. callsub ReturnRace;
  201. end;
  202.  
  203. OnStartRace:
  204. donpcevent "Poring#prace1::OnRace";
  205. donpcevent "Angeling#prace2::OnRace";
  206. donpcevent "Metaling#prace3::OnRace";
  207. donpcevent "Deviling#prace4::OnRace";
  208. donpcevent "Santa Poring#prace5::OnRace";
  209. donpcevent "Poporing#prace6::OnRace";
  210. end;
  211.  
  212. OnStopRace:
  213. donpcevent "Poring#prace1::OnStop";
  214. donpcevent "Angeling#prace2::OnStop";
  215. donpcevent "Metaling#prace3::OnStop";
  216. donpcevent "Deviling#prace4::OnStop";
  217. donpcevent "Santa Poring#prace5::OnStop";
  218. donpcevent "Poporing#prace6::OnStop";
  219. if ($prace_winner$ != "") callsub WinRace;
  220. end;
  221.  
  222. ReturnRace:
  223. donpcevent "Poring#prace1::OnReturn";
  224. donpcevent "Angeling#prace2::OnReturn";
  225. donpcevent "Metaling#prace3::OnReturn";
  226. donpcevent "Deviling#prace4::OnReturn";
  227. donpcevent "Santa Poring#prace5::OnReturn";
  228. donpcevent "Poporing#prace6::OnReturn";
  229. end;
  230.  
  231. WinRace:
  232. mapannounce "p_track01","And the Winner is "+$prace_winner$,1,0xFFAB54;
  233. donpcevent "Checker#prace0::OnCheck";
  234. sleep2 10000;
  235. mapwarp "p_track01.gat","prontera",155,180;
  236. set $accessPrace,0;
  237. end;
  238. }
  239.  
  240. - script Checker#prace0 -1,{
  241. OnCheck:
  242. for(set .@tmp1,1;.@tmp1<=$@prace_bets;set .@tmp1,.@tmp1+1){
  243. if(attachrid($prace_bidders[.@tmp1])){
  244. dispbottom "The winner is "+$prace_winner$+" and you bet on "+@prace_winner$+".";
  245. if (@prace_winner$ == $prace_winner$) {
  246. dispbottom "You've won!";
  247. getitem 12109,2;
  248. emotion 21,1;
  249. } else {
  250. dispbottom "You've lost.";
  251. emotion 28,1;
  252. }
  253. set @prace_winner$,"";
  254. set @prace_bet,0;
  255. detachrid;
  256. }
  257. }
  258. deletearray $prace_bidders[1],128;
  259. set $@prace_bets,0;
  260. end;
  261. }
  262.  
  263. p_track01,58,38,2 script Poring#prace1 1002,{
  264. end;
  265.  
  266. OnRace:
  267. initnpctimer;
  268. end;
  269.  
  270. OnStop:
  271. stopnpctimer;
  272. end;
  273.  
  274. OnReturn:
  275. npcwalkto 58,38;
  276. end;
  277.  
  278. OnTimer1000:
  279. getmapxy(.@mapname$,.@mapx,.@mapy,1,"Poring#prace1");
  280. if (rand(100) < $prace_random) npcwalkto .@mapx-1,.@mapy;
  281. setnpctimer rand($prace_random2);
  282. startnpctimer;
  283. if ((.@mapx-1) == 29) {
  284. set $prace_winner$,"Poring";
  285. emotion 29;
  286. donpcevent "Race Manager#prace0::OnStopRace";
  287. }
  288. end;
  289. }
  290.  
  291. p_track01,58,36,2 script Angeling#prace2 1096,{
  292. end;
  293.  
  294. OnRace:
  295. initnpctimer;
  296. end;
  297.  
  298. OnStop:
  299. stopnpctimer;
  300. end;
  301.  
  302. OnReturn:
  303. npcwalkto 58,36;
  304. end;
  305.  
  306. OnTimer1000:
  307. getmapxy(.@mapname$,.@mapx,.@mapy,1,"Angeling#prace2");
  308. if (rand(100) < $prace_random) npcwalkto .@mapx-1,.@mapy;
  309. setnpctimer rand($prace_random2);
  310. startnpctimer;
  311. if ((.@mapx-1) == 29) {
  312. set $prace_winner$,"Angeling";
  313. emotion 29;
  314. donpcevent "Race Manager#prace0::OnStopRace";
  315. }
  316. end;
  317. }
  318.  
  319. p_track01,58,34,2 script Metaling#prace3 1613,{
  320. end;
  321.  
  322. OnRace:
  323. initnpctimer;
  324. end;
  325.  
  326. OnStop:
  327. stopnpctimer;
  328. end;
  329.  
  330. OnReturn:
  331. npcwalkto 58,34;
  332. end;
  333.  
  334. OnTimer1000:
  335. getmapxy(.@mapname$,.@mapx,.@mapy,1,"Metaling#prace3");
  336. if (rand(100) < $prace_random) npcwalkto .@mapx-1,.@mapy;
  337. setnpctimer rand($prace_random2);
  338. startnpctimer;
  339. if ((.@mapx-1) == 29) {
  340. set $prace_winner$,"Metaling";
  341. emotion 29;
  342. donpcevent "Race Manager#prace0::OnStopRace";
  343. }
  344. end;
  345. }
  346.  
  347. p_track01,58,32,2 script Deviling#prace4 1582,{
  348. end;
  349.  
  350. OnRace:
  351. initnpctimer;
  352. end;
  353.  
  354. OnStop:
  355. stopnpctimer;
  356. end;
  357.  
  358. OnReturn:
  359. npcwalkto 58,32;
  360. end;
  361.  
  362. OnTimer1000:
  363. getmapxy(.@mapname$,.@mapx,.@mapy,1,"Deviling#prace4");
  364. if (rand(100) < $prace_random) npcwalkto .@mapx-1,.@mapy;
  365. setnpctimer rand($prace_random2);
  366. startnpctimer;
  367. if ((.@mapx-1) == 29) {
  368. set $prace_winner$,"Deviling";
  369. emotion 29;
  370. donpcevent "Race Manager#prace0::OnStopRace";
  371. }
  372. end;
  373. }
  374.  
  375. p_track01,58,30,2 script Santa Poring#prace5 1062,{
  376. end;
  377.  
  378. OnRace:
  379. initnpctimer;
  380. end;
  381.  
  382. OnStop:
  383. stopnpctimer;
  384. end;
  385.  
  386. OnReturn:
  387. npcwalkto 58,30;
  388. end;
  389.  
  390. OnTimer1000:
  391. getmapxy(.@mapname$,.@mapx,.@mapy,1,"Santa Poring#prace5");
  392. if (rand(100) < $prace_random) npcwalkto .@mapx-1,.@mapy;
  393. setnpctimer rand($prace_random2);
  394. startnpctimer;
  395. if ((.@mapx-1) == 29) {
  396. set $prace_winner$,"Santa Poring";
  397. emotion 29;
  398. donpcevent "Race Manager#prace0::OnStopRace";
  399. }
  400. end;
  401. }
  402.  
  403. p_track01,58,28,2 script Poporing#prace6 1031,{
  404. end;
  405.  
  406. OnRace:
  407. initnpctimer;
  408. end;
  409.  
  410. OnStop:
  411. stopnpctimer;
  412. end;
  413.  
  414. OnReturn:
  415. npcwalkto 58,28;
  416. end;
  417.  
  418. OnTimer1000:
  419. getmapxy(.@mapname$,.@mapx,.@mapy,1,"Poporing#prace6");
  420. if (rand(100) < $prace_random) npcwalkto .@mapx-1,.@mapy;
  421. setnpctimer rand($prace_random2);
  422. startnpctimer;
  423. if ((.@mapx-1) == 29) {
  424. set $prace_winner$,"Poporing";
  425. emotion 29;
  426. donpcevent "Race Manager#prace0::OnStopRace";
  427. }
  428. end;
  429. }
  430.  
  431. p_track01 mapflag nobranch
  432. p_track01 mapflag noicewall
  433. p_track01 mapflag nomemo
  434. p_track01 mapflag noreturn
  435. p_track01 mapflag noteleport
  436. p_track01 mapflag nowarpto
  437. p_track01 mapflag nowarp
  438. p_track01 mapflag pvp off
  439. p_track01 mapflag nosave
Advertisement
Add Comment
Please, Sign In to add comment