Advertisement
HDScripts

Poring Race(Hercules)

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