summaryrefslogtreecommitdiff
path: root/npc/other/monster_race.txt
blob: 273df9345f4d8e8ba93ae7d0e8cb3882b797bae2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
//===== Hercules Script ======================================
//= Hugel Monster Races
//===== By: ==================================================
//= L0ne_W0lf
//===== Current Version: =====================================
//= 1.8
//===== Description: =========================================
//= [Official Conversion]
//= - Hugel Monster Races (Single and Double)
//= - Prize Medal Exchanging, and Monster Track NPCs.
//= - Contains both euRO and iRO dialog.
//= - There are no permenent variables.
//===== Additional Comments: =================================
//= 1.0 First version. Please report bugs. [L0ne_W0lf]
//= 1.1 Corrected a minor typo. [L0ne_W0lf]
//= 1.2 Replaced effect numerics with constants. [L0ne_W0lf]
//= 1.3 Ei'felle now gives Exercise. (Bugreport:4092) [L0ne_W0lf]
//= 1.4 Fixed call to a non-existant event. [L0ne_W0lf]
//= 1.5 Updated Dialog. [L0ne_W0lf]
//= 1.6 Updated experience rewards. [L0ne_W0lf]
//= 1.7 Optimization, -4000 lines (more can still be done). [Euphy]
//= 1.8 Optimized.
//= 	Fixed Medal Distributor (Dual Race) disappears accordingly. [Joseph] 
//============================================================

// Monstrer Race - Single Monster Race
//============================================================
hugel,51,61,0	script	#race_timer1-1	-1,{
OnInit:
OnEnable:
	enablenpc "#race_timer1-1";
	set $@mon_time_1_1,2;
	initnpctimer;
	end;

OnDisable:
	disablenpc "#race_timer1-1";
	stopnpctimer;
	end;

OnTimer10000:
	mapannounce "hugel","The Single Monster Race will soon begin. We hope to see many of you participate!",bc_map,"0x87ceeb";
	end;

OnTimer30000:
	mapannounce "hugel","The Single Monster Race Arena has just opened.",bc_map,"0x87ceeb";
	set $@mon_time_1_1,1;
	donpcevent "Race Progress Timer::OnEnable";
	end;

OnTimer90000:
	mapannounce "hugel","The Single Monster Race arena is now open. Participants should enter the Arena as soon as they can.",bc_map,"0x87ceeb";
	end;

OnTimer210000:
	mapannounce "hugel","The entrance to the Single Monster Race Arena will close shortly. Participants, please enter the arena now.",bc_map,"0x87ceeb";
	end;

OnTimer270000:
	mapannounce "hugel","The Single Monster Race Arena's entrance will soon close.",bc_map,"0x87ceeb";
	end;

OnTimer272000:
	mapannounce "hugel","Participants, please enter the Arena before the doors close.",bc_map,"0x87ceeb";
	end;

OnTimer330000:
	mapannounce "hugel","The race is now starting. If you missed your chance to enter this race, please try again next time~!",bc_map,"0x87ceeb";
	set $@mon_time_1_1,0;
	donpcevent "#race_timer1-1::OnDisable";
	stopnpctimer;
	end;
}

p_track01,58,0,0	script	Race Progress Timer	-1,{
OnEnable:
	enablenpc "Race Progress Timer";
	initnpctimer;
	for (set .@i, 1; .@i <= 6; set .@i, .@i + 1)
		enablenpc "starting#"+.@i;
	set .@c, 1;
	while (.@c <= 6) {
		setd ".@line_"+.@c,rand(1,70);
		if (getd(".@line_"+.@c) <= 10) {
			setd "$@mr_1_luk"+.@c,getd(".@line_"+.@c);
			enablenpc "Luk"+.@c+"#5";
			enablenpc "Luk"+.@c+"#6";
			setd "$@mr_1_tire"+.@c,rand(50,60);
			enablenpc "Tire"+.@c+"#1";
		} else if (getd(".@line_"+.@c) <= 30) {
			setd "$@mr_1_luk"+.@c,getd(".@line_"+.@c);
			enablenpc "Luk"+.@c+"#5";
			set getd(".@tired"+.@c),rand(40,60);
			setd "$@mr_1_tire"+.@c,getd(".@tired"+.@c);
			enablenpc "Tire"+.@c+"#1";
			if (getd(".@tired"+.@c) >= 50)	enablenpc "Tire"+.@c+"#2";
		} else if (getd(".@line_"+.@c) <= 40) {
			setd "$@mr_1_luk"+.@c,getd(".@line_"+.@c);
			enablenpc "Luk"+.@c+"#1";
			set getd(".@tired"+.@c),rand(30,50);
			setd "$@mr_1_tire"+.@c,getd(".@tired"+.@c);
			enablenpc "Tire"+.@c+"#1";
			enablenpc "Tire"+.@c+"#2";
			if (getd(".@tired"+.@c) < 40) enablenpc "Tire"+.@c+"#3";
		} else if (getd(".@line_"+.@c) <= 50) {
			setd "$@mr_1_luk"+.@c,getd(".@line_"+.@c);
			enablenpc "Luk"+.@c+"#1";
			enablenpc "Luk"+.@c+"#2";
			set getd(".@tired"+.@c),rand(20,40);
			setd "$@mr_1_tire"+.@c,getd(".@tired"+.@c);
			for (set .@i, 1; .@i <= 3; set .@i, .@i + 1)
				enablenpc "Tire"+.@c+"#"+.@i;
			if (getd(".@tired"+.@c) < 30) enablenpc "Tire"+.@c+"#4";
		} else if (getd(".@line_"+.@c)) <= 60 {
			setd "$@mr_1_luk"+.@c,getd(".@line_"+.@c);
			for (set .@i, 1; .@i <= 3; set .@i, .@i + 1)
				enablenpc "Luk"+.@c+"#"+.@i;
			set getd(".@tired"+.@c),rand(10,30);
			setd "$@mr_1_tire"+.@c,getd(".@tired"+.@c);
			for (set .@i, 1; .@i <= 4; set .@i, .@i + 1)
				enablenpc "Tire"+.@c+"#"+.@i;
			if (getd(".@tired"+.@c) < 20) enablenpc "Tire"+.@c+"#5";
		} else if (getd(".@line_"+.@c) <= 70) {
			setd "$@mr_1_luk"+.@c,getd(".@line_"+.@c);
			for (set .@i, 1; .@i <= 4; set .@i, .@i + 1)
				enablenpc "Luk"+.@c+"#"+.@i;
			set getd(".@tired"+.@c),rand(0,20);
			setd "$@mr_1_tire"+.@c,getd(".@tired"+.@c);
			for (set .@i, 1; .@i <= 5; set .@i, .@i + 1)
				enablenpc "Tire"+.@c+"#"+.@i;
			if (getd(".@tired"+.@c) < 10) enablenpc "Tire"+.@c+"#6";
		}
		set .@c, .@c + 1;
	}
	end;

OnDisable:
	disablenpc "Race Progress Timer";
	stopnpctimer;
	end;

OnTimer1000:
	enablenpc "Ticket Helper#single";
	end;

OnTimer7000:
	mapannounce "p_track01","Welcome to the Monster Race Arena.",bc_map,"0xffb6c1";
	end;

OnTimer10000:
	mapannounce "p_track01","Feel free to inquire at the help desk whenever you have questions.",bc_map,"0xffb6c1";
	end;

OnTimer120000:
	mapannounce "p_track01","The Single Monster Race will start in 3 minutes.",bc_map,"0xffb6c1";
	end;

OnTimer123000:
	mapannounce "p_track01","Please ask a Ticket Helper if you wish to wager on the race.",bc_map,"0xffb6c1";
	end;

OnTimer240000:
	mapannounce "p_track01","The Single Monster Race will start shortly.",bc_map,"0xffb6c1";
	end;

OnTimer243000:
	mapannounce "p_track01","Please ask a Ticket Helper if you wish to wager on the race.",bc_map,"0xffb6c1";
	end;

OnTimer300000:
	mapannounce "p_track01","The Monster Race has already begun. Good luck to all the participants.",bc_map,"0xffb6c1";
	set $@mon_time_1_1,0;
	set $@monster_race,0;
	disablenpc "Ticket Helper#single";
	for (set .@i, 1; .@i <= 6; set .@i, .@i + 1)
		donpcevent "Runner No. "+.@i+"::OnEnable";
	stopnpctimer;
	end;
	
OnInit:
	disablenpc "Race Progress Timer";
	end;
}

p_track01,73,22,1	script	Ticket Helper#single	899,{
	mes "[Ticket Helper]";
	mes "Welcome to the";
	mes "Monster Race Arena.";
	mes "If you'd like to participate";
	mes "in the ^3131FFSingle Monster Race^000000,";
	mes "then please select 1 out of";
	mes "the 6 monsters from the list.";
	next;
	if (!checkweight(908,200)) {
		mes "[Ticket Helper]";
		mes "Wait, wait...";
		mes "I can't give you";
		mes "anything right now.";
		mes "You're carrying way";
		mes "too many things...";
		close;
	}
	for (set .@i, 1; .@i <= 6; set .@i, .@i + 1)
		set .@m$, .@m$ + "Monster "+.@i+":";
	set .@m, select ("Monster Status:"+.@m$) - 1;
	if (!.@m) {
		for (set .@i, 1; .@i <= 6; set .@i, .@i + 1)
			mes "Monster "+.@i+" [^CC6600Luck^000000: " + getd("$@mr_1_luk"+.@i) + "] [^EE0000HP^000000: " + getd("$@mr_1_tire"+.@i) + "]";
		close;
	} else {
		if ($@mon_time_1_1 == 1) {
			if (monster_race_1) {
				mes "[Ticket Helper]";
				mes "You have selected";
				mes "Monster ^FF0000"+ monster_race_1 +"^000000 for the";
				mes "Single Monster Race.";
				mes "The start of the race";
				mes "will be announced soon,";
				mes "so please wait. Thank you.";
				close;
			}
			mes "[Ticket Helper]";
			mes "You've chosen Monster "+.@m+"?";
			mes "Alright then, please wait";
			mes "until the start of the race is";
			mes "announced. If the monster you";
			mes "picked wins, then please use this ticket to redeem your prize.";
			getitem 7514,1; //Monster_Ticket
			set monster_race_1,.@m;
			close;
		}
		mes "[Ticket Helper]";
		mes "I'm sorry, but a Monster";
		mes "Race is now in progress.";
		mes "If you'd like to participate, then please wait for the next race.";
		close;
	}

OnInit:
	disablenpc "Ticket Helper#single";
	end;
}

-	script	Runner#main	-1,{
	function	WN;
OnEnable:
	emotion e_gasp;
	enablenpc strnpcinfo(0);
	getmapxy(.@m$,.@x,.@y,1);
	setarray .@mob[1], 1725,1726,1727,1728,1730,1729;
	monster "p_track01",58,.@y,"The "+WN(1)+" Racer",.@mob[WN(0)],1,strnpcinfo(0)+"::OnMyMobDead";
	end;

OnDisable:
	disablenpc strnpcinfo(0);
	killmonster "p_track01",strnpcinfo(0)+"::OnMyMobDead";
	end;

OnTouchNPC:
	initnpctimer;
	set .@n, WN(0);
	set $@monster_race,.@n;
	for (set .@i, 1; .@i <= 6; set .@i, .@i + 1) {
		if (.@n == .@i) continue;
		donpcevent "Runner No. "+.@i+"::OnDisable";
	}
	end;

OnTimer1000:
	mapannounce "p_track01","We have a winner...!",bc_map,"0x33FF66";
	end;

OnTimer2000:
	mapannounce "p_track01","Monster "+WN(0)+" is the winner of this race!",bc_map,"0x33FF66";
	end;

OnTimer6000:
	mapannounce "p_track01","If you wagered on Monster "+WN(0)+" in this race, talk to the Medal Distributor to receive your prize!",bc_map,"0x33FF66";
	end;

OnTimer8000:
	mapannounce "p_track01","Please remember that we can distribute Prize Medals for only 5 minutes after each race.",bc_map,"0x33FF66";
	end;

OnTimer9000:
	donpcevent "Medal Distributor#single::OnEnable";
	donpcevent strnpcinfo(0)+"::OnDisable";
	killmonster "p_track01",strnpcinfo(0)+"::OnMyMobDead";
	stopnpctimer;
	end;
	
	function	WN	{
		set .@n, charat(strnpcinfo(0),getstrlen(strnpcinfo(0))-1);
		if (!getarg(0)) return .@n;
		return ((.@n <= 3)?((.@n == 1)?"1st":((.@n == 2)?"2nd":"3rd")):.@n+"th"); 
	}
	
OnInit:
	if (compare(strnpcinfo(0),"main")) end;
	disablenpc strnpcinfo(0);
	end;
}
p_track01,30,38,0	duplicate(Runner#main)	Runner No. 1	-1,1,0
p_track01,30,36,0	duplicate(Runner#main)	Runner No. 2	-1,1,0
p_track01,30,34,0	duplicate(Runner#main)	Runner No. 3	-1,1,0
p_track01,30,32,0	duplicate(Runner#main)	Runner No. 4	-1,1,0
p_track01,30,30,0	duplicate(Runner#main)	Runner No. 5	-1,1,0
p_track01,30,28,0	duplicate(Runner#main)	Runner No. 6	-1,1,0

p_track01,67,45,5	script	Medal Distributor#single	845,{
	if (!checkweight(908,200)) {
		mes "[Medal Distributor]";
		mes "I'm sorry, but I can't";
		mes "reward you with any medals";
		mes "until you make more space";
		mes "available in your Inventory.";
		close;
	}
	set .@insa,rand(1,1000);
	if (countitem(7514)) {
		mes "[Medal Distributor]";
		mes "Hello there~";
		mes "If you've wagered on the";
		mes "winning monster in a recent";
		mes "race, then you can exchange";
		mes "your game ticket here for";
		mes "some Prize Medals.";
		next;
		mes "[Medal Distributor]";
		mes "Please remember that you can";
		mes "only exchange winning Game";
		mes "Tickets for Prize Medals right";
		mes "after the race finishes. Prize";
		mes "Medals may be given to Wayne";
		mes "in Hugel in exchange for items.";
		next; 
		if ($@monster_race) {
			if (monster_race_1 == $@monster_race) {
				mes "[Medal Distributor]";
				mes "Oh, congratulations, you";
				mes "have a winning ticket for";
				mes "a Single Monster Race! So ";
				mes "would you like to exchange your";
				mes "Racing Ticket for Prize Medals?";
				next;
				if (select("Yes, please.:No, thanks.") == 2) {
					mes "[Medal Distributor]";
					mes "Um, are you sure? You ";
					mes "can only exchange a winning";
					mes "Racing Ticket for Prize Medals";
					mes "for a short time after the race. If you made a mistake, you";
					mes "should ask me again quickly.";
					close;
				}
				mes "[Medal Distributor]";
				mes "Let me see your ticket...";
				mes "Oh! Congratulations, you";
				mes "won! May I have your name?";
				next;
				input .@input$;
				if (.@input$ == strcharinfo(0)) {
					mes "[Medal Distributor]";
					mes "Ah, "+strcharinfo(0)+".";
					mes "You can exchange this";
					mes "ticket for a Prize Medal by";
					mes "entering your ticket exchange";
					mes "number now. Your ticket";
					mes "exchange number is ^FF0000" + .@insa + "^000000.";
					next;
					input .@input; //,0,1000;
					if (!.@input) {
						mes "[Medal Distributor]";
						mes "Oh? You don't want";
						mes "to exchange your";
						mes "winning ticket?";
						close;
					} else if (.@input == .@insa) {
						mes "[Medal Distributor]";
						mes "Thank you! You entered";
						mes "the correct number...";
						mes "Everything seems to";
						mes "be in order. Alright!";
						next;
						mes "[Medal Distributor]";
						mes "Now please accept your";
						mes "Prize Medals! You can";
						mes "exchange these with";
						mes "Wayne in Hugel for some";
						mes "interesting items. Thank you~";
						delitem 7514,1; //Monster_Ticket
						set monster_race_1,0;
						getitem 7515,4; //Marvelous_Medal
						close;
					}
					mes "[Medal Distributor]";
					mes "I'm sorry, but it seems";
					mes "that you entered the";
					mes "incorrect ticket number.";
					mes "Would you mind coming";
					mes "back again in a while?";
					close;
				}
				mes "[Medal Distributor]";
				mes "What's this...?";
				mes "I think there's a problem...";
				mes "Did you enter your name";
				mes "incorrectly? Please check";
				mes "your name, and then try again.";
				close;
			}
			mes "[Medal Distributor]";
			mes "You may not have wagered";
			mes "on the winning monster in";
			mes "the last race, but I hope that";
			mes "you get lucky next time~";
			close;
		}
	}
	mes "[Medal Distributor]";
	mes "Hello there~";
	mes "If you've wagered on the";
	mes "winning monster in a recent";
	mes "race, then you can exchange";
	mes "your game ticket here for";
	mes "some Prize Medals.";
	next;
	mes "[Medal Distributor]";
	mes "Please remember that you can";
	mes "only exchange winning Game";
	mes "Tickets for Prize Medals right";
	mes "after the race finishes. Prize";
	mes "Medals may be given to Wayne";
	mes "in Hugel in exchange for items.";
	close;

OnEnable:
	emotion e_gasp;
	enablenpc "Medal Distributor#single";
	initnpctimer;
	end;

OnTimer1000:
	mapannounce "p_track01","The Monster Race is finished! Congratulations to all the winners!",bc_map,"0xFFFF00";
	end;

OnTimer4000:
	mapannounce "p_track01","Please give your Racing Ticket to the Medal Distributor if you bet on the winning monster.",bc_map,"0xFFFF00";
	end;

OnTimer7000:
	mapannounce "p_track01","You have 5 minutes to exchange a winning ticket for Prize Medals from the Medal Distributor.",bc_map,"0xFFFF00";
	end;

OnTimer10000:
	mapannounce "p_track01","All tickets become void after this 5 minute period, so winners should claim their prize now.",bc_map,"0xFFFF00";
	end;

OnTimer13000:
	mapannounce "p_track01","Please leave the Race Arena before this 5 minute period elapses. Thank you.",bc_map,"0xFFFF00";
	end;

OnTimer240000:
	mapannounce "p_track01","Attention. We will being preparing for the next race shortly...",bc_map,"0xFFFF00";
	end;

OnTimer243000:
	mapannounce "p_track01","We will close the Racing Arena in 1 minute to prepare for the next race.",bc_map,"0xFFFF00";
	end;

OnTimer246000:
	mapannounce "p_track01","Participants in the last race should leave the arena as soon as possible.",bc_map,"0xFFFF00";
	end;

OnTimer249000:
	mapannounce "p_track01","Thank you for your cooperation.",bc_map,"0xFFFF00";
	end;

OnTimer252000:
	mapannounce "p_track01","We hope that you enjoyed the Monster Race arena. Come back again soon~",bc_map,"0xFFFF00";
	for (set .@i, 1; .@i <= 6; set .@i, .@i + 1) {
		donpcevent "starting#"+.@i+"::OnDisable";
		setd "$@mr_1_luk"+.@i,0;
		setd "$@mr_1_tire"+.@i,0;
	}
	set .@c, 1;
	while (.@c <= 6) {
		for (set .@i, 1; .@i <= 6; set .@i, .@i + 1) {
			disablenpc "Tire"+.@c+"#"+.@i;
			disablenpc "Luk"+.@c+"#"+.@i;
		}
		set .@c, .@c + 1;
	}
	end;

OnTimer300000:
	donpcevent "#race_timer1-1::OnEnable";
	set $@mon_time_1_1,2;
	set $@monster_race,0;
	mapwarp "p_track01","hugel",63,73;
	end;

OnTimer306000:
	donpcevent "Race Progress Timer::OnEnable";
	end;

OnTimer342000:
	disablenpc "Medal Distributor#single";
	stopnpctimer;
	end;

OnInit:
	disablenpc "Medal Distributor#single";
	end;
}

p_track01,76,36,1	script	Exit Guide#single	798,{
	mes "[Exit Guide]";
	mes "If you have a winning Racing";
	mes "Ticket, please make sure that";
	mes "you redeem it for Prize Medals";
	mes "now. All Racing Tickets become";
	mes "void once the next race begins.";
	next;
	mes "[Exit Guide]";
	mes "If you wish to leave";
	mes "the arena, then I can guide";
	mes "you outside. Would you like";
	mes "to leave the arena right now?";
	next;
	if (select("Yes:No") == 2) {
		mes "[Exit Guide]";
		mes "Alright, then.";
		mes "Just let me know";
		mes "whenever you're";
		mes "ready to leave.";
		close;
	}
	if (!countitem(7514)) {
		mes "[Exit Guide]";
		mes "Thank you for";
		mes "your patronage, and";
		mes "I hope that you come";
		mes "visit us again soon~";
	} else {
		mes "[Exit Guide]";
		mes "In accordance with our";
		mes "policies, I must take your";
		mes "Racing Ticket before you leave.";
		mes "Thank you for your patronage,";
		mes "and I hope you enjoy your time";
		mes "here in the Monster Race Arena.";
		delitem 7514,1; //Monster_Ticket
	}
	set monster_race_1,0;
	close2;
	warp "hugel",63,73;
	end;
}

hugel,58,72,6	script	Eckar Ellebird#single	798,{
	mes "[Eckar Ellebird]";
	mes "Welcome to the biggest";
	mes "attraction in Hugel, the";
	mes "Monster Race Arena.";
	mes "How may I help you today?";
	next;
	if (select("Monster Race Info:Enter Monster Race") == 1) {
		mes "[Eckar Ellebird]";
		mes "Monster Races originated from";
		mes "simple children's games in which";
		mes "Cute Pets would race against each other. This grew into an adult";
		mes "pastime that is so popular, we've built a racing arena in Hugel.";
		next;
		mes "[Eckar Ellebird]";
		mes "Our Monster Race Arena hosts";
		mes "two types of monster races. First, we have the Single Monster Race,";
		mes "in which those that wagered on the 1st place monster are rewarded.";
		next;
		mes "[Eckar Ellebird]";
		mes "Then, we have the Dual Monster";
		mes "Race in which the house odds and rewards are greater than in Single";
		mes "Monster Races: you must wager on 2 monsters, and they must place in";
		mes "1st and 2nd for you to win.";
		next;
		mes "[Eckar Ellebird]";
		mes "Although a small entrance";
		mes "fee is required, we only use";
		mes "the money to give rewards to";
		mes "participants and maintain this";
		mes "arena. Therefore, we're not";
		mes "profiting from this enterprise.";
		next;
		mes "[Eckar Ellebird]";
		mes "Also, we prohibit others";
		mes "from making personal bets";
		mes "and wagers, using items and";
		mes "zeny, based on the outcomes";
		mes "of these races. That kind of";
		mes "gambling is illegal here...";
		next;
		mes "[Eckar Ellebird]";
		mes "Once you enter the Race Arena, you will receive a Racing Ticket.";
		mes "Keep in mind that winning Racing Tickets can only be exchanged for";
		mes "Prize Medals during a 5 minute window after the end of the race.";
		next;
	}
	mes "[Eckar Ellebird]";
	mes "The entrance fee for all races";
	mes "in the Monster Race Arena is";
	mes "2,000 zeny. If you'd like to wager on a Dual Monster Race, then";
	mes "please ask my brother Erenes,";
	mes "and he will help you.";
	next;
	mes "[Eckar Ellebird]";
	mes "Otherwise, I'll help get you";
	mes "started if you're interested";
	mes "in a Single Monster Race.";
	mes "Would you like wager on";
	mes "a Single Monster Race?";
	next;
	if (select("Yes, please.:No, thanks.") == 2) {
		mes "[Eckar Ellebird]";
		mes "Very well. I hope that";
		mes "you enjoy your time here";
		mes "in the Monster Race Arena~";
		close;
	}
	if (!checkweight(908,700)) {
		mes "[Eckar Ellebird]";
		mes "Oh, wow. You're carrying";
		mes "an awful lot of stuff... Yeah,";
		mes "you better put some of it away";
		mes "in Kafra Storage or something.";
		close;
	}
	if (Zeny < 2000) {
		mes "[Eckar Ellebird]";
		mes "I'm sorry, but you";
		mes "don't have enough";
		mes "money to pay the";
		mes "2,000 zeny entrance fee. ";
		close;
	}
	if (countitem(7514)) {
		mes "[Eckar Ellebird]";
		mes "Hm? What are you doing";
		mes "with an expired Racing Ticket?";
		mes "Well, I better get rid of it for you before it can get mixed up";
		mes "with your new Racing Ticket.";
		delitem 7514,1; //Monster_Ticket
		next;
		if ($@mon_time_1_1 == 1) {
			mes "[Eckar Ellebird]";
			mes "Alright, I think you";
			mes "should be all set. I hope";
			mes "that you enjoy the race~";
			mes "Let me guide you inside";
			mes "the Monster Race Arena now.";
			set zeny,zeny-2000;
			set monster_race_1,0;
			close2;
			warp "p_track01",75,41;
			end;
		} else if ($@mon_time_1_1 == 2) {
			mes "[Eckar Ellebird]";
			mes "We're still finishing our";
			mes "preparations for the next";
			mes "Single Monster Race, so";
			mes "we ask that you please";
			mes "wait a little while longer.";
			close;
		} 
	} else {
		if ($@mon_time_1_1 == 1) {
			mes "[Eckar Ellebird]";
			mes "Thanks, I hope that";
			mes "you enjoy this race.";
			mes "Let me guide you now";
			mes "to the Monster Race Arena.";
			set zeny,zeny-2000;
			set monster_race_1,0;
			close2;
			warp "p_track01",75,41;
			end;
		} else if ($@mon_time_1_1 == 2) {
			mes "[Eckar Ellebird]";
			mes "We're still finishing our";
			mes "preparations for the next";
			mes "Single Monster Race, so";
			mes "we ask that you please";
			mes "wait a little while longer...";
			close;
		}
	}
	if (!.@monster_race) {
		mes "[Eckar Ellebird]";
		mes "Right now, a Monster Race";
		mes "is in progress. It's too late to place a wager, but if you'd like";
		mes "to watch, the fee is 500 zeny";
		mes "for spectators. Would you like to enter the Monster Race Arena?";
		next;
		if (select("Enter:Cancel") == 2) {
			mes "[Eckar Ellebird]";
			mes "Alright, then. If you'd like";
			mes "to wager on a monster";
			mes "race, please wait for the";
			mes "current race to finish. I hope";
			mes "that you enjoy your time here";
			mes "in the Monster Race Arena~";
			close;
		}
		if (Zeny > 499) {
			mes "[Eckar Ellebird]";
			mes "Thank you~";
			mes "I hope you enjoy";
			mes "watching this race!";
			set zeny,zeny-500;
			set monster_race_1,0;
			close2;
			warp "p_track01",75,41;
			end;
		}
		mes "[Eckar Ellebird]";
		mes "I'm sorry, but you don't";
		mes "have enough money to pay";
		mes "the 500 zeny spectator fee.";
		close;
	}
	mes "[Eckar Ellebird]";
	mes "I'm sorry, but a monster";
	mes "race has just ended, so we're";
	mes "having the 5 minute period in";
	mes "which the winners can claim";
	mes "their Prize Medals. The gate";
	mes "will open soon, so please wait.";
	close;				
}

p_track01,39,49,3	script	Game Guide#single	845,{
	mes "[Game Guide]";
	mes "Welcome to the";
	mes "Monster Race Arena.";
	mes "How can I help you?";
	next;
	switch(select("Monster Race Info:Wager Info:Ticket Redemption Info")) {
	case 1:
		mes "[Game Guide]";
		mes "Monster Races originated from";
		mes "simple children's games in which";
		mes "Cute Pets would race against each other. This grew into an adult";
		mes "pastime that is so popular, we've built a racing arena in Hugel.";
		next;
		mes "[Game Guide]";
		mes "Our Monster Race Arena hosts";
		mes "two types of monster races. First, we have the Single Monster Race,";
		mes "in which those that wagered on the 1st place monster are rewarded.";
		next;
		mes "[Game Guide]";
		mes "Then, we have the Dual Monster";
		mes "Race in which the house odds and rewards are greater than in Single";
		mes "Monster Races: you must wager on 2 monsters, and they must place in";
		mes "1st and 2nd for you to win.";
		next;
		mes "[Game Guide]";
		mes "Although a small entrance";
		mes "fee is required, we only use";
		mes "the money to give rewards to";
		mes "participants and maintain this";
		mes "arena. Therefore, we're not";
		mes "profiting from this enterprise.";
		next;
		mes "[Game Guide]";
		mes "Also, we prohibit others";
		mes "from making personal bets";
		mes "and wagers, using items and";
		mes "zeny, based on the outcomes";
		mes "of these races. That kind of";
		mes "gambling is illegal here...";
		next;
		mes "[Game Guide]";
		mes "Once you enter the Race Arena, you will receive a Racing Ticket.";
		mes "Keep in mind that winning Racing Tickets can only be exchanged for";
		mes "Prize Medals during a 5 minute window after the end of the race.";
		next;
		break;
	case 2:
		mes "[Game Guide]";
		mes "Before placing a wager, you";
		mes "must get a free Racing Ticket";
		mes "from the Ticket Helper. There,";
		mes "I've marked the Ticket Helper";
		mes "on your Mini-Map, so you can";
		mes "find him pretty easily.";
		viewpoint 1,73,22,1,0xFF3355;
		next;
		break;
	case 3:
		mes "[Game Guide]";
		mes "If you wagered on the winner";
		mes "of a Single Monster Race, or";
		mes "on the 1st or 2nd place winners";
		mes "in a Dual Monster Race, then";
		mes "you can exchange your Racing";
		mes "Ticket for Prize Medals.";
		next;
		mes "[Game Guide]";
		mes "However, you must exchange";
		mes "your Racing Ticket with the";
		mes "Medal Distributor within the";
		mes "5 minute window after the end";
		mes "of the race. ^FF0000Your ticket becomes^FFFFFF ^FF0000 void after these 5 minutes.^000000";
		next;
		mes "[Game Guide]";
		mes "When this 5 minute window";
		mes "elapses, you will be teleported outside, and we will immediately";
		mes "begin preparing for the next race. Make sure that you remember this";
		mes "information when you wager.";
		next;
		mes "[Game Guide]";
		mes "If you haven't received";
		mes "your free Racing Ticket,";
		mes "then please visit the Ticket";
		mes "Helper. There, I've just marked";
		mes "his location on your Mini-Map.";
		viewpoint 1,67,45,2,0xCE6300;
		next;
		break;
	}
	mes "[Game Guide]";
	mes "Thank you, and";
	mes "I hope you enjoy";
	mes "your time here in the";
	mes "Monster Racing Arena.";
	close;
}

-	script	starting_1	-1,{
OnDisable:
	for(set .@i,1; .@i<7; set .@i,.@i+1)
		enablenpc "Luk1#"+.@i;
	for(set .@i,1; .@i<7; set .@i,.@i+1)
		enablenpc "Tire1#"+.@i;
	setd "$@mr_1_luk"+strnpcinfo(2),0;
	setd "$@mr_1_tire"+strnpcinfo(2),0;
	end;

OnTouchNPC:
	set .@start,rand(1,100);
	if (.@start < 11) set .@speed,60;
	else if (.@start < 21) set .@speed,70;
	else if (.@start < 31) set .@speed,80;
	else if (.@start < 41) set .@speed,90;
	else if (.@start < 51) set .@speed,100;
	else if (.@start < 61) set .@speed,110;
	else if (.@start < 71) set .@speed,120;
	else if (.@start < 81) set .@speed,130;
	else if (.@start < 91) set .@speed,140;
	else set .@speed,150;
	sc_start SC_WALKSPEED,5000,.@speed;
	end;
	
OnInit:
	disablenpc strnpcinfo(0);
	end;

}

-	script	Luk_1	-1,{
OnTouchNPC:
	set .@start,rand(1,100);
	if (.@start < 61) set .@speed,110;
	else if (.@start < 71) set .@speed,120;
	else if (.@start < 81) set .@speed,130;
	else if (.@start < 91) set .@speed,140;
	else set .@speed,150;
	sc_start SC_WALKSPEED,10000,.@speed;
	end;
	
OnInit:
	disablenpc strnpcinfo(0);
	end;
}

-	script	Luk_2	-1,{
OnTouchNPC:
	set .@start,rand(1,100);
	if (.@start < 61) set .@time,1000;
	else if (.@start < 71) set .@time,2000;
	else if (.@start < 81) set .@time,3000;
	else if (.@start < 91) set .@time,4000;
	if (.@time) sc_start SC_STUN,.@time,0;
	end;
	
OnInit:
	disablenpc strnpcinfo(0);
	end;
}

-	script	Tire_1	-1,{
OnTouchNPC:
	set .@start,rand(1,100);
	if (.@start < 61) set .@time,1000;
	else if (.@start < 71) set .@time,2000;
	else if (.@start < 81) set .@time,3000;
	else if (.@start < 91) set .@time,4000;
	if (.@time) sc_start SC_SLEEP,.@time,0;
	end;
	
OnInit:
	disablenpc strnpcinfo(0);
	end;
}

p_track01,56,38,0	duplicate(starting_1)	starting#1	-1,0,0
p_track01,56,36,0	duplicate(starting_1)	starting#2	-1,0,0
p_track01,56,34,0	duplicate(starting_1)	starting#3	-1,0,0
p_track01,56,32,0	duplicate(starting_1)	starting#4	-1,0,0
p_track01,56,30,0	duplicate(starting_1)	starting#5	-1,0,0
p_track01,56,28,0	duplicate(starting_1)	starting#6	-1,0,0

p_track01,33,38,0	duplicate(Luk_1)	Luk1#1	-1,0,0
p_track01,37,38,0	duplicate(Luk_1)	Luk1#2	-1,0,0
p_track01,53,38,0	duplicate(Luk_1)	Luk1#3	-1,0,0
p_track01,45,38,0	duplicate(Luk_1)	Luk1#4	-1,0,0
p_track01,33,36,0	duplicate(Luk_1)	Luk2#1	-1,0,0
p_track01,37,36,0	duplicate(Luk_1)	Luk2#2	-1,0,0
p_track01,53,36,0	duplicate(Luk_1)	Luk2#3	-1,0,0
p_track01,45,36,0	duplicate(Luk_1)	Luk2#4	-1,0,0
p_track01,33,34,0	duplicate(Luk_1)	Luk3#1	-1,0,0
p_track01,37,34,0	duplicate(Luk_1)	Luk3#2	-1,0,0
p_track01,53,34,0	duplicate(Luk_1)	Luk3#3	-1,0,0
p_track01,45,34,0	duplicate(Luk_1)	Luk3#4	-1,0,0
p_track01,33,32,0	duplicate(Luk_1)	Luk4#1	-1,0,0
p_track01,37,32,0	duplicate(Luk_1)	Luk4#2	-1,0,0
p_track01,53,32,0	duplicate(Luk_1)	Luk4#3	-1,0,0
p_track01,45,32,0	duplicate(Luk_1)	Luk4#4	-1,0,0
p_track01,33,30,0	duplicate(Luk_1)	Luk5#1	-1,0,0
p_track01,37,30,0	duplicate(Luk_1)	Luk5#2	-1,0,0
p_track01,53,30,0	duplicate(Luk_1)	Luk5#3	-1,0,0
p_track01,45,30,0	duplicate(Luk_1)	Luk5#4	-1,0,0
p_track01,33,28,0	duplicate(Luk_1)	Luk6#1	-1,0,0
p_track01,37,28,0	duplicate(Luk_1)	Luk6#2	-1,0,0
p_track01,53,28,0	duplicate(Luk_1)	Luk6#3	-1,0,0
p_track01,45,28,0	duplicate(Luk_1)	Luk6#4	-1,0,0

p_track01,49,38,0	duplicate(Luk_2)	Luk1#5	-1,0,0
p_track01,41,38,0	duplicate(Luk_2)	Luk1#6	-1,0,0
p_track01,49,36,0	duplicate(Luk_2)	Luk2#5	-1,0,0
p_track01,41,36,0	duplicate(Luk_2)	Luk2#6	-1,0,0
p_track01,49,34,0	duplicate(Luk_2)	Luk3#5	-1,0,0
p_track01,41,34,0	duplicate(Luk_2)	Luk3#6	-1,0,0
p_track01,49,32,0	duplicate(Luk_2)	Luk4#5	-1,0,0
p_track01,41,32,0	duplicate(Luk_2)	Luk4#6	-1,0,0
p_track01,49,30,0	duplicate(Luk_2)	Luk5#5	-1,0,0
p_track01,41,30,0	duplicate(Luk_2)	Luk5#6	-1,0,0
p_track01,49,28,0	duplicate(Luk_2)	Luk6#5	-1,0,0
p_track01,41,28,0	duplicate(Luk_2)	Luk6#6	-1,0,0

p_track01,43,38,0	duplicate(Tire_1)	Tire1#1	-1,0,0
p_track01,39,38,0	duplicate(Tire_1)	Tire1#2	-1,0,0
p_track01,35,38,0	duplicate(Tire_1)	Tire1#3	-1,0,0
p_track01,55,38,0	duplicate(Tire_1)	Tire1#4	-1,0,0
p_track01,51,38,0	duplicate(Tire_1)	Tire1#5	-1,0,0
p_track01,47,38,0	duplicate(Tire_1)	Tire1#6	-1,0,0
p_track01,43,36,0	duplicate(Tire_1)	Tire2#1	-1,0,0
p_track01,39,36,0	duplicate(Tire_1)	Tire2#2	-1,0,0
p_track01,35,36,0	duplicate(Tire_1)	Tire2#3	-1,0,0
p_track01,55,36,0	duplicate(Tire_1)	Tire2#4	-1,0,0
p_track01,51,36,0	duplicate(Tire_1)	Tire2#5	-1,0,0
p_track01,47,36,0	duplicate(Tire_1)	Tire2#6	-1,0,0
p_track01,43,34,0	duplicate(Tire_1)	Tire3#1	-1,0,0
p_track01,39,34,0	duplicate(Tire_1)	Tire3#2	-1,0,0
p_track01,35,34,0	duplicate(Tire_1)	Tire3#3	-1,0,0
p_track01,55,34,0	duplicate(Tire_1)	Tire3#4	-1,0,0
p_track01,51,34,0	duplicate(Tire_1)	Tire3#5	-1,0,0
p_track01,47,34,0	duplicate(Tire_1)	Tire3#6	-1,0,0
p_track01,43,32,0	duplicate(Tire_1)	Tire4#1	-1,0,0
p_track01,39,32,0	duplicate(Tire_1)	Tire4#2	-1,0,0
p_track01,35,32,0	duplicate(Tire_1)	Tire4#3	-1,0,0
p_track01,55,32,0	duplicate(Tire_1)	Tire4#4	-1,0,0
p_track01,51,32,0	duplicate(Tire_1)	Tire4#5	-1,0,0
p_track01,47,32,0	duplicate(Tire_1)	Tire4#6	-1,0,0
p_track01,43,30,0	duplicate(Tire_1)	Tire5#1	-1,0,0
p_track01,39,30,0	duplicate(Tire_1)	Tire5#2	-1,0,0
p_track01,35,30,0	duplicate(Tire_1)	Tire5#3	-1,0,0
p_track01,55,30,0	duplicate(Tire_1)	Tire5#4	-1,0,0
p_track01,51,30,0	duplicate(Tire_1)	Tire5#5	-1,0,0
p_track01,47,30,0	duplicate(Tire_1)	Tire5#6	-1,0,0
p_track01,43,28,0	duplicate(Tire_1)	Tire6#1	-1,0,0
p_track01,39,28,0	duplicate(Tire_1)	Tire6#2	-1,0,0
p_track01,35,28,0	duplicate(Tire_1)	Tire6#3	-1,0,0
p_track01,55,28,0	duplicate(Tire_1)	Tire6#4	-1,0,0
p_track01,51,28,0	duplicate(Tire_1)	Tire6#5	-1,0,0
p_track01,47,28,0	duplicate(Tire_1)	Tire6#6	-1,0,0

// Monstrer Race - Dual Monster Race
//============================================================
hugel,47,56,0	script	#race_timer2-1	-1,{
OnEnable:
	enablenpc "#race_timer2-1";
	set $@mon_time_2_1,2;
	initnpctimer;
	end;

OnDisable:
	disablenpc "#race_timer2-1";
	stopnpctimer;
	end;

OnTimer10000:
	mapannounce "hugel","The Dual Monster Race will soon begin. We hope to see many of you participate!",bc_map,"0xffb6c1";
	end;

OnTimer30000:
	mapannounce "hugel","The Dual Monster Race Arena has just opened.",bc_map,"0xffb6c1";
	set $@mon_time_2_1,1;
	donpcevent "#race_timer2-2::OnEnable";
	enablenpc "Ticket Helper#2";
	donpcevent "TrapGlobal#race02::OnEnable";
	end;

OnTimer90000:
	mapannounce "hugel","The Dual Monster Race arena is now open. Participants should enter the Arena as soon as they can.",bc_map,"0xffb6c1";
	end;

OnTimer210000:
	mapannounce "hugel","The entrance to the Dual Monster Race Arena will close shortly. Participants, please enter the arena now.",bc_map,"0xffb6c1";
	end;

OnTimer270000:
	mapannounce "hugel","The Dual Monster Race Arena's entrance will soon close.",bc_map,"0xffb6c1";
	end;

OnTimer272000:
	mapannounce "hugel","Participants, please enter the Arena before the doors close.",bc_map,"0xffb6c1";
	end;

OnTimer330000:
	mapannounce "hugel","The race is now starting. If you missed your chance to enter this race, please try again next time~!",bc_map,"0xffb6c1";
	set $@mon_time_2_1,0;
	donpcevent "#race_timer2-1::OnDisable";
	stopnpctimer;
	end;
	
OnInit:
	enablenpc "#race_timer2-1";
	set $@mon_time_2_1,2;
	initnpctimer;
	end;
}

p_track02,42,23,0	script	#race_timer2-2	-1,{
OnEnable:
	enablenpc "#race_timer2-2";
	set $@mon_time_2_2,0;
	initnpctimer;
	end;

OnDisable:
	disablenpc "#race_timer2-2";
	stopnpctimer;
	end;

OnTimer5000:
	mapannounce "p_track02","Welcome to the Monster Race Arena.",bc_map,"0x87ceeb";
	end;

OnTimer7000:
	mapannounce "p_track02","Feel free to inquire at the help desk whenever you have questions.",bc_map,"0x87ceeb";
	end;

OnTimer120000:
	mapannounce "p_track02","The Dual Monster Race will start in 3 minutes.",bc_map,"0x87ceeb";
	end;

OnTimer122000:
	mapannounce "p_track02","Please ask a Ticket Helper if you wish to wager on the race.",bc_map,"0x87ceeb";
	end;

OnTimer240000:
	mapannounce "p_track02","The Dual Monster Race will start shortly.",bc_map,"0x87ceeb";
	end;

OnTimer242000:
	mapannounce "p_track02","Please ask a Ticket Helper if you wish to wager on the race.",bc_map,"0x87ceeb";
	end;

OnTimer300000:
	mapannounce "p_track02","The Monster Race is starting now. Good luck, everybody!",bc_map,"0x87ceeb";
	set $@mon_time_2_2,1;
	set $@mon_race_2_1,0;
	set $@mon_race_2_2,0;
	disablenpc "Ticket Helper#2";
	donpcevent "#poring1::OnEnable";
	donpcevent "#lunatic1::OnEnable";
	donpcevent "#savagebebe1::OnEnable";
	donpcevent "#desertwolf1::OnEnable";
	donpcevent "#deviruchi1::OnEnable";
	donpcevent "#baphomet1::OnEnable";
	stopnpctimer;
	end;
	
OnInit:
	disablenpc "#race_timer2-2";
	set $@mon_time_2_2,0;
	end;
}

p_track02,80,43,0	script	#race_timer2-3	-1,{
OnInit:
	disablenpc "#race_timer2-3";
	end;

OnEnable:
	enablenpc "#race_timer2-3";
	initnpctimer;
	end;

OnDisable:
	disablenpc "#race_timer2-3";
	stopnpctimer;
	end;

OnTimer3000:
	mapannounce "p_track02","The Monster Race is finished! Congratulations to all the winners!",bc_map,"0xFFFF00";
	end;

OnTimer6000:
	mapannounce "p_track02","Please give your Racing Ticket to the Medal Distributor if you bet on the winning monster.",bc_map,"0xFFFF00";
	end;

OnTimer9000:
	mapannounce "p_track02","You have 5 minutes to exchange a winning ticket for Prize Medals from the Medal Distributor.",bc_map,"0xFFFF00";
	end;

OnTimer12000:
	mapannounce "p_track02","All tickets become void after this 5 minute period, so winners should claim their prize now.",bc_map,"0xFFFF00";
	end;

OnTimer15000:
	mapannounce "p_track02","Please leave the Race Arena before this 5 minute period elapses. Thank you.",bc_map,"0xFFFF00";
	end;

OnTimer240000:
	mapannounce "p_track02","Attention. We will being preparing for the next race shortly...",bc_map,"0xFFFF00";
	end;

OnTimer243000:
	mapannounce "p_track02","We will close the Racing Arena in 1 minute to prepare for the next race.",bc_map,"0xFFFF00";
	end;

OnTimer246000:
	mapannounce "p_track02","Participants in the last race should leave the arena as soon as possible.",bc_map,"0xFFFF00";
	end;

OnTimer249000:
	mapannounce "p_track02","Thank you for your cooperation.",bc_map,"0xFFFF00";
	end;

OnTimer252000:
	mapannounce "p_track02","We hope that you enjoyed the Monster Race arena. Come back again soon~",bc_map,"0xFFFF00";
	end;

OnTimer300000:
	mapwarp "p_track02","hugel",63,73;
	disablenpc "Medal Distributor#medal";
	donpcevent "#race_timer2-1::OnEnable";
	set $@mon_race_2_1,0;
	set $@mon_race_2_2,0;
	donpcevent "#race_timer2-3::OnDisable";
	stopnpctimer;
	end;
}

hugel,62,69,1	script	Eckar Erenes#double	798,{
	mes "[Eckar Erenes]";
	mes "Welcome to the";
	mes "Monster Race Arena,";
	mes "the pride and joy of";
	mes "the village of Hugel!";
	mes "How may I help you?";
	next;
	if (select("Monster Race Info:Enter Monster Race") == 1) {
		mes "[Eckar Erenes]";
		mes "Monster Races originated from";
		mes "simple children's games in which";
		mes "Cute Pets would race against each other. This grew into an adult";
		mes "pastime that is so popular, we've built a racing arena in Hugel.";
		next;
		mes "[Eckar Erenes]";
		mes "Our Monster Race Arena hosts";
		mes "two types of monster races. First, we have the Single Monster Race,";
		mes "in which those that wagered on the 1st place monster are rewarded.";
		next;
		mes "[Eckar Erenes]";
		mes "Then, we have the Dual Monster";
		mes "Race in which the house odds and rewards are greater than in Single";
		mes "Monster Races: you must wager on 2 monsters, and they must place in";
		mes "1st and 2nd for you to win.";
		next;
		mes "[Eckar Erenes]";
		mes "Although a small entrance";
		mes "fee is required, we only use";
		mes "the money to give rewards to";
		mes "participants and maintain this";
		mes "arena. Therefore, we're not";
		mes "profiting from this enterprise.";
		next;
		mes "[Eckar Erenes]";
		mes "Also, we prohibit others";
		mes "from making personal bets";
		mes "and wagers, using items and";
		mes "zeny, based on the outcomes";
		mes "of these races. That kind of";
		mes "gambling is illegal here...";
		next;
		mes "[Eckar Erenes]";
		mes "Once you enter the Race Arena, you will receive a Racing Ticket.";
		mes "Keep in mind that winning Racing Tickets can only be exchanged for";
		mes "Prize Medals during a 5 minute window after the end of the race.";
		next;
	}
	mes "[Eckar Erenes]";
	mes "The entrance fee for all races";
	mes "in the Monster Race Arena is";
	mes "2,000 zeny. If you'd like to wager on a Single Monster Race,";
	mes "then please ask my brother";
	mes "Ellebird to help you.";
	next;
	mes "[Eckar Erenes]";
	mes "Otherwise, I'll help get you";
	mes "started if you're interested";
	mes "in a Dual Monster Race.";
	mes "Would you like to wager";
	mes "on a Dual Monster Race?";
	next;
	if (select("Yes, please.:No, thanks.") == 2) {
		mes "[Eckar Erenes]";
		mes "Very well. I hope that";
		mes "you enjoy your time here";
		mes "in the Monster Race Arena~";
		close;
	}
	if (!checkweight(909,700)) {
		mes "[Eckar Erenes]";
		mes "Hmm... You're toting";
		mes "too many things with you";
		mes "right now. You better put";
		mes "some of your stuff away in";
		mes "Kafra Storage before you can";
		mes "wager on any monster races...";
		close;
	}
	if (Zeny < 2000) {
		mes "[Eckar Erenes]";
		mes "I'm sorry, but you";
		mes "don't have enough";
		mes "money to pay the";
		mes "2,000 zeny entrance fee. ";
		close;
	}
	if (countitem(7514)) {
		mes "[Eckar Erenes]";
		mes "Hm? What are you doing";
		mes "with an expired Racing Ticket?";
		mes "Well, I better get rid of it for you before it can get mixed up";
		mes "with your new Racing Ticket.";
		delitem 7514,1; //Monster_Ticket
		next;
		if ($@mon_time_2_1 == 1) {
			mes "[Eckar Erenes]";
			mes "Alright, I think you";
			mes "should be all set. I hope";
			mes "that you enjoy the race~";
			mes "Let me guide you inside";
			mes "the Monster Race Arena now.";
			set zeny,zeny-2000;
			set monster_race_2_1,0;
			set monster_race_2_2,0;
			close2;
			warp "p_track02",75,41;
			end;
		}
		else if ($@mon_time_2_1 == 2) {
			mes "[Eckar Erenes]";
			mes "We're still finishing our";
			mes "preparations for the next";
			mes "Double Monster Race, so";
			mes "we ask that you please";
			mes "wait a little while longer...";
			close;
		}
	} else {
		if ($@mon_time_2_1 == 1) {
			mes "[Eckar Erenes]";
			mes "Thanks, I hope that";
			mes "you enjoy this race.";
			mes "Let me guide you now";
			mes "to the Monster Race Arena.";
			set zeny,zeny-2000;
			set monster_race_2_1,0;
			set monster_race_2_2,0;
			close2;
			warp "p_track02",75,41;
			end;
		} else if ($@mon_time_2_1 == 2) {
			mes "[Eckar Erenes]";
			mes "We're still finishing our";
			mes "preparations for the next";
			mes "Double Monster Race, so";
			mes "we ask that you please";
			mes "wait a little while longer...";
			close;
		}
	}
	if (!$@mon_time_2_1 || !$@mon_time_2_2) {
		mes "[Eckar Erenes]";
		mes "Right now, a Monster Race";
		mes "is in progress. It's too late to place a wager, but if you'd like";
		mes "to watch, the fee is 500 zeny";
		mes "for spectators. Would you like to enter the Monster Race Arena?";
		next;
		if (select("Enter:Cancel") == 2) {
			mes "[Eckar Erenes]";
			mes "Alright, then. If you'd like";
			mes "to wager on a monster";
			mes "race, please wait for the";
			mes "current race to finish. I hope";
			mes "that you enjoy your time here";
			mes "in the Monster Race Arena~";
			close;
		}
		if (Zeny > 499) {
			mes "[Eckar Erenes]";
			mes "Thank you~";
			mes "I hope you enjoy";
			mes "watching this race!";
			set zeny,zeny-500;
			set monster_race_2_1,0;
			set monster_race_2_2,0;
			close2;
			warp "p_track02",75,41;
			end;
		}
		mes "[Eckar Erenes]";
		mes "I'm sorry, but you don't";
		mes "have enough money to pay";
		mes "the 500 zeny spectator fee.";
		close;		
	}
	mes "[Eckar Erenes]";
	mes "I'm sorry, but a monster";
	mes "race has just ended, so we're";
	mes "having the 5 minute period in";
	mes "which the winners can claim";
	mes "their Prize Medals. The gate";
	mes "will open soon, so please wait.";
	close;
}

p_track02,73,22,1	script	Ticket Helper#2	899,{
	if (!checkweight(908,200)) {
		mes "[Ticket Helper]";
		mes "Welcome to the";
		mes "Monster Race Arena.";
		mes "If you'd like to participate";
		mes "in the ^3131FFDouble Monster Race^000000,";
		mes "then please select 1 out of";
		mes "the 6 monsters from the list.";
		next;
		mes "[Ticket Helper]";
		mes "Wait, wait...";
		mes "I can't give you";
		mes "anything right now.";
		mes "You're carrying way";
		mes "too many things...";
		close;
	}
	if (!monster_race_2_1 && !monster_race_2_2) {
		mes "[Ticket Helper]";
		mes "Hello there!";
		mes "Interested in wagering on";
		mes "the Dual Monster Race?";
		mes "I'm here to help you if you've";
		mes "got any questions, or if you";
		mes "want to place your wager.";
		next;
		switch(select("Check Monster Status:Wager on Race:Monster Race?:Cancel")) {
		case 1:
			for (set .@i, 1; .@i <= 6; set .@i, .@i + 1)
				mes "Monster "+.@i+" [^CC6600Luck^000000: " + getd("$@mon_r02_Luk"+.@i) + "] [^EE0000HP^000000: " + getd("$@mon_r02_tire"+.@i) + "]";
			close;
		case 2:
			mes "[Ticket Helper]";
			mes "Alright, please choose which";
			mes "two monsters that you think";
			mes "will win 1st and 2nd place.";
			mes "If both your monsters come";
			mes "in 1st and 2nd, in any order,";
			mes "you'll win the wager.";
			next;
			mes "[Ticket Helper]";
			mes "Now, please tell me";
			mes "your first choice for one";
			mes "of the monsters that";
			mes "will win this race.";
			next;
			while (1) {
				set .@m$, "";
				for (set .@i, 1; .@i <= 6; set .@i, .@i + 1)
					set .@m$, .@m$ + ((.@i != .@m1)?"Monster "+.@i:"")+":";
				set .@m, 0;
				set .@m, select (.@m$);
				switch (.@m) {
					Case 1: setarray .@w$, "a friendly","Poring type monster"; break;
					Case 2: setarray .@w$, "an adorable","Lunatic type monster"; break;
					Case 3: setarray .@w$, "a darling","Savage Babe monster"; break;
					Case 4: setarray .@w$, "a gentle baby","Desert Wolf monster"; break;
					Case 5: setarray .@w$, "a small, yet","demonic, Deviruchi"; break;
					Case 6: setarray .@w$, "a naughty","Baphomet Jr. monster"; break;
				}
				mes "[Ticket Helper]";
				mes "You've chosen";
				mes "^0000FFMonster "+.@m+"^000000, "+.@w$[0];
				mes .@w$[1]+".";
				mes "Are you sure you want";
				mes "to choose this monster?";			
				if (select("Yes:No") == 2) {
					mes "[Ticket Helper]";
					mes "You have canceled";
					mes "your wager. Okay,";
					mes "I understand. Perhaps";
					mes "you'd feel more comfortable";
					mes "checking the monsters first?";
					close;			
				}
				next;
				if (!.@m1) {
					mes "[Ticket Helper]";
					mes "Now, please make";
					mes "your second choice";
					mes "for the monster that";
					mes "you think will place";
					mes "1st or 2nd in this race.";
					next;
					set .@m1, .@m;
				} else {
					if (!$@mon_time_2_2) {
						mes "[Ticket Helper]";
						mes "You've wagered on";
						mes "^0000FFMonster "+.@m1+"^000000 and ^0000FFMonster "+.@m+"^000000";
						mes "to win this race. Good luck!";
						mes "I really hope that the odds";
						mes "work out in your favor~";
						emotion e_kis;
						set monster_race_2_1,.@m1;
						set monster_race_2_2,.@m;
						getitem 7514,1; //Monster_Ticket
						close;
					} else {
						mes "[Ticket Helper]";
						mes "I'm very sorry, but a";
						mes "monster race is underway.";
						mes "Please wait, and then place";
						mes "your wager for the next race.";
						close;
					}
				}
			}
		case 3:
			mes "[Ticket Helper]";
			mes "Monster Races originated from";
			mes "simple children's games in which";
			mes "Cute Pets would race against each other. This grew into an adult";
			mes "pastime that is so popular, we've built a racing arena in Hugel.";
			next;
			mes "[Ticket Helper]";
			mes "Our Monster Race Arena hosts";
			mes "two types of monster races. First, we have the Single Monster Race,";
			mes "in which those that wagered on the 1st place monster are rewarded.";
			next;
			mes "[Eclar Ellbird]";
			mes "Then, we have the Dual Monster";
			mes "Race in which those that wagered on the 1st and 2nd place monsters";
			mes "are equally rewarded. The house";
			mes "odds and wager rewards are greater in Dual Races than Single Races.";
			next;
			mes "[Ticket Helper]";
			mes "Although a small entrance";
			mes "fee is required, we only use";
			mes "the money to give rewards to";
			mes "participants and maintain this";
			mes "arena. Therefore, we're not";
			mes "profiting from this enterprise.";
			next;
			mes "[Ticket Helper]";
			mes "Also, we prohibit others";
			mes "from making personal bets";
			mes "and wagers, using items and";
			mes "zeny, based on the outcomes";
			mes "of these races. That kind of";
			mes "gambling is illegal here...";
			next;
			mes "[Ticket Helper]";
			mes "Once you enter the Race Arena, you will receive a Racing Ticket.";
			mes "Keep in mind that winning Racing Tickets can only be exchanged for";
			mes "Prize Medals during a 5 minute window after the end of the race.";
			next;
			mes "[Ticket Helper]";
			mes "You're already here";
			mes "inside the Monster Race";
			mes "Arena, so you may as well";
			mes "try placing a wager. It's";
			mes "more fun than you'd think~";
			close;
		case 4:
			mes "[Ticket Helper]";
			mes "You have canceled";
			mes "your wager. Okay,";
			mes "I understand. Perhaps";
			mes "you'd feel more comfortable";
			mes "checking the monsters first?";
			close;
		}
	} else {
		if (countitem(7514)) {
			mes "[Ticket Helper]";
			mes "You've wagered on";
			mes "^0000FFMonster " + monster_race_2_1 + "^000000 and ^0000FFMonster " + monster_race_2_2 + "^000000";
			mes "for this Dual Monster Race.";
			next;
		} 
		mes "[Ticket Helper]";
		mes "The start of the race will be";
		mes "announced through a broadcast.";
		mes "You can refer to your Mini-Map";
		mes "to track the monsters' race";
		mes "positions. Thank you, and";
		mes "have a good time!";
		viewpoint 1,43,35,0,0xFF0000;
		close;	
	}

OnInit:
	disablenpc "Ticket Helper#2";
	end;
}

p_track02,39,49,3	script	Game Guide#double	845,{
	mes "[Game Guide]";
	mes "Welcome to the";
	mes "Monster Race Arena.";
	mes "How can I help you?";
	next;
	switch(select("Monster Race Info:Wager Info:Ticket Redemption Info")) {
	case 1:
		mes "[Game Guide]";
		mes "Monster Races originated from";
		mes "simple children's games in which";
		mes "Cute Pets would race against each other. This grew into an adult";
		mes "pastime that is so popular, we've built a racing arena in Hugel.";
		next;
		mes "[Game Guide]";
		mes "Our Monster Race Arena hosts";
		mes "two types of monster races. First, we have the Single Monster Race,";
		mes "in which those that wagered on the 1st place monster are rewarded.";
		next;
		mes "[Game Guide]";
		mes "Then, we have the Dual Monster";
		mes "Race in which the house odds and rewards are greater than in Single";
		mes "Monster Races: you must wager on 2 monsters, and they must place in";
		mes "1st and 2nd for you to win.";
		next;
		mes "[Game Guide]";
		mes "Although a small entrance";
		mes "fee is required, we only use";
		mes "the money to give rewards to";
		mes "participants and maintain this";
		mes "arena. Therefore, we're not";
		mes "profiting from this enterprise.";
		next;
		mes "[Game Guide]";
		mes "Also, we prohibit others";
		mes "from making personal bets";
		mes "and wagers, using items and";
		mes "zeny, based on the outcomes";
		mes "of these races. That kind of";
		mes "gambling is illegal here...";
		next;
		mes "[Game Guide]";
		mes "Once you enter the Race Arena, you will receive a Racing Ticket.";
		mes "Keep in mind that winning Racing Tickets can only be exchanged for";
		mes "Prize Medals during a 5 minute window after the end of the race.";
		next;
		break;
	case 2:
		mes "[Game Guide]";
		mes "Before placing a wager, you";
		mes "must get a free Racing Ticket";
		mes "from the Ticket Helper. There,";
		mes "I've marked the Ticket Helper";
		mes "on your Mini-Map, so you can";
		mes "find him pretty easily.";
		viewpoint 1,73,22,1,0xFF3355;
		next;
		break;
	case 3:
		mes "[Game Guide]";
		mes "If you wagered on the winner";
		mes "of a Single Monster Race, or";
		mes "on the 1st or 2nd place winners";
		mes "in a Dual Monster Race, then";
		mes "you can exchange your Racing";
		mes "Ticket for Prize Medals.";
		next;
		mes "[Game Guide]";
		mes "However, you must exchange";
		mes "your Racing Ticket with the";
		mes "Medal Distributor within the";
		mes "5 minute window after the end";
		mes "of the race. ^FF0000Your ticket becomes^FFFFFF ^FF0000 void after these 5 minutes.^000000";
		next;
		mes "[Game Guide]";
		mes "When this 5 minute window";
		mes "elapses, you will be teleported outside, and we will immediately";
		mes "begin preparing for the next race. Make sure that you remember this";
		mes "information when you wager.";
		next;
		mes "[Game Guide]";
		mes "If you haven't received";
		mes "your free Racing Ticket,";
		mes "then please visit the Ticket";
		mes "Helper. There, I've just marked";
		mes "his location on your Mini-Map.";
		viewpoint 1,67,45,2,0xCE6300;
		next;
		break;
	}
	mes "[Game Guide]";
	mes "Thank you, and";
	mes "I hope you enjoy";
	mes "your time here in the";
	mes "Monster Racing Arena.";
	close;
}

p_track02,67,45,5	script	Medal Distributor#medal	845,{
	if (!checkweight(909,20)) {
		mes "[Medal Distributor]";
		mes "I'm sorry, but I can't";
		mes "reward you with any medals";
		mes "until you make more space";
		mes "available in your Inventory.";
		close;
	}
	mes "[Medal Distributor]";
	mes "Hello there~";
	mes "If you've wagered on the";
	mes "winning monster in a recent";
	mes "race, then you can exchange";
	mes "your game ticket here for";
	mes "some Prize Medals.";
	next;
	if (!countitem(7514)) {
		mes "[Medal Distributor]";
		mes "Please remember that you can";
		mes "only exchange winning Game";
		mes "Tickets for Prize Medals right";
		mes "after the race finishes. Prize";
		mes "Medals may be given to Wayne";
		mes "in Hugel in exchange for items.";
		close;
	}
	mes "[Medal Distributor]";
	mes "Please remember that you can";
	mes "only exchange winning Game";
	mes "Tickets for Prize Medals right";
	mes "after the race finishes. Prize";
	mes "Medals may be given to Wayne";
	mes "in Hugel in exchange for items.";
	next;
	if (monster_race_2_1 == $@mon_race_2_1 && monster_race_2_2 == $@mon_race_2_2) {
		mes "[Medal Distributor]";
		mes "Congratulations! It's really";
		mes "difficult to guess the winners";
		mes "of a Dual Monster Race, so you";
		mes "must be really lucky! Would you";
		mes "like to exchange your winning";
		mes "Racing Ticket for Prize Medals?";
		next;
		if (select("Yes, please.:No, thanks.") == 1) {
			mes "[Medal Distributor]";
			mes "Okay, everything looks good,";
			mes "so here's your Prize Medals~";
			mes "If you want to trade these";
			mes "medals for items, please";
			mes "visit Wayne in Hugel. We hope";
			mes "you enjoyed the Monster Race~";
			delitem 7514,1; //Monster_Ticket
			set monster_race_2_1,7;
			set monster_race_2_2,7;
			getitem 7515,15; //Marvelous_Medal
			close;
		}
		mes "[Medal Distributor]";
		mes "Um, are you sure? You ";
		mes "can only exchange a winning";
		mes "Racing Ticket for Prize Medals";
		mes "for a short time after the race. If you made a mistake, you";
		mes "should ask me again quickly.";
		close;
	} else if (!monster_race_2_1 && !monster_race_2_2) {
		mes "[Medal Distributor]";
		mes "Well, better luck next time...";
		mes "Although you can't always";
		mes "be lucky, it's always fun to";
		mes "wager on the monster races!";
		close;
	} else if (monster_race_2_1 == 7 && monster_race_2_2 == 7) {
			mes "[Medal Distributor]";
			mes "Thanks for visiting the";
			mes "Monster Race Arena, and";
			mes "I hope you enjoy your time";
			mes "here. I'll see you next time~";
			close;
	} else if (monster_race_2_1 != $@mon_race_2_1 || monster_race_2_2 != $@mon_race_2_2) {
		mes "[Medal Distributor]";
		mes "You may not have wagered";
		mes "on the winning monster in";
		mes "the last race, but I hope that";
		mes "you get lucky next time~";
		close;
	}
		
OnInit:
	disablenpc "Medal Distributor#medal";
	end;
}

p_track02,76,38,1	script	Exit Guide#double	798,{
	mes "[Exit Guide]";
	mes "If you have a winning Racing";
	mes "Ticket, please make sure that";
	mes "you redeem it for Prize Medals";
	mes "now. All Racing Tickets become";
	mes "void once the next race begins.";
	next;
	mes "[Exit Guide]";
	mes "If you wish to leave";
	mes "the arena, then I can guide";
	mes "you outside. Would you like";
	mes "to leave the arena right now?";
	next;
	if (select("Yes:No") == 2) {
		mes "[Exit Guide]";
		mes "Alright, then.";
		mes "Just let me know";
		mes "whenever you're";
		mes "ready to leave.";
		close;
	}
	if (!countitem(7514)) {
		mes "[Exit Guide]";
		mes "Thank you for";
		mes "your patronage, and";
		mes "I hope that you come";
		mes "visit us again soon~";
	} else {
		mes "[Exit Guide]";
		mes "In accordance with our";
		mes "policies, I must take your";
		mes "Racing Ticket before you leave.";
		mes "Thank you for your patronage,";
		mes "and I hope you enjoy your time";
		mes "here in the Monster Race Arena.";
		delitem 7514,1; //Monster_Ticket
	}
	set monster_race_2_1,0;
	set monster_race_2_2,0;
	close2;
	warp "hugel",63,73;
	end;
}

-	script	mob1#main	-1,{
	function	MN;
OnEnable:
	enablenpc strnpcinfo(0);
	setarray .@n[1], 1725,1726,1727,1728,1730,1729;
	getmapxy(.@m$,.@x,.@y,1);
	set .@i, MN;
	monster "p_track02",58,.@y,"Monster "+.@i,.@n[.@i],1,strnpcinfo(0)+"::OnMyMobDead";
	end;

OnDisable:
	killmonster "p_track02",strnpcinfo(0)+"::OnMyMobDead";
	disablenpc strnpcinfo(0);
	end;

OnTouchNPC:
	set .@i, MN;
	if (!$@mon_race_2_1) {
		emotion e_lv;
		specialeffect EF_MVP;
		mapannounce "p_track02","Monster "+.@i+" has reached the Finish Line!",bc_map,"0x66FFCC";
		set $@mon_race_2_1,1;
		donpcevent strnpcinfo(0)+"::OnDisable";
	} else {
		emotion e_lv;
		specialeffect EF_MVP;
		mapannounce "p_track02","The race is over! Monster "+.@i+" has reached the Finish Line!",bc_map,"0x66FFCC";
		set $@mon_race_2_2,1;
		donpcevent "#poring1::OnDisable";
		donpcevent "#lunatic1::OnDisable";
		donpcevent "#savagebebe1::OnDisable";
		donpcevent "#desertwolf1::OnDisable";
		donpcevent "#deviruchi1::OnDisable";
		donpcevent "#baphomet1::OnDisable";
		donpcevent "TrapGlobal#race02::OnDisable";
		enablenpc "Medal Distributor#medal";
		donpcevent "#race_timer2-3::OnEnable";
	}
	end;

OnMyMobDead:
	end;
	
	function	MN	{
		setarray .@n$[1], "poring","lunatic","savagebebe","desertwolf","deviruchi","baphomet";
		for (set .@i, 1; .@i <= getarraysize(.@n$); set .@i, .@i + 1) {
			if (compare(strnpcinfo(0),.@n$[.@i])) 
				break;
		}
		return .@i;	
	}

OnInit:
	if (compare(strnpcinfo(0),"main")) end;
	disablenpc strnpcinfo(0);
	end;
}
p_track02,30,38,0	duplicate(mob1#main)	#poring1	139,0,0
p_track02,30,36,0	duplicate(mob1#main)	#lunatic1	139,0,0
p_track02,30,34,0	duplicate(mob1#main)	#savagebebe1	139,0,0
p_track02,30,32,0	duplicate(mob1#main)	#desertwolf1	139,0,0
p_track02,30,30,0	duplicate(mob1#main)	#deviruchi1	139,0,0
p_track02,30,28,0	duplicate(mob1#main)	#baphomet1	139,0,0

p_track02,19,48,0	script	TrapGlobal#race02	-1,{
OnEnable:
	enablenpc "TrapGlobal#race02";
	for (set .@i, 1; .@i <= 6; set .@i, .@i + 1)
		enablenpc "starting#race02_"+.@i;
	set .@c, 1;
	while (.@c <= 6) {
		setd ".@line_"+.@c,rand(1,70);
		if (getd(".@line_"+.@c) <= 10) {
			setd "$@mon_r02_luk"+.@c,getd(".@line_"+.@c);
			enablenpc "Luk#race02_"+.@c+"_5";
			enablenpc "Luk#race02_"+.@c+"_6";
			setd ".@tired_"+.@c,rand(50,60);
			setd "$@mon_r02_tire"+.@c,getd(".@tired_"+.@c);
			enablenpc "Tire#race02_"+.@c+"_1";
		} else if (getd(".@line_"+.@c) <= 30) {
			setd "$@mon_r02_luk"+.@c,getd(".@line_"+.@c);
			enablenpc "Luk#race02_"+.@c+"_5";
			setd ".@tired_"+.@c,rand(40,60);
			setd "$@mon_r02_tire"+.@c,getd(".@tired_"+.@c);
			enablenpc "Tire#race02_"+.@c+"_1";
			if (getd(".@tired_"+.@c) < 50) enablenpc "Tire#race02_"+.@c+"_2";
		} else if (getd(".@line_"+.@c) <= 40) {
			setd "$@mon_r02_luk"+.@c,getd(".@line_"+.@c);
			enablenpc "Luk#race02_"+.@c+"_1";
			setd ".@tired_"+.@c,rand(30,50);
			setd "$@mon_r02_tire"+.@c,getd(".@tired_"+.@c);
			enablenpc "Tire#race02_"+.@c+"_1";
			enablenpc "Tire#race02_"+.@c+"_2";
			if (getd(".@tired_"+.@c) < 40) enablenpc "Tire#race02_"+.@c+"_3";
		} else if (getd(".@line_"+.@c) <= 50) {
			setd "$@mon_r02_luk"+.@c,getd(".@line_"+.@c);
			enablenpc "Luk#race02_"+.@c+"_1";
			enablenpc "Luk#race02_"+.@c+"_2";
			setd ".@tired_"+.@c,rand(20,40);
			setd "$@mon_r02_tire"+.@c,getd(".@tired_"+.@c);
			for (set .@i, 1; .@i <= 3; set .@i, .@i + 1)
				enablenpc "Tire#race02_"+.@c+"_"+.@i;
			if (getd(".@tired_"+.@c) < 30) enablenpc "Tire#race02_"+.@c+"_4";
		} else if (getd(".@line_"+.@c) <= 60) {
			setd "$@mon_r02_luk"+.@c,getd(".@line_"+.@c);
			for (set .@i, 1; .@i <= 3; set .@i, .@i + 1)
				enablenpc "Luk#race02_"+.@c+"_"+.@i;
			setd ".@tired_"+.@c,rand(10,30);
			setd "$@mon_r02_tire"+.@c,getd(".@tired_"+.@c);
			for (set .@i, 1; .@i <= 4; set .@i, .@i + 1)
				enablenpc "Tire#race02_"+.@c+"_"+.@i;
			if (getd(".@tired_"+.@c) < 20) enablenpc "Tire#race02_"+.@c+"_5";
		}	else if (getd(".@line_"+.@c) <= 70) {
			setd "$@mon_r02_luk"+.@c,getd(".@line_"+.@c);
			for (set .@i, 1; .@i <= 4; set .@i, .@i + 1)
				enablenpc "Luk#race02_"+.@c+"_"+.@i;
			setd ".@tired_"+.@c,rand(0,20);
			setd "$@mon_r02_tire"+.@c,getd(".@tired_"+.@c);
			for (set .@i, 1; .@i <= 5; set .@i, .@i + 1)
				enablenpc "Tire#race02_"+.@c+"_"+.@i;
			if (getd(".@tired_"+.@c) < 10) enablenpc "Tire#race02_"+.@c+"_6";
		}
		set .@c, .@c + 1;
	}
	end;

OnDisable:
	disablenpc "TrapGlobal#race02";
	for (set .@i, 1; .@i <= 6; set .@i, .@i + 1)
		donpcevent "starting#race02_"+.@i+"::OnDisable";
	end;
	
OnInit:
	for (set .@i, 1; .@i <= 6; set .@i, .@i + 1) {
		setd "$@mon_r02_luk"+.@i,0;
		setd "$@mon_r02_tire"+.@i,0;
	}
	end;
}

-	script	starting_2	-1,{
OnDisable:
	disablenpc strnpcinfo(0);
	for(set .@i,1; .@i<7; set .@i,.@i+1)
		disablenpc "Luk#"+strnpcinfo(2)+"_"+.@i;
	for(set .@i,1; .@i<7; set .@i,.@i+1)
		disablenpc "Tire#"+strnpcinfo(2)+"_"+.@i;
	end;

OnTouchNPC:
	set .@start,rand(1,100);
	if (.@start < 11) set .@speed,60;
	else if (.@start < 21) set .@speed,70;
	else if (.@start < 31) set .@speed,80;
	else if (.@start < 41) set .@speed,90;
	else if (.@start < 51) set .@speed,100;
	else if (.@start < 61) set .@speed,110;
	else if (.@start < 71) set .@speed,120;
	else if (.@start < 81) set .@speed,130;
	else if (.@start < 91) set .@speed,140;
	else set .@speed,150;
	sc_start SC_WALKSPEED,5000,.@speed;
	end;
	
OnInit:
	disablenpc strnpcinfo(0);
	end;
}

p_track02,56,38,0	duplicate(starting_2)	starting#race02_1	-1,0,0
p_track02,56,36,0	duplicate(starting_2)	starting#race02_2	-1,0,0
p_track02,56,34,0	duplicate(starting_2)	starting#race02_3	-1,0,0
p_track02,56,32,0	duplicate(starting_2)	starting#race02_4	-1,0,0
p_track02,56,30,0	duplicate(starting_2)	starting#race02_5	-1,0,0
p_track02,56,28,0	duplicate(starting_2)	starting#race02_6	-1,0,0

p_track02,33,38,0	duplicate(Luk_1)	Luk#race02_1_1	-1,0,0
p_track02,37,38,0	duplicate(Luk_1)	Luk#race02_1_2	-1,0,0
p_track02,53,38,0	duplicate(Luk_1)	Luk#race02_1_3	-1,0,0
p_track02,45,38,0	duplicate(Luk_1)	Luk#race02_1_4	-1,0,0
p_track02,33,36,0	duplicate(Luk_1)	Luk#race02_2_1	-1,0,0
p_track02,37,36,0	duplicate(Luk_1)	Luk#race02_2_2	-1,0,0
p_track02,53,36,0	duplicate(Luk_1)	Luk#race02_2_3	-1,0,0
p_track02,45,36,0	duplicate(Luk_1)	Luk#race02_2_4	-1,0,0
p_track02,33,34,0	duplicate(Luk_1)	Luk#race02_3_1	-1,0,0
p_track02,37,34,0	duplicate(Luk_1)	Luk#race02_3_2	-1,0,0
p_track02,53,34,0	duplicate(Luk_1)	Luk#race02_3_3	-1,0,0
p_track02,45,34,0	duplicate(Luk_1)	Luk#race02_3_4	-1,0,0
p_track02,33,32,0	duplicate(Luk_1)	Luk#race02_4_1	-1,0,0
p_track02,37,32,0	duplicate(Luk_1)	Luk#race02_4_2	-1,0,0
p_track02,53,32,0	duplicate(Luk_1)	Luk#race02_4_3	-1,0,0
p_track02,45,32,0	duplicate(Luk_1)	Luk#race02_4_4	-1,0,0
p_track02,33,30,0	duplicate(Luk_1)	Luk#race02_5_1	-1,0,0
p_track02,37,30,0	duplicate(Luk_1)	Luk#race02_5_2	-1,0,0
p_track02,53,30,0	duplicate(Luk_1)	Luk#race02_5_3	-1,0,0
p_track02,45,30,0	duplicate(Luk_1)	Luk#race02_5_4	-1,0,0
p_track02,33,28,0	duplicate(Luk_1)	Luk#race02_6_1	-1,0,0
p_track02,37,28,0	duplicate(Luk_1)	Luk#race02_6_2	-1,0,0
p_track02,53,28,0	duplicate(Luk_1)	Luk#race02_6_3	-1,0,0
p_track02,45,28,0	duplicate(Luk_1)	Luk#race02_6_4	-1,0,0

p_track02,49,38,0	duplicate(Luk_2)	Luk#race02_1_5	-1,0,0
p_track02,41,38,0	duplicate(Luk_2)	Luk#race02_1_6	-1,0,0
p_track02,49,36,0	duplicate(Luk_2)	Luk#race02_2_5	-1,0,0
p_track02,41,36,0	duplicate(Luk_2)	Luk#race02_2_6	-1,0,0
p_track02,49,34,0	duplicate(Luk_2)	Luk#race02_3_5	-1,0,0
p_track02,41,34,0	duplicate(Luk_2)	Luk#race02_3_6	-1,0,0
p_track02,49,32,0	duplicate(Luk_2)	Luk#race02_4_5	-1,0,0
p_track02,41,32,0	duplicate(Luk_2)	Luk#race02_4_6	-1,0,0
p_track02,49,30,0	duplicate(Luk_2)	Luk#race02_5_5	-1,0,0
p_track02,41,30,0	duplicate(Luk_2)	Luk#race02_5_6	-1,0,0
p_track02,49,28,0	duplicate(Luk_2)	Luk#race02_6_5	-1,0,0
p_track02,41,28,0	duplicate(Luk_2)	Luk#race02_6_6	-1,0,0

p_track02,43,38,0	duplicate(Tire_1)	Tire#race02_1_1	-1,0,0
p_track02,39,38,0	duplicate(Tire_1)	Tire#race02_1_2	-1,0,0
p_track02,35,38,0	duplicate(Tire_1)	Tire#race02_1_3	-1,0,0
p_track02,55,38,0	duplicate(Tire_1)	Tire#race02_1_4	-1,0,0
p_track02,51,38,0	duplicate(Tire_1)	Tire#race02_1_5	-1,0,0
p_track02,47,38,0	duplicate(Tire_1)	Tire#race02_1_6	-1,0,0
p_track02,43,36,0	duplicate(Tire_1)	Tire#race02_2_1	-1,0,0
p_track02,39,36,0	duplicate(Tire_1)	Tire#race02_2_2	-1,0,0
p_track02,35,36,0	duplicate(Tire_1)	Tire#race02_2_3	-1,0,0
p_track02,55,36,0	duplicate(Tire_1)	Tire#race02_2_4	-1,0,0
p_track02,51,36,0	duplicate(Tire_1)	Tire#race02_2_5	-1,0,0
p_track02,47,36,0	duplicate(Tire_1)	Tire#race02_2_6	-1,0,0
p_track02,43,34,0	duplicate(Tire_1)	Tire#race02_3_1	-1,0,0
p_track02,39,34,0	duplicate(Tire_1)	Tire#race02_3_2	-1,0,0
p_track02,35,34,0	duplicate(Tire_1)	Tire#race02_3_3	-1,0,0
p_track02,55,34,0	duplicate(Tire_1)	Tire#race02_3_4	-1,0,0
p_track02,51,34,0	duplicate(Tire_1)	Tire#race02_3_5	-1,0,0
p_track02,47,34,0	duplicate(Tire_1)	Tire#race02_3_6	-1,0,0
p_track02,43,32,0	duplicate(Tire_1)	Tire#race02_4_1	-1,0,0
p_track02,39,32,0	duplicate(Tire_1)	Tire#race02_4_2	-1,0,0
p_track02,35,32,0	duplicate(Tire_1)	Tire#race02_4_3	-1,0,0
p_track02,55,32,0	duplicate(Tire_1)	Tire#race02_4_4	-1,0,0
p_track02,51,32,0	duplicate(Tire_1)	Tire#race02_4_5	-1,0,0
p_track02,47,32,0	duplicate(Tire_1)	Tire#race02_4_6	-1,0,0
p_track02,43,30,0	duplicate(Tire_1)	Tire#race02_5_1	-1,0,0
p_track02,39,30,0	duplicate(Tire_1)	Tire#race02_5_2	-1,0,0
p_track02,35,30,0	duplicate(Tire_1)	Tire#race02_5_3	-1,0,0
p_track02,55,30,0	duplicate(Tire_1)	Tire#race02_5_4	-1,0,0
p_track02,51,30,0	duplicate(Tire_1)	Tire#race02_5_5	-1,0,0
p_track02,47,30,0	duplicate(Tire_1)	Tire#race02_5_6	-1,0,0
p_track02,43,28,0	duplicate(Tire_1)	Tire#race02_6_1	-1,0,0
p_track02,39,28,0	duplicate(Tire_1)	Tire#race02_6_2	-1,0,0
p_track02,35,28,0	duplicate(Tire_1)	Tire#race02_6_3	-1,0,0
p_track02,55,28,0	duplicate(Tire_1)	Tire#race02_6_4	-1,0,0
p_track02,51,28,0	duplicate(Tire_1)	Tire#race02_6_5	-1,0,0
p_track02,47,28,0	duplicate(Tire_1)	Tire#race02_6_6	-1,0,0

// NPCs for Redeeming Prize Medals (Einbroch and Hugel)
//============================================================
ein_in01,85,208,5	script	Ei'felle#repay01	854,{
	if (!ein_medal01) {
		mes "[Ei'felle]";
		mes "Curses! We need to deliver";
		mes "what our customers ordered,";
		mes "but we've been making nothing";
		mes "but shipshod products! If we";
		mes "only had that metal, we could";
		mes "pump up our product quality!";
		next;
		select("What metal are you talking about?");
		mes "[Ei'felle]";
		mes "There's a small village";
		mes "at the outskirts of the";
		mes "Schwaltzvalt Republic that";
		mes "gives these special medals";
		mes "that are made of this metal";
		mes "which we desperately need...";
		next;
		mes "[Ei'felle]";
		mes "We've sent one of our best";
		mes "guildsmen to get some of those";
		mes "medals for us, but he hasn't";
		mes "reported back to us quite yet.";
		mes "I'm getting pretty anxious...";
		next;
		mes "[Ei'felle]";
		mes "I mean, we need a whole";
		mes "lot of that metal to fill out";
		mes "our orders and finish our";
		mes "manufacturing research,";
		mes "but so far, none of us have";
		mes "been able to get any medals...";
		next;
		if (countitem(7515)) {
			mes "["+ strcharinfo(0) +"]";
			mes "Oh! Are you talking";
			mes "about the medals that";
			mes "they give as rewards in";
			mes "the Monster Race Arena?";
			mes "I have some of those.";
			next;
			mes "[Ei'felle]";
			mes "Huh? Show them to me...";
			mes "Yes! That's exactly what";
			mes "we need! Would you please";
			mes "donate your medals so that we";
			mes "can finally make some quality";
			mes "products for our customers?";
			next;
			callsub S_Reward;
			end;
		}
		mes "[Ei'felle]";
		mes "If you happen to obtain any";
		mes "medals from the Monster";
		mes "Race Arena in Hugel, then";
		mes "please bring some of them";
		mes "to me. I'll be sure to repay";
		mes "you for your kindness...";
		close;
	} else if (ein_medal01 < 500) {
		mes "[Ei'felle]";
		mes "Oh, how have you been?";
		mes "Thank you so much for";
		mes "donating so many medals,";
		mes "they've been helpful in my";
		mes "research. Still, I need more";
		mes "and more of them everyday...";
		next;
		if (countitem(7515)) {
			mes "[Ei'felle]";
			mes "The other Blacksmith";
			mes "Guildsmen are doing their";
			mes "best to collect Prize Medals";
			mes "in Hugel, but they keep failing";
			mes "to win them! If you have any";
			mes "medals, then may I have some?";
			next;
			callsub S_Reward;
			end;
		}
		mes "[Ei'felle]";
		mes "If you happen to obtain any";
		mes "medals from the Monster";
		mes "Race Arena in Hugel, then";
		mes "please bring some of them";
		mes "to me. I'll be sure to repay";
		mes "you for your kindness...";
		close;
	}
	if (!checkweight(1201,1)) {
		mes "[Ei'felle]";
		mes "Goodness, you're carrying";
		mes "so many things with you!";
		mes "You'd better put some of";
		mes "it away in Kafra Storage";
		mes "before you're overwhelmed";
		mes "by the bulk of your items!";
		close;
	}
	if (ein_medal01 > 499 && ein_medal01 < 1500) {
		if (ein_medal01 < 1000) {
			mes "[Ei'felle]";
			mes "Ah, welcome back! I've finally";
			mes "made a breakthrough in my";
			mes "metal research! Look, I've";
			mes "developed this Glittering";
			mes "Jacket! It's lightweight and";
			mes "very durable, you see?";
			next;
			mes "[Ei'felle]";
			mes "I wouldn't be able to have";
			mes "completed this without your";
			mes "help. Now, would you like to";
			mes "receive this Glittering Jacket";
			mes "as my way of repaying you?";
			next;
			if (select("Accept:Wait for Further Development") == 1) {
				callsub S_BonusReward,500,2319;
				end;
			}
			mes "[Ei'felle]";
			mes "Ah, I see. You'd rather wait";
			mes "until we develop something";
			mes "more to your liking. In that";
			mes "case, would you please donate";
			mes "more medals to my research?";
			mes "We're always low on them...";
			next;
		} else if (ein_medal01 < 1500) {
			mes "[Ei'felle]";
			mes "Oh, you're back!";
			mes "Thanks to all the medals";
			mes "that you've donated, I'm now";
			mes "able to manufacture a set";
			mes "of slotted armor imbued";
			mes "with a property of your choice.";
			next;
			mes "[Ei'felle]";
			mes "If you'd like, I can repay you";
			mes "now by creating a set of slotted elemental armor for you, or we";
			mes "can wait for you to donate more";
			mes "medals until I can develop";
			mes "something else for you.";
			next;
			switch(select("Accept Armor:Can I have something else?:Wait for Further Development")) {
				case 1:
					mes "[Ei'felle]";
					mes "I can manufacture one set of";
					mes "slotted Armor imbued with the";
					mes "Fire, Earth, Wind, or Water";
					mes "property. Which property would";
					mes "you like your armor to have?";
					next;
					switch(select("Fire Property:Earth Property:Wind Property:Water Property")) {
						case 1: callsub S_BonusReward,1000,2345; end;
						case 2: callsub S_BonusReward,1000,2351; end;
						case 3: callsub S_BonusReward,1000,2349; end;
						case 4: callsub S_BonusReward,1000,2347; end;
					}
				case 2:
					mes "[Ei'felle]";
					mes "Something else...?";
					mes "Oh, you must mean";
					mes "the Glittering Jacket that";
					mes "I developed earlier. After";
					mes "all, I have any other items";
					mes "to offer you for now...";
					next;
					callsub S_BonusReward,500,2319;
					end;
				case 3:
					mes "[Ei'felle]";
					mes "Ah, I see. You'd rather wait";
					mes "until we develop something";
					mes "more to your liking. In that";
					mes "case, would you please donate";
					mes "more medals to my research?";
					mes "We're always low on them...";
					next;
					break;
			}
		}
		if (countitem(7515)) {
			mes "[Ei'felle]";
			mes "The other Blacksmith";
			mes "Guildsmen are doing their";
			mes "best to collect Prize Medals";
			mes "in Hugel, but they keep failing";
			mes "to win them! If you have any";
			mes "medals, then may I have some?";
			next;
			callsub S_Reward;
			end;
		}
		mes "[Ei'felle]";
		mes "If you happen to obtain any";
		mes "medals from the Monster";
		mes "Race Arena in Hugel, then";
		mes "please bring some of them";
		mes "to me. I'll be sure to repay";
		mes "you for your kindness...";
		close;
	} else if (ein_medal01 > 1499) {
		mes "[Ei'felle]";
		mes "Ah, you're back! I've";
		mes "extracted all the metal";
		mes "from the medals you've";
		mes "given me, and I think I have";
		mes "enough to create a Level 4";
		mes "Weapon. Isn't that incredible?";
		next;
		mes "[Ei'felle]";
		mes "If you like, I can create";
		mes "one of these weapons for you";
		mes "as my way of repaying you for";
		mes "your help. What do you think?";
		next;
		if (select("Yes, I want a Level 4 Weapon.:Can I have something else?") == 2) {
			mes "[Ei'felle]";
			mes "Something else?";
			mes "Oh, alright then, would";
			mes "you like to have a Glittering";
			mes "Jacket, or a set of slotted";
			mes "elemental Armor? Please go";
			mes "ahead and make your choice~";
			next;
			switch (select("Glittering Jacket:Fire Property Armor:Earth Property Armor:Wind Property Armor:Water Property Armor:Cancel")) {
				case 1: callsub S_BonusReward,500,2319; end;
				case 2:	callsub S_BonusReward,1000,2345; end;
				case 3: callsub S_BonusReward,1000,2351; end;
				case 4:	callsub S_BonusReward,1000,2349; end;
				case 5:	callsub S_BonusReward,1000,2347; end;
				case 6:	close;
			}
		}
		setarray .@m$, "Dagger","One Handed Sword","Two Handed Sword","Axe","Mace","Bow","Staff","Book","Spear","Katar","Knuckle","Whip","Musical Instrument";
		set .@m, select (implode(.@m$,":")) - 1;
		mes "[Ei'felle]";
		mes "So you'd like to have a";
		mes .@m$[.@m]+"? Please choose";
		mes "which Level 4 Weapon";
		mes "that you want me to create.";
		next;
		switch (.@m) {
			Case 0:
				setarray .@mw$, "Ginnungagap:Grimtooth:Dragon Killer:Mail Breaker:Bazerald:Sword Breaker:Ice Pick:Sucsamad:Kitchen Knife:Azoth:Exorciser:Assassin Dagger:Moonlight Dagger:Weeder Knife:Cursed Dagger:Dagger of Counter:Combat Knife:Fortune Sword";
				setarray .@mw, 13002,1237,13001,1225,1231,1224,1230,1236,1229,1235,1233,1232,1234,1227,1241,1242,1228,1223;
				break;
			Case 1:
				setarray .@mw$, "Nagan:Immaterial Sword:Mysteltainn:Byeollungum:Star Dust Blade:Caesar's Sword:Ice Falchion:Excalibur:Edge:Cutlus:Solar Sword:Tirfing:Fireblend";
				setarray .@mw, 1130,1141,1138,1140,1148,1134,1131,1137,1132,1135,1136,1139,1133;
				break;
			Case 2:	
				setarray .@mw$, "Dragon Slayer:Masamune:Muramasa:Schweizersabel:Executioner:Zweihander:Katzbalger";
				setarray .@mw, 1166,1165,1164,1167,1169,1168,1170;
				break;
			Case 3:
				setarray .@mw$, "Great Axe:Guillotine:Light Epsilon:Bloody Axe:Sabbath:Slaughter:Cleaver:Tomahawk";
				setarray .@mw, 1364,1369,1366,1363,1365,1367,1305,1368;
				break;
			Case 4:
				setarray .@mw$, "Golden Mace:Grand Cross:Long Mace:Spike:Slash:Quadrille";
				setarray .@mw, 1524,1528,1525,1523,1526,1527;
				break;
			Case 5:
				setarray .@mw$, "Roguemaster's Bow:Dragon Wing:Rudra's Bow:Ballista";
				setarray .@mw, 1719,1724,1720,1722;
				break;
			Case 6:
				setarray .@mw$, "Wing Staff:Wizardry Staff";
				setarray .@mw, 1616,1473;
			Case 7:
				setarray .@mw$, "Legacy of Dragon:Book of the Apocalypse:Girl's Diary:Hardcover Book";
				setarray .@mw, 1559,1557,1558,1561;
				break;
			Case 8:
				setarray .@mw$, "Gae Bolg:Gelerdria:Gungnir:Skewer:Longinus's Spear:Brionac:Bill Guisarme:Zephyrus:Crescent Scythe:Tjungkuletti:Hellfire";
				setarray .@mw, 1474,1414,1413,1415,1469,1470,1467,1468,1466,1416,1471;
				break;
			Case 9:
				setarray .@mw$, "Infiltrator:Bloody Roar:Unholy Touch";
				setarray .@mw, 1261,1265,1263;
				break;
			Case 10:
				setarray .@mw$, "Hatii Claw:Berserk:Kaiser Knuckle";
				setarray .@mw, 1815,1814,1813;
				break;
			Case 11:
				setarray .@mw$, "Lariat:Rapture Rose:Blade Whip:Chemeti:Queen's Whip";
				setarray .@mw, 1962,1963,1969,1964,1970;
				break;
			Case 12:
				setarray .@mw$, "Oriental Lute:Electric Guitar";
				setarray .@mw, 1918,1913;
				break;		
		}
		set .@j, select (.@mw$+":Cancel") - 1;
		explode(.@mw$,.@mw$,":");
		if (.@j == getarraysize(.@mw$)) close;
		callsub S_BonusReward,1500,.@mw[.@j];
		end;
	}
	
S_Reward:
	if (select("Sure:No") == 2) {
		mes "[Ei'felle]";
		mes "Oh, alright...";
		mes "Still, I really need";
		mes "those medals, so if you";
		mes "change your mind, please";
		mes "come back as soon as you can.";
		emotion e_sob;
		close;
	}
	mes "[Ei'felle]";
	mes "Oh, thank you so much!";
	mes "I can use the metal in those";
	mes "medals to produce some high";
	mes "quality products. Now, how";
	mes "shall I repay you for giving me";
	mes "some of your Prize Medals?";
	next;
	switch(select("Base Experience:Job Experience:No, I'm just glad to help.:How's your research progressing?")) {
		case 1:
			mes "[Ei'felle]";
			mes "You just want to improve";
			mes "yourself, huh? Well, I dunno";
			mes "if you want to get stronger,";
			mes "smarter, or faster, but I can";
			mes "coach you on some visualization if you like. Now, relax with me~";
			mes "physical development.";
			next;
			mes "[Ei'felle]";
			mes "Focus... and believe.";
			mes "Believe that you are";
			mes "becoming what you want";
			mes "to be! B-believe... with";
			mes "all of your freakin' heart!";
			emotion e_omg,1;
			emotion e_omg;
			next;
			mes "[Ei'felle]";
			mes "*Phew* How's that?";
			mes "Now do you see the";
			mes "power of hope?";
			delitem 7515,1; //Marvelous_Medal
			if (BaseLevel < 21) getexp 200,0;
			else if ((BaseLevel > 20) && (BaseLevel < 31)) getexp 300,0;
			else if ((BaseLevel > 30) && (BaseLevel < 41)) getexp 1000,0;
			else if ((BaseLevel > 40) && (BaseLevel < 51)) getexp 1800,0;
			else if ((BaseLevel > 50) && (BaseLevel < 61)) getexp 2500,0;
			else if ((BaseLevel > 60) && (BaseLevel < 71)) getexp 4700,0;
			else if ((BaseLevel > 70) && (BaseLevel < 81)) getexp 5500,0;
			else if ((BaseLevel > 80) && (BaseLevel < 96)) getexp 7000,0;
			else if ((BaseLevel > 95) && (BaseLevel < 111)) getexp 8800,0;
			else if ((BaseLevel > 110) && (BaseLevel < 126)) getexp 10900,0;
			else if ((BaseLevel > 125) && (BaseLevel < 141)) getexp 13300,0;
			else getexp 16000,0;
			close;
		case 2:
			mes "[Ei'felle]";
			mes "You want to become more";
			mes "competent in your job? Um...";
			mes "Alright, we can do that. Just";
			mes "meditate with me, and we'll go";
			mes "do some imagery work together.";
			mes "I'm real good at this you know.";
			next;
			mes "[Ei'felle]";
			mes "J-just... visualize";
			mes "yourself... being...";
			mes "t-totally... awesome!";
			mes "You've gotta see it, and";
			mes "you've gotta feel it in your";
			mes "freakin' heart and mind!";
			emotion e_omg,1;
			emotion e_omg;
			next;
			mes "[Ei'felle]";
			mes "Yeap, it doesn't matter";
			mes "if it's real or imagined...";
			mes "Your mind will work on";
			mes "whatever you feed it.";
			mes "Placebos and psychosomatic symptoms-- it all ties together.";
			delitem 7515,1; //Marvelous_Medal
			if (BaseLevel < 21) getexp 0,150;
			else if ((BaseLevel > 20) && (BaseLevel < 31)) getexp 0,200;
			else if ((BaseLevel > 30) && (BaseLevel < 41)) getexp 0,750;
			else if ((BaseLevel > 40) && (BaseLevel < 51)) getexp 0,1800;
			else if ((BaseLevel > 50) && (BaseLevel < 61)) getexp 0,2500;
			else if ((BaseLevel > 60) && (BaseLevel < 71)) getexp 0,3525;
			else if ((BaseLevel > 70) && (BaseLevel < 81)) getexp 0,4125;
			else if ((BaseLevel > 80) && (BaseLevel < 96)) getexp 0,5250;
			else if ((BaseLevel > 95) && (BaseLevel < 111)) getexp 0,6600;
			else if ((BaseLevel > 110) && (BaseLevel < 126)) getexp 0,8175;
			else if ((BaseLevel > 125) && (BaseLevel < 141)) getexp 0,9975;
			else getexp 0,12000;
			close;
		case 3:
			mes "[Ei'felle]";
			mes "What th--?! You sure";
			mes "you don't want anything?";
			mes "Hm, well, I think it's kind";
			mes "of bad karma if I don't give";
			mes "you anything in return, so...";
			mes "Think of something. Quick.";
			next;
			mes "["+ strcharinfo(0) +"]";
			mes "Er, just use the medals";
			mes "to further your manufacturing";
			mes "research, and then you can";
			mes "pay me back if your develop";
			mes "something new. It's, um, like";
			mes "an investment in your work!";
			next;
			mes "[Ei'felle]";
			mes "Yeah... Yeah.";
			mes "Okay, I see where";
			mes "you're coming from.";
			mes "That's pretty smart.";
			mes "Okay, I'll repay you when";
			mes "we develop something new!";
			next;
			mes "[Ei'felle]";
			mes "Anyway, I need as many";
			mes "medals as I can get as";
			mes "soon as I can. How many";
			mes "medals do you think you";
			mes "can give me right now?";
			next;
			switch(select("Take them all.:How about this much?:No, I changed my mind.")) {
			case 1:
				mes "[Ei'felle]";
				mes "Th-thank you!";
				mes "Thank you so much!";
				mes "Your help will greatly";
				mes "advance my research,";
				mes "and I promise to repay";
				mes "you as soon as I can!";
				set .@medals,countitem(7515);
				delitem 7515,.@medals; //Marvelous_Medal
				set ein_medal01,ein_medal01+.@medals;
				close;
			case 2:
				mes "[Ei'felle]";
				mes "Alright, please enter the";
				mes "number of medals that";
				mes "you're willing to give me.";
				mes "Please don't enter any";
				mes "number greater than 100.";
				next;
				while(1) {
					input .@input;
					if (!.@input) {
						mes "[Ei'felle]";
						mes "Aw, so you've decided";
						mes "to cancel? Well, it's your";
						mes "choice, but I'm still so";
						mes "disappointed. Please come";
						mes "back if you change your mind...";
						close;
					} else if (.@input < 1 || .@input > 100) {
						mes "[Ei'felle]";
						mes "Remember, you can only";
						mes "enter a number from 1 to 100.";
						mes "If you want to give me more";
						mes "medals, then perhaps you";
						mes "should just give them all to me~ ^FFFFFF ^000000";
						next;
					} else break;
				}
				if (countitem(7515) < .@input) {
					mes "[Ei'felle]";
					mes "I'm sorry, but I don't";
					mes "think you have that many";
					mes "medals with you. Make sure";
					mes "that you offer me an amount of";
					mes "medals that you actually have.";
					emotion e_heh;
					close;
				} else {
					mes "[Ei'felle]";
					mes "Th-thank you!";
					mes "Thank you so much!";
					mes "Your help will greatly";
					mes "advance my research,";
					mes "and I promise to repay";
					mes "you as soon as I can!";
					delitem 7515,.@input; //Marvelous_Medal
					set ein_medal01,ein_medal01+.@input;
					close;
				}
			case 3:
				mes "[Ei'felle]";
				mes "Oh, alright...";
				mes "Still, I really need";
				mes "those medals, so if you";
				mes "change your mind, please";
				mes "come back as soon as you can.";
				close;
			}
			delitem 7515,1; //Marvelous_Medal
			set ein_medal01,1;
			close;
		case 4:
			mes "[Ei'felle]";
			mes "Well, I've been able to";
			mes "create a Glittering Jacket";
			mes "using the medals that you've";
			mes "brought to me. But I just know";
			mes "I can make something better";
			mes "if you'd bring me more!";
			next;
			mes "[Ei'felle]";
			mes "As of now, I have the metal";
			mes "from ^FF0000"+ ein_medal01 +"^000000 Prizes Medals that";
			mes "you've donated to me. The more";
			mes "that you bring, the closer I can get to making a new breakthrough!";
			close;
	}

S_BonusReward:
	mes "[Ei'felle]";
	if (getarg(1) == 2319) {
		mes "Do you really want";
		mes "this "+getitemname(getarg(1))+"?";
		mes "You may want to forego this";
		mes "reward in favor of getting";
		mes "something better later...";
	} else if ((getarg(1) == 2345) || (getarg(1) == 2347) || (getarg(1) == 2349) || (getarg(1) == 2351)) {
		mes "Are you sure that you want";
		mes "to accept this set of slotted";
		if (getarg(1) == 2345) mes "Fire property Armor? If you do,";
		else if (getarg(1) == 2351) mes "Earth property Armor? If you do,";
		else if (getarg(1) == 2349) mes "Wind property Armor? If you do,";
		else if (getarg(1) == 2347) mes "Water property Armor? If you do,";
		mes "I'll need more medals from you";
		mes "to make further advancements";
		mes "in my manufacturing research.";
	} else {
		mes "So you wish to have a";
		mes getitemname(getarg(1))+"? If you choose";
		mes "to have this Level 4 Weapon,";
		mes "I'll need to melt many of the";
		mes "medals that you've donated";
		mes "to me. Shall we proceed?";
	}
	next;
	if (select("Decline:Accept") == 1) {
		mes "["+ strcharinfo(0) +"]";
		mes "W-wait, I changed my";
		mes "mind. Would it be fine";
		mes "if I asked you to give";
		mes "me a reward later?";
		next;
		mes "[Ei'felle]";
		if (!getiteminfo(getarg(1),13)) { //use item level to determine if the item is armor (no weapon level)
			mes "Of course, of course.";
			mes "Remember, if you donate";
			mes "more medals to me, then";
			mes "I'll be able to create items";
			mes "of higher quality for you~";
		} else {
			mes "I don't think I can develop";
			mes "anything better than these Level 4 Weapons, but after making";
			mes "such a big investment, you should decide on what you want carefully.";
		}
		close;
	}
	mes "[Ei'felle]";
	if (getarg(1) == 2319) {
		mes "Here you are, I trust that";
		mes "this "+getitemname(getarg(1))+" will";
		mes "serve you well. Thank you";
		mes "for your help, and I hope that";
		mes "you'll continue to donate your";
		mes "medals for my metal research~";
	}
	else if ((getarg(1) == 2345) || (getarg(1) == 2347) || (getarg(1) == 2349) || (getarg(1) == 2351)) {
		mes "Great choice! I'm sure";
		if (getarg(1) == 2345) mes "that this set of slotted Fire";
		else if (getarg(1) == 2351) mes "that this set of slotted Earth";
		else if (getarg(1) == 2349) mes "that this set of slotted Wind";
		else if (getarg(1) == 2347) mes "that this set of slotted Water";
		mes "property Armor will serve you";
		mes "well. Thank you for your help,";
		mes "and if you get more medals,";
		mes "please donate them to me~";
	} else {
		mes "Once again, I'd like to";
		mes "thank you for providing";
		mes "me with all of those medals.";
		mes "I imagine it must have been";
		mes "difficult. In any case, I would";
		mes "appreciate your continued help~";
	}
	set ein_medal01,ein_medal01-getarg(0);
	getitem getarg(1),1;
	close;
}
	
hugel,71,83,4	script	Wayne	900,{
	if (!checkweight(1201,1)) {
		mes "[Wayne]";
		mes "Hold on a second...";
		mes "If you want to exchange";
		mes "your Prize Medals for items,";
		mes "you'd better free up more space";
		mes "in your Inventory first. Why don't you use your Kafra Storage?";
		close;
	}
	mes "[Wayne]";
	mes "Hello, there! Ever wonder";
	mes "what you could do with all";
	mes "the Prize Medals you can win";
	mes "in Monster Race Arena? You";
	mes "can donate them in Einbroch";
	mes "to the Blacksmith Guild...";
	next;
	mes "[Wayne]";
	mes "...Or you can exchange them";
	mes "for items, right here and right";
	mes "now, with me. As always, the";
	mes "choice is really up to you.";
	next;
	if (select("Prize Medal Exchange:Cancel") == 2) {
		mes "[Wayne]";
		mes "Well, just keep in mind";
		mes "that you can always come";
		mes "to me to trade in your Prize";
		mes "Medals for consumable items.";
		mes "That guy in Einbroch? Not sure";
		mes "what he'd give you for them...";
		next;
		mes "[Wayne]";
		mes "All I know is that he";
		mes "needs a whole lot of medals";
		mes "for the work that he's doing.";
		mes "Still, I hear that he just may";
		mes "make your donations worth";
		mes "all your effort, you know?";
		close;
	}
	if (!checkweight(909,550)) {
		mes "[Wayne]";
		mes "Hold on a second...";
		mes "If you want to exchange";
		mes "your Prize Medals for items,";
		mes "you'd better free up more space";
		mes "in your Inventory first. Why don't you use your Kafra Storage?";
		close;
	} else {
		mes "[Wayne]";
		mes "Now, how many Prize Medals";
		mes "would you like to exchange?";
		mes "It doesn't take a genius to";
		mes "figure out that you can get";
		mes "more valuable items by trading";
		mes "more Prize Medals at a time.";
		next;
		setarray .@pm, 1,3,7,8,16,25,42,59;
		for (set .@i, 0; .@i < getarraysize(.@pm); set .@i, .@i + 1)
			set .@m$, .@m$ + .@pm[.@i] + " Prize medal:";
		set .@m, select (.@m$) - 1;
		switch (.@m) {
			Case 0: 
				setarray .@mr$, "2 Hinale Leaflets:2 Aloe Leaflets:1 Mastela Fruit:5 Witch Starsands:4 Condensed Red Potions";
				setarray .@mr, 520,2,521,2,522,1,1061,5,545,4;
				break;
			Case 1:
				setarray .@mr$, "1 Royal Jelly:6 Holy Waters";
				setarray .@mr, 526,1,523,6;
				break;
			Case 2:
				setarray .@mr$, "1 Cookie Bag:1 First Aid Kit";
				setarray .@mr, 12130,1,12110,1;
				break;
			Case 3:
				set .@mr$, "1 Gift Box";
				setarray .@mr, 644,1;
				break;
			Case 4:
				set .@mr$, "1 Old Blue Box";
				setarray .@mr, 603,1;
				break;
			Case 5:
				set .@mr$, "1 Taming Gift Set";
				setarray .@mr, 12105,1;
				break;
			Case 6:
				set .@mr$, "1 Old Purple Box";
				setarray .@mr, 617,1;
				break;
			Case 7:
				set .@mr$, "1 Poring Box";
				setarray .@mr, 12109,1;
				break;
		}
		mes "[Wayne]";
		mes "Now, please choose";
		mes "which of the following item";
		mes "sets that you'd like to receive";
		mes "in exchange for "+.@pm[.@m]+" Prize Medal."+((getarraysize(.@mr)<3)?" Well, we have only 1 set, but...":"");
		next;
		set .@m2, select (.@mr$) - 1;
		if (countitem(7515) < .@pm[.@m]) {
			mes "[Wayne]";
			mes "Hey, you don't have";
			mes "enough Prize Medals with";
			mes "you. Go and get some more";
			mes "if you want to exchange";
			mes "them with me for anything.";
			close;
		}
		mes "[Wayne]";
		mes "There you go~";
		mes "Thanks for using my";
		mes "service, and I hope that";
		mes "you come visit me again";
		mes "soon. Enjoy the monster";
		mes "races, fair adventurer~";
		delitem 7515,.@pm[.@m];
		getitem .@mr[.@m2*2],.@mr[((.@m2*2)+1)];
		close;		
	}
}

// Monstrer Race Affiliated NPCs
//============================================================
airplane,246,47,1	script	Eocatt#decoy01	878,{
	mes "[Eocatt]";
	mes "There's an old, humble";
	mes "village on the outskirts of";
	mes "the Schwaltzvalt Republic.";
	mes "It was just a tiny blip on the";
	mes "map until they opened up";
	mes "their Monster Race Arena!";
	next;
	mes "[Eocatt]";
	mes "If you win wagers on the";
	mes "monster race games, you'll";
	mes "be rewarded with these Prize";
	mes "Medals that are made of some";
	mes "really rare metal. I hear this metal's in demand in Einbroch...";
	next;
	mes "[Eocatt]";
	mes "Right, right...";
	mes "I remember now, the";
	mes "town was named Hugel.";
	mes "I'm sure there's other fun";
	mes "things to do there, but I'm sure that the Race Arena is a must!";
	close;
}

hugel,85,93,5	script	Mudie#dummy01	866,{
	mes "[Mudie]";
	mes "The Monster Races";
	mes "are probably the biggest";
	mes "attraction here in Hugel.";
	mes "We don't have much else";
	mes "going on here, I'm afraid.";
	next;
	mes "[Mudie]";
	mes "If you want to go visit";
	mes "the Monster Race Arena,";
	mes "just head towards the";
	mes "7 'o clock direction on";
	mes "your Mini-Map, and look for";
	mes "the hill surrounded by a fence.";
	next;
	mes "[Mudie]";
	mes "You should find the arena";
	mes "somewhere around that area.";
	mes "Anyway, if you want to wager";
	mes "or just watch the races, just";
	mes "ask one of the Eckar brothers. I hope you enjoy our little town~";
	close;
}

p_track02,32,45,5	script	Eccentric Scholar#double	755,{
	mes "[Eccentric Scholar]";
	mes "Let's see now...";
	mes "Monster 1's average speed";
	mes "and luck, as affected by";
	mes "wind resistance, fatigue...";
	mes "What's the approximate";
	mes "probability of winning...?";
	next;
	mes "[Eccentric Scholar]";
	mes "Crunch it into my";
	mes "algorithm... Carry the two...";
	mes "Wait, how many significant";
	mes "figures should I be using?";
	mes "Ah, right, 7, to account for x,";
	mes "a value representing--";
	next;
	mes "["+ strcharinfo(0) +"]";
	mes "Excuse me, but";
	mes "what are you doing?";
	next;
	mes "[Eccentric Scholar]";
	mes "S-silence!";
	mes "I must complete";
	mes "my calculations!";
	mes "Now, where was I...?";
	specialeffect EF_CLAYMORE;
	emotion e_an;
	close;
}

p_track02,69,31,1	script	Blacksmith Guildsman#dou	726,{
	if (!$@mon_time_2_2) {
		mes "[Blacksmith Guildsman]";
		mes "How many times must";
		mes "I wager on these races?!";
		mes "I haven't won even once!";
		mes "Oh, I must have the worst";
		mes "luck in wagering history!";
		emotion e_sob;
		next;
		mes "[Blacksmith Guildsman]";
		mes "I've been assigned by my";
		mes "guild to bring back some";
		mes "Prize Medals to Einbroch...";
		mes "They're apparently made";
		mes "with some rare metal, but...";
		mes "It's too hard for me to win~!";
		emotion e_swt2;
		close;
	} 
	mes "[Blacksmith Guildsman]";
	mes "Run! Go go go!";
	mes "I need to win some";
	mes "medals! Otherwise, I'll";
	mes "be too ashamed to return";
	mes "home to Einbroch! F-faster!";
	emotion e_korea;
	close;
}

p_track02,53,45,3	script	Valiant Knight#double	733,{
	mes "[Valiant Knight]";
	mes "Hey, have you been";
	mes "wagering on the races?";
	mes "If you've got a hot tip, then";
	mes "would you share it with me?";
	mes "I've won some wagers... But";
	mes "I really wanna win more!";
	next;
	mes "[Valiant Knight]";
	mes "Hah hah! It's like I tell";
	mes "those Blacksmiths! If they";
	mes "don't wanna lose all the time,";
	mes "then they should just bet on the same monster. Me? I always";
	mes "bet on the black Deviruchi~";
	next;
	mes "[Valiant Knight]";
	mes "You too...!";
	mes "Always bet";
	mes "on Deviruchi!";
	emotion e_no1;
	close;
}

p_track01,27,47,5	script	Drunkard#single	853,{
	mes "[Familiar Drunkard]";
	mes "Grrr...! ^333333*Hiccup*^000000";
	mes "I just gotta win this";
	mes "next game! I hafta do it!";
	mes "Hey, you! Which number is";
	mes "your lucky number? Huh?";
	next;
	mes "["+ strcharinfo(0) +"]";
	mes "I, er...";
	next;
	mes "[Familiar Drunkard]";
	mes "C'mon, I need your";
	mes "lucky number cuz I ran";
	mes "out of mine! Tell me!";
	mes "Tell me! ^333333*Hiccup~*^000000";
	close;
}

p_track01,69,31,1	script	Blacksmith Guildsman#sin	107,{
	mes "[Blacksmith Guildsman]";
	mes "How can this be so hard?";
	mes "Why can't I win at least";
	mes "one of these races? Argh!";
	mes "I can't go back until I get";
	mes "at least one Prize Medal!";
	next;
	mes "[Blacksmith Guildsman]";
	mes "Yeah, I've been assigned";
	mes "by the Einbroch Factory to";
	mes "get some Prize Medals since";
	mes "they're made of this rare medal. But it looks like they picked";
	mes "the wrong guy for this job...";
	next;
	mes "[Blacksmith Guildsman]";
	mes "I mean, I've been here";
	mes "forever and I haven't won";
	mes "anything yet! Hey, do me";
	mes "a favor and give any extra";
	mes "Prize Medals you might have";
	mes "to the Einbroch Factory, okay?";
	close;
}

p_track01,45,42,3	script	Absent Minded Man#single	881,{
	mes "[Absent Minded Man]";
	mes "Say, are you here to bet";
	mes "on the monster races? I've";
	mes "come all the way here, just";
	mes "because some strange man";
	mes "asked me to win medals. It's";
	mes "the only reason I'm in Hugel...";
	next;
	mes "[Absent Minded Man]";
	mes "But I've made more than";
	mes "100 wagers, and haven't won";
	mes "any of them! I mean, if I bet";
	mes "on the same monster 6 times,";
	mes "I should win at least once,";
	mes "right? What's going on?!";
	close;
}