summaryrefslogtreecommitdiff
path: root/npc/re/instances/OldGlastHeim.txt
blob: 9f3f29fdfe3e57c035186068f7188cda367c8a74 (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
//================= Hercules Script =======================================
//=       _   _                     _
//=      | | | |                   | |
//=      | |_| | ___ _ __ ___ _   _| | ___  ___
//=      |  _  |/ _ \ '__/ __| | | | |/ _ \/ __|
//=      | | | |  __/ | | (__| |_| | |  __/\__ \
//=      \_| |_/\___|_|  \___|\__,_|_|\___||___/
//================= License ===============================================
//= This file is part of Hercules.
//= http://herc.ws - http://github.com/HerculesWS/Hercules
//=
//= Copyright (C) 2013-2016  Hercules Dev Team
//= Copyright (C)  Ridley
//= Copyright (C)  Exneval
//= Copyright (C)  Euphy
//= Copyright (C)  Heris
//= Copyright (C)  Ziu
//=
//= Hercules is free software: you can redistribute it and/or modify
//= it under the terms of the GNU General Public License as published by
//= the Free Software Foundation, either version 3 of the License, or
//= (at your option) any later version.
//=
//= This program is distributed in the hope that it will be useful,
//= but WITHOUT ANY WARRANTY; without even the implied warranty of
//= MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//= GNU General Public License for more details.
//=
//= You should have received a copy of the GNU General Public License
//= along with this program.  If not, see <http://www.gnu.org/licenses/>.
//=========================================================================
//= Old Glast Heim
//================= Description ===========================================
//= Discover the history of events that took place in the Glast Heim castle
//= and how it ended up in ruins.
//================= Current Version =======================================
//= 1.2
//=========================================================================

glast_01,204,273,6	script	Hugin#ghinstance	4_M_SAGE_C,{
	if (BaseLevel < 130) { // iRO text
		mes("[Hugin]");
		mes("Why don't you come back after becoming stronger Maybe, level 130.");
		close;
	}
	if (!questprogress(12316)) {
		mes("[Hugin]");
		mes("A long time ago, this castle did not look like this.");
		next;
		mes("[Hugin]");
		mes("Ah I'm sorry. I'm muttering in front of a stranger.");
		next;
		mes("[Hugin]");
		mes("My name is Hugin. I'm studying the dimensional gap between time and space.");
		next;
		select("There's something like that here?");
		mes("[Hugin]");
		mes("Have you ever wondered about the history of Glast Heim?");
		next;
		mes("[Hugin]");
		mes("There was a King named Shumiche who was known as a tyrant in the history of the Rune-Midgarts Kingdom.");
		next;
		mes("[Hugin]");
		mes("Time will reveal the true answers if we look in the right places.");
		next;
		if (select("I don't care about history", "That is interesting. Find anything?") == 1) {
			mes("[Hugin]");
			mes("Really? Hmm, please come back later when you are interested then.");
			close;
		}
		mes("[Hugin]");
		mes("Actually, dimensional time travel is possible but I'm so afraid to go there.");
		next;
		mes("[Hugin]");
		mes("Yes! It might be possible for you.");
		next;
		mes("[Hugin]");
		mes("Do you want to time travel?");
		next;
		if (select("No thanks.", "Yes, of course I do!") == 1) {
			mes("[Hugin]");
			mes("Really? But, jumping gigawatts like this is such a great opportunity.");
			close;
		}
		mes("[Hugin]");
		mes("I knew that you would understand what I said. Well, please tell what you gonna do.");
		setquest(12316);
		next;
	}
	mes("[Hugin]");
	mes("Umm? Did you see me at another place? I don't think so. What about this time?");
	next;
	if (!questprogress(12317, PLAYTIME)) {
		.@party_id = getcharid(CHAR_ID_PARTY);
		.@p_name$ = getpartyname(.@party_id);
		.@md_name$ = "Old Glast Heim";
		if (!instance_check_party(.@party_id)) {
			mes("[Hugin]");
			mes("Why don't you make a party with more than 1 person and talk to me again?");
			close;
		}
		if (!questprogress(12318, HUNTING))
			setquest 12318;
		if (getcharid(CHAR_ID_CHAR) == getpartyleader(.@party_id, 2))
			.@menu1$ = "Generate Time Gap";
		else
			.@menu1$ = "";
		switch (select(.@menu1$, "Enter Old Glast Heim", "Cancel")) {
		case 1:
			if (getcharid(CHAR_ID_CHAR) != getpartyleader(.@party_id, 2))
				end;
			.@instance = instance_create(.@md_name$, .@party_id);
			if (.@instance < 0) {
				mesf("Party Name: %s", .@p_name$);
				mesf("Party Leader: %s", strcharinfo(PC_NAME));
				mesf("^0000ff%s^000000 - Reservation Failed!", .@md_name$);
				close;
			}
			if (instance_attachmap("1@gl_k", .@instance) == "" || instance_attachmap("2@gl_k", .@instance) == "") {
				mesf("^0000FF%s^000000 - Reservation Failed!", .@md_name$);
				instance_destroy(.@instance);
				close;
			}
			instance_set_timeout(3600, 300, .@instance);
			instance_init(.@instance);
			mes("[Hugin]");
			mes("The time gap was created. When you're ready, talk to me again.");
			close;
		case 2:
			if (has_instance("1@gl_k") == "" ) {
				mesf("The memorial dungeon ^0000FF%s^000000 does not exist.\r"
						"The party leader did not generate the dungeon yet.", .@md_name$);
				close;
			}
			mapannounce("glast_01", sprintf(_$("%s, member of the party %s entered the instance %s."), strcharinfo(PC_NAME), .@p_name$, .@md_name$), bc_map, C_SPRINGGREEN);
			setquest 12317;
			warp "1@gl_k", 150, 20;
			end;
		case 3:
			close;
		}
	} else if (questprogress(12317, PLAYTIME) == 1) {
		mes("[Hugin]");
		mes("Oh, my... You still have after-effects of time travel. You can't travel in this condition.");
			if (questprogress(12322) == 1) {
				erasequest 12322;
			}
		next;
		mes("[Hugin]");
		mes("Staying healthy is important so please take a break and come back again later.");
		close;
	} else {
		mes("^0000FFAll trace of access to Old Glast Heim have been removed. Now you can talk with Hugin again.^000000");
		erasequest 12317;
		if (questprogress(12318))
			erasequest 12318;
		if (questprogress(12319))
			erasequest 12319;
		close;
	}
}

// Floor 1
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1@gl_k,149,41,6	script	Varmundt#ghinstance1	4_M_BARMUND,{
	if (getcharid(CHAR_ID_CHAR) != getpartyleader(getcharid(CHAR_ID_PARTY), 2)) {
		cutin("gl_barmund2", 2);
		mes("[Varmundt]");
		mes("Where's your leader? I need his help.");
		close2;
		cutin("gl_barmund2", 255);
		end;
	}
	cutin("gl_barmund1", 2);
	mes("[Varmundt]");
	mes("Are you the one ^0000FFHerico^000000 sent to help me?");
	npctalk(_("Are you the one Herico sent to help me?"));
	next;
	select("Oh. Well I...");
	mesf("[%s]", strcharinfo(PC_NAME));
	mes("Ah yes, I am. Herico told me to meet you.");
	unittalk(getcharid(CHAR_ID_ACCOUNT), _("Ah yes, I am. Herico told me to meet you."));
	next;
	cutin("gl_barmund2", 2);
	mes("[Varmundt]");
	mes("We don't have much time. We must report to Sir. Heinrich about Himelmez's invasion.");
	npctalk(_("We don't have much time. We must report to Sir. Heinrich about Himelmez's invasion."));
	next;
	select("Himelmez...");
	mesf("[%s]", strcharinfo(PC_NAME));
	mes("Who is Himelmez?");
	unittalk(getcharid(CHAR_ID_ACCOUNT), _("Who is Himelmez?"));
	next;
	cutin("gl_barmund3", 2);
	mes("[Varmundt]");
	mes("Herico didn't tell you?");
	npctalk(_("Herico didn't tell you?"));
	next;
	cutin("gl_barmund2", 2);
	mes("[Varmundt]");
	mes("She is the Ruler of Death, Dead man's Valkyrie. Himelmez is looking to take the heart of Ymir from us.");
	npctalk(_("She is the Ruler of Death, Dead man's Valkyrie. Himelmez is looking to take the heart of Ymir from us."));
	next;
	mes("[Varmundt]");
	mes("She might even destroy this whole castle if she wanted to.");
	npctalk(_("She might even destroy this whole castle if she wanted to."));
	next;
	mes("[Varmundt]");
	mes("Hurry! Report to Sir. Heinrich about Himelmez. I must check the defense barrier here!");
	npctalk(_("Hurry! Report to Sir. Heinrich about Himelmez. I must check the defense barrier here!"));
	close2;
	cutin("gl_barmund2", 255);
	donpcevent(instance_npcname("Varmundt#ghinstance1")+"::OnDisable");
	end;

OnInstanceInit:
	donpcevent instance_npcname("Varmundt#ghinstance1")+"::OnEnable";
	end;

OnDisable:
	hideonnpc instance_npcname("Varmundt#ghinstance1");
	hideoffnpc instance_npcname("Heinrich#ghinstance1");
	hideoffnpc instance_npcname("Varmundt#ghinstance2");
	end;

OnEnable:
	hideoffnpc instance_npcname("Varmundt#ghinstance1");
	end;
}

1@gl_k,145,54,6	script	Khalitzburg Knight#1	4_F_KHALITZBURG,{
	mesf("[%s]", strnpcinfo(NPC_NAME_VISIBLE));
	switch ((atoi(strnpcinfo(NPC_NAME_HIDDEN)) + 1) / 2) {
		case 1: mes("Is there something you need?"); break;
		case 2: mes("What can I do for you?"); break;
		case 3: mes("..."); break;
		case 4: mes("I do not like to chat during work."); break;
		case 5: mes("Doesn't this castle seem weird all of a sudden? Something's not quite right."); break;
		case 6: mes("How do you know Varmundt? I heard that he's not really a friendly man..."); break;
		case 7: mes("Orders please."); break;
		case 8: mes("Please do not make a mess here."); break;
		case 9: mes("I had a weird dream last night. My mom was in it... Wonder if she is ok..."); break;
		case 10: mes("Are you wit Varmundt? Commander is waiting for you."); break;
		case 11: mes("My work shift will be over soon, but the next crew is not coming."); break;
	}
	close;
OnDisable:
	hideonnpc instance_npcname(strnpcinfo(NPC_NAME));
	end;
OnEnable:
	hideoffnpc instance_npcname(strnpcinfo(NPC_NAME));
	end;
}

1@gl_k,154,54,3	duplicate(Khalitzburg Knight#1)	Khalitzburg Knight#2	4_F_KHALITZBURG
1@gl_k,145,59,6	duplicate(Khalitzburg Knight#1)	White Knight#3	4_WHITEKNIGHT
1@gl_k,154,59,3	duplicate(Khalitzburg Knight#1)	White Knight#4	4_WHITEKNIGHT
1@gl_k,145,64,6	duplicate(Khalitzburg Knight#1)	Khalitzburg Knight#5	4_F_KHALITZBURG
1@gl_k,154,64,3	duplicate(Khalitzburg Knight#1)	Khalitzburg Knight#6	4_F_KHALITZBURG
1@gl_k,145,69,6	duplicate(Khalitzburg Knight#1)	White Knight#7	4_WHITEKNIGHT
1@gl_k,154,69,3	duplicate(Khalitzburg Knight#1)	White Knight#8	4_WHITEKNIGHT
1@gl_k,145,74,6	duplicate(Khalitzburg Knight#1)	Khalitzburg Knight#9	4_F_KHALITZBURG
1@gl_k,154,74,3	duplicate(Khalitzburg Knight#1)	Khalitzburg Knight#10	4_F_KHALITZBURG
1@gl_k,145,79,6	duplicate(Khalitzburg Knight#1)	White Knight#11	4_WHITEKNIGHT
1@gl_k,154,79,3	duplicate(Khalitzburg Knight#1)	White Knight#12	4_WHITEKNIGHT
1@gl_k,145,84,6	duplicate(Khalitzburg Knight#1)	Khalitzburg Knight#13	4_F_KHALITZBURG
1@gl_k,154,84,3	duplicate(Khalitzburg Knight#1)	Khalitzburg Knight#14	4_F_KHALITZBURG
1@gl_k,145,89,6	duplicate(Khalitzburg Knight#1)	White Knight#15	4_WHITEKNIGHT
1@gl_k,154,89,3	duplicate(Khalitzburg Knight#1)	White Knight#16	4_WHITEKNIGHT
1@gl_k,145,94,6	duplicate(Khalitzburg Knight#1)	Khalitzburg Knight#17	4_F_KHALITZBURG
1@gl_k,154,94,3	duplicate(Khalitzburg Knight#1)	Khalitzburg Knight#18	4_F_KHALITZBURG
1@gl_k,145,99,6	duplicate(Khalitzburg Knight#1)	White Knight#19	4_WHITEKNIGHT
1@gl_k,154,99,3	duplicate(Khalitzburg Knight#1)	White Knight#20	4_WHITEKNIGHT
1@gl_k,145,104,6	duplicate(Khalitzburg Knight#1)	Khalitzburg Knight#21	4_F_KHALITZBURG
1@gl_k,154,104,3	duplicate(Khalitzburg Knight#1)	Khalitzburg Knight#22	4_F_KHALITZBURG

1@gl_k,149,100,6	script	Heinrich#ghinstance1	4_M_HEINRICH,{
	if (getcharid(CHAR_ID_CHAR) != getpartyleader(getcharid(CHAR_ID_PARTY), 2)) {
		cutin("gl_heinrich2", 2);
		mes("[Heinrich]");
		mes("Where is your leader? I must talk to him.");
		close2;
		cutin("gl_heinrich2", 255);
		end;
	}
	cutin("gl_heinrich2", 2);
	select("Sir. Heinrich. Varmundt...");
	mesf("[%s]", strcharinfo(PC_NAME));
	mes("Sir. Heinrich. Do you know what is happening in the castle now?");
	unittalk(getcharid(CHAR_ID_ACCOUNT), _("Sir. Heinrich. Do you know what is happening in the castle now?"));
	next;
	mes("[Heinrich]");
	mes("Aren't you the adventurer that came along with Varmundt?");
	npctalk(_("Aren't you the adventurer that came along with Varmundt?"));
	next;
	mes("[Heinrich]");
	mes("What is it? Something wrong with the castle?");
	npctalk(_("What is it? Something wrong with the castle?"));
	next;
	select("Himelmez's invasion...");
	mesf("[%s]", strcharinfo(PC_NAME));
	mes("Dead man's Valkyrie, Himelmez is coming to take the Ymir's Heart piece hidden inside this castle!");
	unittalk(getcharid(CHAR_ID_ACCOUNT), _("Dead man's Valkyrie, Himelmez is coming to take the Ymir's Heart piece hidden inside this castle!"));
	next;
	cutin("gl_heinrich1", 2);
	mes("[Heinrich]");
	mes("Haha. Funny. Do you really think that is possible?");
	npctalk(_("Haha. Funny. Do you really think that is possible?"));
	next;
	cutin("gl_barmund2", 2);
	mes("[Varmundt]");
	mes("I'm not kidding, Sir. Heinrich. If I'm correct, then she will be here very soon.");
	npctalk(_("I'm not kidding, Sir. Heinrich. If I'm correct, then she will be here very soon."), instance_npcname("Varmundt#ghinstance2"));
	next;
	mes("[Varmundt]");
	mes("We must hide the heart piece to a safe place before Himelmez's attack starts!");
	npctalk(_("We must hide the heart piece to a safe place before Himelmez's attack starts!"), instance_npcname("Varmundt#ghinstance2"));
	next;
	select("Even if you don't believe me...");
	mesf("[%s]", strcharinfo(PC_NAME));
	mes("I can't make you believe me, but there's no time to argue!");
	unittalk(getcharid(CHAR_ID_ACCOUNT), _("I can't make you believe me, but there's no time to argue!"));
	cutin("gl_barmund2", 255);
	next;
	cutin("gl_heinrich1", 2);
	mes("[Heinrich]");
	mes("Thank you for the help. But, we don't even have our king with us right now.");
	npctalk(_("Thank you for the help. But, we don't even have our king with us right now."));
	next;
	mes("[Heinrich]");
	mes("We cannot risk moving the heart just because some stranger says so.");
	npctalk(_("We cannot risk moving the heart just because some stranger says so."));
	close2;
	donpcevent(instance_npcname("Heinrich#ghinstance1")+"::OnDisable");
	donpcevent(instance_npcname("Heinrich#ghinstance2")+"::OnEnable");
	donpcevent(instance_npcname("Himelmez#ghinstance1")+"::OnEnable");
	donpcevent(instance_npcname("#talkinstance1")+"::OnEnable");
	mapannounce(instance_mapname("1@gl_k"), _("????: Muahahahaha~!"), bc_map, C_YELLOW, FW_NORMAL, 18);
	cutin("gl_heinrich1", 255);
	end;

OnInstanceInit:
OnDisable:
	hideonnpc instance_npcname("Heinrich#ghinstance1");
	end;

OnEnable:
	hideoffnpc instance_npcname("Heinrich#ghinstance1");
	end;
}

1@gl_k,152,97,3	script	Varmundt#ghinstance2	4_M_BARMUND,{
	end;

OnInstanceInit:
OnDisable:
	hideonnpc instance_npcname("Varmundt#ghinstance2");
	end;

OnEnable:
	hideoffnpc instance_npcname("Varmundt#ghinstance2");
	end;
}

1@gl_k,149,97,6	script	Heinrich#ghinstance2	4_M_HEINRICH,{
	end;

OnInstanceInit:
OnDisable:
	hideonnpc instance_npcname("Heinrich#ghinstance2");
	end;

OnEnable:
	hideoffnpc instance_npcname("Heinrich#ghinstance2");
	end;
}

1@gl_k,149,100,6	script	Heinrich#ghinstance3	4_M_HEINRICH,{
	end;

OnInstanceInit:
OnDisable:
	hideonnpc instance_npcname("Heinrich#ghinstance3");
	end;

OnEnable:
	hideoffnpc instance_npcname("Heinrich#ghinstance3");
	end;
}

1@gl_k,149,89,1	script	Himelmez#ghinstance1	4_F_HIMEL,{
	end;

OnInstanceInit:
OnDisable:
	hideonnpc instance_npcname("Himelmez#ghinstance1");
	end;

OnEnable:
	hideoffnpc instance_npcname("Himelmez#ghinstance1");
	end;
}

// Control Timer
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1@gl_k,0,0,0	script	#talkinstance1	FAKE_NPC,{
	end;

OnInstanceInit:
OnDisable:
	disablenpc instance_npcname("#talkinstance1");
	end;

OnEnable:
	enablenpc instance_npcname("#talkinstance1");
	initnpctimer;
	end;

OnTimer1500:
	npctalk(_("Who are you?"), instance_npcname("Heinrich#ghinstance2"));
	end;

OnTimer4500:
	npctalk(_("Well well~ Am I interrupting you? Weren't you expecting me?"), instance_npcname("Himelmez#ghinstance1"));
	end;

OnTimer10000:
	npctalk(_("Himelmez!! Already!"), instance_npcname("Varmundt#ghinstance2"));
	end;

OnTimer17500:
	npctalk(_("My name is Lisa Kahn Himelmez. Master of Dullahan, Dead man's Valkyrie, that's what they call me."), instance_npcname("Himelmez#ghinstance1"));
	end;

OnTimer22000:
	npctalk(_("Aren't you a little too feminine to be the Ruler of death? We are not afraid of you..."), instance_npcname("Heinrich#ghinstance2"));
	end;

OnTimer28500:
	npctalk(_("Let's see if you can relax like that after you find out where your king is."), instance_npcname("Himelmez#ghinstance1"));
	end;

OnTimer36000:
	npctalk(_("What?"), instance_npcname("Heinrich#ghinstance2"));
	end;

OnTimer41000:
	npctalk(_("Hmm, now I have your attention do I not?"), instance_npcname("Himelmez#ghinstance1"));
	end;

OnTimer54000:
	npctalk(_("It's a pity to meet you in a situation like this."), instance_npcname("Himelmez#ghinstance1"));
	end;

OnTimer59000:
	npctalk(_("My king is visiting the Rune-Midgarts royal family. He's not back yet."), instance_npcname("Heinrich#ghinstance2"));
	end;

OnTimer66500:
	npctalk(_("And now you are trying to trick me, what has happened to him?!"), instance_npcname("Heinrich#ghinstance2"));
	end;

OnTimer71500:
	npctalk(_("Well~ I would love to sit down and explain for you, but I'm kind of busy today~"), instance_npcname("Himelmez#ghinstance1"));
	end;

OnTimer78000:
	npctalk(_("I have business to take care of. My minions will treat you well enough for me~"), instance_npcname("Himelmez#ghinstance1"));
	end;

OnTimer84500:
	npctalk(_("She probably already knows where the Ymir's heart piece is."), instance_npcname("Heinrich#ghinstance2"));
	donpcevent instance_npcname("Himelmez#ghinstance1")+"::OnDisable";
	end;

OnTimer90500:
	npctalk(_("All Khalitzburg and White Knights should follow me now..."), instance_npcname("Heinrich#ghinstance2"));
	end;

OnTimer92000:
	for (.@i=1; .@i <= 20; .@i += 4) {
		hideonnpc instance_npcname("Khalitzburg Knight#"+.@i);
		hideonnpc instance_npcname("Khalitzburg Knight#"+(.@i+1));
		hideonnpc instance_npcname("White Knight#"+(.@i+2));
		hideonnpc instance_npcname("White Knight#"+(.@i+3));
	}
	hideonnpc instance_npcname("Khalitzburg Knight#21");
	hideonnpc instance_npcname("Khalitzburg Knight#22");
	.@map$ = instance_mapname("1@gl_k");
	.@label$ = instance_npcname("#talkinstance1")+"::OnMyMobDead";
	monster .@map$,145,59,"Abysmal Knight",2470,1,.@label$;
	monster .@map$,154,59,"Abysmal Knight",2470,1,.@label$;
	monster .@map$,145,69,"Abysmal Knight",2470,1,.@label$;
	monster .@map$,154,69,"Abysmal Knight",2470,1,.@label$;
	monster .@map$,145,79,"Abysmal Knight",2470,1,.@label$;
	monster .@map$,154,79,"Abysmal Knight",2470,1,.@label$;
	monster .@map$,145,89,"Abysmal Knight",2470,1,.@label$;
	monster .@map$,154,89,"Abysmal Knight",2470,1,.@label$;
	monster .@map$,145,99,"Abysmal Knight",2470,1,.@label$;
	monster .@map$,154,99,"Abysmal Knight",2470,1,.@label$;
	monster .@map$,145,54,"Khalitzburg",2471,1,.@label$;
	unittalk($@mobid[0], _("Water... Someone give me water..."));
	monster .@map$,154,54,"Khalitzburg",2471,1,.@label$;
	unittalk($@mobid[0], "Kkkrrrruughgh...");
	monster .@map$,145,64,"Khalitzburg",2471,1,.@label$;
	unittalk($@mobid[0], _("Sir. Heinrich. Save me..."));
	monster .@map$,154,64,"Khalitzburg",2471,1,.@label$;
	unittalk($@mobid[0], _("I miss my sister..."));
	monster .@map$,145,74,"Khalitzburg",2471,1,.@label$;
	unittalk($@mobid[0], _("Don't leave me alone, help me."));
	monster .@map$,154,74,"Khalitzburg",2471,1,.@label$;
	unittalk($@mobid[0], "Aaarrrrrhhhh");
	monster .@map$,145,84,"Khalitzburg",2471,1,.@label$;
	unittalk($@mobid[0], _("I am so thirsty."));
	monster .@map$,154,84,"Khalitzburg",2471,1,.@label$;
	unittalk($@mobid[0], _("Oh...No...I can't die yet..."));
	monster .@map$,145,94,"Khalitzburg",2471,1,.@label$;
	unittalk($@mobid[0], _("I feel sick to my stomach urrgg"));
	monster .@map$,154,94,"Khalitzburg",2471,1,.@label$;
	unittalk($@mobid[0], _("Can someone..."));
	monster .@map$,145,104,"Khalitzburg",2471,1,.@label$;
	unittalk($@mobid[0], "Arrgg... My body");
	monster .@map$,154,104,"Khalitzburg",2471,1,.@label$;
	unittalk($@mobid[0], _("My throat is burning!"));
	end;

OnTimer94000:
	npctalk(_("My men... This can't be happening!"), instance_npcname("Heinrich#ghinstance2"));
	end;

OnTimer96500:
	npctalk(_("Sir. Heinrich, they're all monsters. You need to give them rest!"), instance_npcname("Varmundt#ghinstance2"));
	end;

OnTimer100000:
	npctalk(_("I'm so sorry..."), instance_npcname("Heinrich#ghinstance2"));
	end;

OnTimer103000:
	npctalk(_("I am sorry, my knights! Forgive me!"), instance_npcname("Heinrich#ghinstance2"));
	end;

OnTimer106000:
	mapannounce(instance_mapname("1@gl_k"), _("Sir. Heinrich: Death to all!"), bc_map, C_YELLOW, FW_NORMAL, 18);
	end;

OnTimer109000:
	mapannounce(instance_mapname("1@gl_k"), _("Sir. Heinrich: Go back to the darkness!"), bc_map, C_YELLOW, FW_NORMAL, 18);
	end;

OnTimer109500:
	enablenpc instance_npcname(".#ghinstance22");
	enablenpc instance_npcname(".#ghinstance21");
	donpcevent instance_npcname(".#ghinstance22")+"::OnEffect1";
	donpcevent instance_npcname(".#ghinstance21")+"::OnEffect1";
	end;

OnTimer110000:
	enablenpc instance_npcname(".#ghinstance20");
	enablenpc instance_npcname(".#ghinstance19");
	enablenpc instance_npcname(".#ghinstance18");
	enablenpc instance_npcname(".#ghinstance17");
	donpcevent instance_npcname(".#ghinstance20")+"::OnEffect1";
	donpcevent instance_npcname(".#ghinstance19")+"::OnEffect1";
	donpcevent instance_npcname(".#ghinstance18")+"::OnEffect1";
	donpcevent instance_npcname(".#ghinstance17")+"::OnEffect1";
	end;

OnTimer110500:
	enablenpc instance_npcname(".#ghinstance16");
	enablenpc instance_npcname(".#ghinstance15");
	enablenpc instance_npcname(".#ghinstance14");
	enablenpc instance_npcname(".#ghinstance13");
	donpcevent instance_npcname(".#ghinstance16")+"::OnEffect1";
	donpcevent instance_npcname(".#ghinstance15")+"::OnEffect1";
	donpcevent instance_npcname(".#ghinstance14")+"::OnEffect1";
	donpcevent instance_npcname(".#ghinstance13")+"::OnEffect1";
	end;

OnTimer111000:
	enablenpc instance_npcname(".#ghinstance12");
	enablenpc instance_npcname(".#ghinstance11");
	enablenpc instance_npcname(".#ghinstance10");
	enablenpc instance_npcname(".#ghinstance9");
	donpcevent instance_npcname(".#ghinstance12")+"::OnEffect1";
	donpcevent instance_npcname(".#ghinstance11")+"::OnEffect1";
	donpcevent instance_npcname(".#ghinstance10")+"::OnEffect1";
	donpcevent instance_npcname(".#ghinstance9")+"::OnEffect1";
	end;

OnTimer111500:
	enablenpc instance_npcname(".#ghinstance8");
	enablenpc instance_npcname(".#ghinstance7");
	enablenpc instance_npcname(".#ghinstance6");
	enablenpc instance_npcname(".#ghinstance5");
	donpcevent instance_npcname(".#ghinstance8")+"::OnEffect1";
	donpcevent instance_npcname(".#ghinstance7")+"::OnEffect1";
	donpcevent instance_npcname(".#ghinstance6")+"::OnEffect1";
	donpcevent instance_npcname(".#ghinstance5")+"::OnEffect1";
	end;

OnTimer112000:
	enablenpc instance_npcname(".#ghinstance4");
	enablenpc instance_npcname(".#ghinstance3");
	enablenpc instance_npcname(".#ghinstance2");
	enablenpc instance_npcname(".#ghinstance1");
	donpcevent instance_npcname(".#ghinstance4")+"::OnEffect1";
	donpcevent instance_npcname(".#ghinstance3")+"::OnEffect1";
	donpcevent instance_npcname(".#ghinstance2")+"::OnEffect1";
	donpcevent instance_npcname(".#ghinstance1")+"::OnEffect1";
	donpcevent instance_npcname("Heinrich#ghinstance3")+"::OnEnable";
	donpcevent instance_npcname("Heinrich#ghinstance2")+"::OnDisable";
	for (.@i=1; .@i <= 22; .@i++)
		disablenpc instance_npcname(".#ghinstance"+.@i);
	killmonster instance_mapname("1@gl_k"),instance_npcname("#talkinstance1")+"::OnMyMobDead";
	end;

OnTimer112500:
	npctalk(_("I killed my own men..."), instance_npcname("Heinrich#ghinstance3"));
	end;

OnTimer115500:
	npctalk(_("Sir. Heinrich! We don't have much time!"), instance_npcname("Varmundt#ghinstance2"));
	end;

OnTimer118500:
	npctalk(_("If you hurry now, there's a chance!"), instance_npcname("Varmundt#ghinstance2"));
	end;

OnTimer121500:
	npctalk(_("Varmundt is right. Now is not the time for mourning."), instance_npcname("Heinrich#ghinstance3"));
	end;

OnTimer124500:
	npctalk(_("I have a request to you followers."), instance_npcname("Heinrich#ghinstance3"));
	end;

OnTimer127500:
	npctalk(_("Himelmez can turn living beings into monsters."), instance_npcname("Heinrich#ghinstance3"));
	end;

OnTimer130500:
	npctalk(_("But, there might still be survivors here."), instance_npcname("Heinrich#ghinstance3"));
	end;

OnTimer134500:
	npctalk(_("Destroy the monsters and find any survivors."), instance_npcname("Heinrich#ghinstance3"));
	end;

OnTimer138500:
	npctalk(_("Varmundt and I will chase Himelmez."), instance_npcname("Heinrich#ghinstance3"));
	end;

OnTimer143500:
	npctalk(_("Very well, Varmundt. Let's find Himelmez."), instance_npcname("Heinrich#ghinstance3"));
	end;

OnTimer147500:
	donpcevent instance_npcname("Heinrich#ghinstance3")+"::OnDisable";
	end;

OnTimer148500:
	donpcevent instance_npcname("Varmundt#ghinstance2")+"::OnDisable";
	stopnpctimer;
	donpcevent instance_npcname("#ghinstancewarp1")+"::OnEnable";
	donpcevent instance_npcname("#ghinstancewarp2")+"::OnEnable";
	mapannounce(instance_mapname("1@gl_k"), _("A portal has opened to the west."), bc_map, C_YELLOW);
	donpcevent instance_npcname("#talkinstance1")+"::OnDisable";
	donpcevent instance_npcname("#ghmemorialmob01")+"::OnEnable";
	end;

OnMyMobDead:
	end;
}

1@gl_k,145,54,6	script	.#ghinstance1	HIDDEN_NPC,{
	end;

OnInstanceInit:
OnDisable:
	disablenpc instance_npcname(strnpcinfo(NPC_NAME));
	end;

OnEnable:
	enablenpc instance_npcname(strnpcinfo(NPC_NAME));
	end;

OnEffect1:
	specialeffect EF_GRANDCROSS;
	specialeffect EF_LEXAETERNA;
	end;
}

1@gl_k,154,54,3	duplicate(.#ghinstance1)	.#ghinstance2	HIDDEN_NPC
1@gl_k,145,59,6	duplicate(.#ghinstance1)	.#ghinstance3	HIDDEN_NPC
1@gl_k,154,59,3	duplicate(.#ghinstance1)	.#ghinstance4	HIDDEN_NPC
1@gl_k,145,64,6	duplicate(.#ghinstance1)	.#ghinstance5	HIDDEN_NPC
1@gl_k,154,64,3	duplicate(.#ghinstance1)	.#ghinstance6	HIDDEN_NPC
1@gl_k,145,69,6	duplicate(.#ghinstance1)	.#ghinstance7	HIDDEN_NPC
1@gl_k,154,69,3	duplicate(.#ghinstance1)	.#ghinstance8	HIDDEN_NPC
1@gl_k,145,74,6	duplicate(.#ghinstance1)	.#ghinstance9	HIDDEN_NPC
1@gl_k,154,74,3	duplicate(.#ghinstance1)	.#ghinstance10	HIDDEN_NPC
1@gl_k,145,79,6	duplicate(.#ghinstance1)	.#ghinstance11	HIDDEN_NPC
1@gl_k,154,79,3	duplicate(.#ghinstance1)	.#ghinstance12	HIDDEN_NPC
1@gl_k,145,84,6	duplicate(.#ghinstance1)	.#ghinstance13	HIDDEN_NPC
1@gl_k,154,84,3	duplicate(.#ghinstance1)	.#ghinstance14	HIDDEN_NPC
1@gl_k,145,89,6	duplicate(.#ghinstance1)	.#ghinstance15	HIDDEN_NPC
1@gl_k,154,89,3	duplicate(.#ghinstance1)	.#ghinstance16	HIDDEN_NPC
1@gl_k,145,94,6	duplicate(.#ghinstance1)	.#ghinstance17	HIDDEN_NPC
1@gl_k,154,94,3	duplicate(.#ghinstance1)	.#ghinstance18	HIDDEN_NPC
1@gl_k,145,99,6	duplicate(.#ghinstance1)	.#ghinstance19	HIDDEN_NPC
1@gl_k,154,99,3	duplicate(.#ghinstance1)	.#ghinstance20	HIDDEN_NPC
1@gl_k,145,104,6	duplicate(.#ghinstance1)	.#ghinstance21	HIDDEN_NPC
1@gl_k,154,104,3	duplicate(.#ghinstance1)	.#ghinstance22	HIDDEN_NPC
1@gl_k,149,200,3	warp	treasureroom#out	1,1,1@gl_k,269,264

1@gl_k,96,80,0	script	#ghinstancewarp1	WARPNPC,1,2,{
	end;

OnInstanceInit:
OnDisable:
	disablenpc instance_npcname(strnpcinfo(NPC_NAME));
	end;

OnEnable:
	enablenpc instance_npcname(strnpcinfo(NPC_NAME));
	end;

OnTouch:
	.@map1$ = instance_mapname("1@gl_k");
	.@map2$ = instance_mapname("2@gl_k");
	switch (atoi(replacestr(strnpcinfo(NPC_NAME_HIDDEN), "ghinstancewarp", ""))) {
		case 1: warp .@map1$,80,80; break;
		case 2: warp .@map1$,105,80; break;
		case 3: warp .@map1$,215,79; break;
		case 4: warp .@map1$,195,79; break;
		case 5: warp .@map1$,215,216; break;
		case 6: warp .@map1$,235,216; break;
		case 7: warp .@map2$,150,46; break;
		case 8: warp .@map2$,126,123; break;
		case 9: warp .@map2$,150,116; break;
		case 10: warp .@map2$,174,101; break;
		case 11: warp .@map2$,150,110; break;
		case 12: warp .@map2$,150,179; break;
		case 13: warp .@map2$,150,160; break;
		case 14: warp .@map1$,150,281; break;
		case 15: warp .@map1$,48,168; break;
	}
	end;
}

1@gl_k,90,80,0	duplicate(#ghinstancewarp1)	#ghinstancewarp2	WARPNPC,2,2
1@gl_k,202,79,0	duplicate(#ghinstancewarp1)	#ghinstancewarp3	WARPNPC,2,2
1@gl_k,206,79,0	duplicate(#ghinstancewarp1)	#ghinstancewarp4	WARPNPC,2,2
1@gl_k,228,216,0	duplicate(#ghinstancewarp1)	#ghinstancewarp5	WARPNPC,2,2
1@gl_k,222,216,0	duplicate(#ghinstancewarp1)	#ghinstancewarp6	WARPNPC,2,2
1@gl_k,150,284,0	duplicate(#ghinstancewarp1)	#ghinstancewarp7	WARPNPC,2,2
2@gl_k,145,123,0	duplicate(#ghinstancewarp1)	#ghinstancewarp8	WARPNPC,2,2
2@gl_k,136,122,0	duplicate(#ghinstancewarp1)	#ghinstancewarp9	WARPNPC,2,2
2@gl_k,154,101,0	duplicate(#ghinstancewarp1)	#ghinstancewarp10	WARPNPC,2,2
2@gl_k,165,101,0	duplicate(#ghinstancewarp1)	#ghinstancewarp11	WARPNPC,2,2
2@gl_k,150,163,0	duplicate(#ghinstancewarp1)	#ghinstancewarp12	WARPNPC,2,2
2@gl_k,150,167,0	duplicate(#ghinstancewarp1)	#ghinstancewarp13	WARPNPC,2,2
2@gl_k,150,32,0	duplicate(#ghinstancewarp1)	#ghinstancewarp14	WARPNPC,2,2
1@gl_k,69,168,0	duplicate(#ghinstancewarp1)	#ghinstancewarp15	WARPNPC,2,2

// Sector 1 Mobs
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1@gl_k,0,0,0	script	#ghmemorialmob01	FAKE_NPC,{
	end;

OnInstanceInit:
OnDisable:
	disablenpc instance_npcname("#ghmemorialmob01");
	end;

OnEnable:
	enablenpc instance_npcname("#ghmemorialmob01");
	.@map$ = instance_mapname("1@gl_k");
	.@label$ = instance_npcname("#ghmemorialmob01")+"::OnMyMobDead";
	areamonster(.@map$, 76, 99, 87, 10, _("Grand Chamberlain in pain"), MG_GHOUL, 15, .@label$);
	areamonster(.@map$, 67, 39, 12, 6, _("Corrupted Monk"), MG_WRAITH, 20, .@label$);
	areamonster(.@map$, 67, 39, 12, 6, _("Grand Chamberlain in pain"), MG_GHOUL, 3, .@label$);
	areamonster(.@map$, 32, 75, 51, 58, _("Corrupted Steward"), MG_ZOMBIE, 6, .@label$);
	areamonster(.@map$, 45, 84, 6, 137, _("Corrupted Steward"), MG_ZOMBIE, 12, .@label$);
	end;

OnMyMobDead:
	.@map$ = instance_mapname("1@gl_k");
	.@label$ = instance_npcname("#ghmemorialmob01")+"::OnMyMobDead";
	.@mob_dead_num = 56 - mobcount(.@map$,.@label$);
	if (.@mob_dead_num > 35) {
		mapannounce(.@map$, _("Himelmez's curse is getting weaker. Find any survivors!"), bc_map, C_WHITE);
		killmonster .@map$,.@label$;
		donpcevent instance_npcname("Altar boy Domun#clearGH")+"::OnEnable";
		donpcevent instance_npcname("#ghmemorialmob01")+"::OnDisable";
	}
	end;
}

1@gl_k,17,51,3	script	Altar boy Domun#clearGH	4_M_KID1,{
	if (getcharid(CHAR_ID_CHAR) != getpartyleader(getcharid(CHAR_ID_PARTY), 2)) {
		mes("[Altar boy Domun]");
		mes("Save me, save me, please...");
		close;
	}
	mes("[Altar boy Domun]");
	mes("Save me! Save me!!!");
	npctalk(_("Save me! Save me!!!"));
	next;
	select("Hold on!Are you the only survivor?");
	mesf("[%s]", strcharinfo(PC_NAME));
	mes("Hold on!\r"
		"Are you the only survivor?");
	unittalk(getcharid(CHAR_ID_ACCOUNT), _("Hold on! Are you the only survivor?"));
	next;
	mes("[Altar boy Domun]");
	mes("Chamberlains... monks...\r"
		"They all turned into monsters. I couldn't do anything.");
	npctalk(_("Altar boy Domun : Chamberlains... monks... They all turned into monsters. I couldn't do anything."));
	next;
	mes("[Altar boy Domun]");
	mes("All I could do was... \r"
		"Just hide in here...\r"
		"Nothing, nothing I could do...");
	npctalk(_("Altar boy Domun : All I could do was... Just hide in here... Nothing, nothing I could do..."));
	next;
	select("Pull it together!");
	mesf("[%s]", strcharinfo(PC_NAME));
	mes("Wake up kid! Go east and find the middle passage to the outside! That is safe!");
	unittalk(getcharid(CHAR_ID_ACCOUNT), _("Wake up kid! Go east and find the middle passage to the outside! That is safe!")); // Displays 1st Letter of char name in small?
	next;
	mes("[Altar boy Domun]");
	mes("To the east passage?\r"
		"Alone?\r"
		"How?");
	npctalk(_("Altar boy Domun : To the east passage? Alone? How?"));
	next;
	select("I will give you a weapon.");
	mesf("[%s]", strcharinfo(PC_NAME));
	mes("Here's a weapon. Just close your eye and swing for those monsters.");
	unittalk(getcharid(CHAR_ID_ACCOUNT), _("Here's a weapon. Just close your eye and swing for those monsters."));
	next;
	mes("[Altar boy Domun]");
	mes("Ok, I... I'l try.");
	npctalk(_("Altar boy Domun : Ok, I... I'l try."));
	close2;
	donpcevent instance_npcname("Altar boy Domun#clearGH")+"::OnDisable";
	donpcevent instance_npcname("#ghmemorialmob02")+"::OnEnable";
	end;

OnInstanceInit:
OnDisable:
	hideonnpc instance_npcname("Altar boy Domun#clearGH");
	end;

OnEnable:
	hideoffnpc instance_npcname("Altar boy Domun#clearGH");
	end;
}

// Sector 2 Mobs
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1@gl_k,0,0,0	script	#ghmemorialmob02	FAKE_NPC,{
	end;

OnInstanceInit:
OnDisable:
	disablenpc instance_npcname("#ghmemorialmob02");
	end;

OnEnable:
	enablenpc instance_npcname("#ghmemorialmob02");
	donpcevent instance_npcname("#ghinstancewarp3")+"::OnEnable";
	donpcevent instance_npcname("#ghinstancewarp4")+"::OnEnable";
	.@map$ = instance_mapname("1@gl_k");
	.@label$ = instance_npcname("#ghmemorialmob02")+"::OnMyMobDead";
	mapannounce(.@map$, _("A portal has opened to the east."), bc_map, C_YELLOW);
	areamonster(.@map$, 241, 113, 291, 19, _("Outraged Refiner"), MG_GHOUL, 12, .@label$);
	areamonster(.@map$, 241, 113, 291, 19, _("Decomposed Blacksmith"), MG_ZOMBIE, 12, .@label$);
	areamonster(.@map$, 227, 217, 291, 135, _("Outraged Refiner"), MG_GHOUL, 12, .@label$);
	areamonster(.@map$, 227, 217, 291, 135, _("Decomposed Blacksmith"), MG_ZOMBIE, 12, .@label$);
	end;

OnMyMobDead:
	.@map$ = instance_mapname("1@gl_k");
	.@label$ = instance_npcname("#ghmemorialmob02")+"::OnMyMobDead";
	.@mob_dead_num = 48 - mobcount(.@map$,.@label$);
	if (.@mob_dead_num > 28) {
		mapannounce(.@map$, _("Himelmez's curse is getting weaker. Find any survivors!"), bc_map, C_WHITE);
		killmonster .@map$,.@label$;
		donpcevent instance_npcname("Holgren the Destroyer")+"::OnEnable";
		donpcevent instance_npcname("#ghmemorialmob02")+"::OnDisable";
	}
	end;
}

1@gl_k,291,145,3	script	Holgren the Destroyer	4_F_JOB_BLACKSMITH,{
	if (getcharid(CHAR_ID_CHAR) != getpartyleader(getcharid(CHAR_ID_PARTY), 2)) {
		mes("[Holgren the Destroyer]");
		mes("Are you human?");
		close;
	}
	mes("[Holgren the Destroyer]");
	mes("Die!! You shall die!!!");
	npctalk(_("Holgren the Destroyer : Die!! You shall die!!!"));
	specialeffect EF_CRASHEARTH;
	next;
	select("Relax! I'm not a monster!");
	mesf("[%s]", strcharinfo(PC_NAME));
	mes("Relax! I am Human. Are you alone? Anyone else here?");
	unittalk(getcharid(CHAR_ID_ACCOUNT), _("Relax! I am Human. Are you alone? Anyone else here?"));
	next;
	mes("[Holgren the Destroyer]");
	mes("It's only me alive.");
	npctalk(_("Holgren the Destroyer : It's only me alive."));
	next;
	select("It's dangerous here...");
	mesf("[%s]", strcharinfo(PC_NAME));
	mes("It's dangerous here. You know the way to the middle passage? Can you move?");
	unittalk(getcharid(CHAR_ID_ACCOUNT), _("It's dangerous here. You know the way to the middle passage? Can you move?")); // Displays 1st Letter of char name in small?
	next;
	mes("[Holgren the Destroyer]");
	mes("Yes, I can move. I need to get out of here.");
	npctalk(_("Holgren the Destroyer : Yes, I can move. I need to get out of here."));
	next;
	select("Be safe...");
	mesf("[%s]", strcharinfo(PC_NAME));
	mes("Sorry, I can't go with you.");
	unittalk(getcharid(CHAR_ID_ACCOUNT), _("Sorry, I can't go with you."));
	next;
	mes("[Holgren the Destroyer]");
	mes("It's ok. You've already done enough. I can help myself. Good luck to you too.");
	npctalk(_("Holgren the Destroyer : It's ok. You've already done enough. I can help myself. Good luck to you too."));
	close2;
	donpcevent instance_npcname("Holgren the Destroyer")+"::OnDisable";
	donpcevent instance_npcname("#ghmemorialmob03")+"::OnEnable";
	end;

OnInstanceInit:
OnDisable:
	hideonnpc instance_npcname("Holgren the Destroyer");
	end;

OnEnable:
	hideoffnpc instance_npcname("Holgren the Destroyer");
	end;
}

// Tramp Mobs
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1@gl_k,221,82,3	script	A dead man#GHtramp1	4_M_DIEMAN,4,4,{
	end;

OnTouch:
	.@i = rand(1,10);
	if (.@i == 1) .@mobs = 3;
	else if (.@i == 2) .@mobs = 4;
	else if (.@i == 3) .@mobs = 5;
	else if (.@i < 7) .@mobs = 6;
	else .@mobs = 7;
	getmapxy(.@map$, .@x, .@y, UNITTYPE_NPC);
	specialeffect EF_VENOMDUST;
	monster(.@map$, .@x, .@y, "Maggot", MG_ARCLOUSE, .@mobs, instance_npcname(strnpcinfo(NPC_NAME))+"::OnMyMobDead");
	disablenpc instance_npcname(strnpcinfo(NPC_NAME));
	end;

OnMyMobDead:
	end;

OnInstanceInit:
OnEnable:
	enablenpc instance_npcname(strnpcinfo(NPC_NAME));
	end;

OnDisable:
	disablenpc instance_npcname(strnpcinfo(NPC_NAME));
	end;
}

1@gl_k,213,63,7	duplicate(A dead man#GHtramp1)	A dead man#GHtramp2	4_M_DIEMAN,4,4
1@gl_k,230,50,2	duplicate(A dead man#GHtramp1)	A dead man#GHtramp3	4_M_DIEMAN,4,4
1@gl_k,222,39,2	duplicate(A dead man#GHtramp1)	A dead man#GHtramp4	4_M_DIEMAN,4,4
1@gl_k,214,27,3	duplicate(A dead man#GHtramp1)	A dead man#GHtramp5	4_M_DIEMAN,4,4
1@gl_k,223,17,2	duplicate(A dead man#GHtramp1)	A dead man#GHtramp6	4_M_DIEMAN,4,4
1@gl_k,235,16,4	duplicate(A dead man#GHtramp1)	A dead man#GHtramp7	4_M_DIEMAN,4,4
1@gl_k,251,20,5	duplicate(A dead man#GHtramp1)	A dead man#GHtramp8	4_M_DIEMAN,4,4
1@gl_k,240,43,7	duplicate(A dead man#GHtramp1)	A dead man#GHtramp9	4_M_DIEMAN,4,4
1@gl_k,271,19,1	duplicate(A dead man#GHtramp1)	A dead man#GHtramp10	4_M_DIEMAN,4,4
1@gl_k,246,62,7	duplicate(A dead man#GHtramp1)	A dead man#GHtramp11	4_M_DIEMAN,4,4
1@gl_k,282,48,5	duplicate(A dead man#GHtramp1)	A dead man#GHtramp12	4_M_DIEMAN,4,4
1@gl_k,285,81,7	duplicate(A dead man#GHtramp1)	A dead man#GHtramp13	4_M_DIEMAN,4,4
1@gl_k,241,86,5	duplicate(A dead man#GHtramp1)	A dead man#GHtramp14	4_M_DIEMAN,4,4
1@gl_k,249,101,3	duplicate(A dead man#GHtramp1)	A dead man#GHtramp15	4_M_DIEMAN,4,4
1@gl_k,276,106,7	duplicate(A dead man#GHtramp1)	A dead man#GHtramp16	4_M_DIEMAN,4,4
1@gl_k,252,120,7	duplicate(A dead man#GHtramp1)	A dead man#GHtramp17	4_M_DIEMAN,4,4
1@gl_k,258,150,1	duplicate(A dead man#GHtramp1)	A dead man#GHtramp18	4_M_DIEMAN,4,4
1@gl_k,255,157,6	duplicate(A dead man#GHtramp1)	A dead man#GHtramp19	4_M_DIEMAN,4,4
1@gl_k,261,164,7	duplicate(A dead man#GHtramp1)	A dead man#GHtramp20	4_M_DIEMAN,4,4
1@gl_k,269,173,7	duplicate(A dead man#GHtramp1)	A dead man#GHtramp21	4_M_DIEMAN,4,4
1@gl_k,280,167,3	duplicate(A dead man#GHtramp1)	A dead man#GHtramp22	4_M_DIEMAN,4,4
1@gl_k,293,161,3	duplicate(A dead man#GHtramp1)	A dead man#GHtramp23	4_M_DIEMAN,4,4
1@gl_k,226,96,3	duplicate(A dead man#GHtramp1)	A dead man#GHtramp24	4_M_DIEMAN,4,4
1@gl_k,222,119,5	duplicate(A dead man#GHtramp1)	A dead man#GHtramp25	4_M_DIEMAN,4,4
1@gl_k,233,123,3	duplicate(A dead man#GHtramp1)	A dead man#GHtramp26	4_M_DIEMAN,4,4
2@gl_k,147,203,5	duplicate(A dead man#GHtramp1)	A dead man#GHtramp27	4_M_DIEMAN,4,4
2@gl_k,141,222,3	duplicate(A dead man#GHtramp1)	A dead man#GHtramp28	4_M_DIEMAN,4,4
2@gl_k,167,225,5	duplicate(A dead man#GHtramp1)	A dead man#GHtramp29	4_M_DIEMAN,4,4
2@gl_k,145,236,5	duplicate(A dead man#GHtramp1)	A dead man#GHtramp30	4_M_DIEMAN,4,4
2@gl_k,143,260,3	duplicate(A dead man#GHtramp1)	A dead man#GHtramp31	4_M_DIEMAN,4,4
2@gl_k,170,259,3	duplicate(A dead man#GHtramp1)	A dead man#GHtramp32	4_M_DIEMAN,4,4
2@gl_k,143,197,5	duplicate(A dead man#GHtramp1)	A dead man#GHtramp33	4_M_DIEMAN,4,4
2@gl_k,155,195,5	duplicate(A dead man#GHtramp1)	A dead man#GHtramp34	4_M_DIEMAN,4,4
2@gl_k,154,188,3	duplicate(A dead man#GHtramp1)	A dead man#GHtramp35	4_M_DIEMAN,4,4
2@gl_k,153,214,3	duplicate(A dead man#GHtramp1)	A dead man#GHtramp36	4_M_DIEMAN,4,4
2@gl_k,172,233,3	duplicate(A dead man#GHtramp1)	A dead man#GHtramp37	4_M_DIEMAN,4,4
2@gl_k,176,245,3	duplicate(A dead man#GHtramp1)	A dead man#GHtramp38	4_M_DIEMAN,4,4

// Sector 3 Mobs
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1@gl_k,0,0,0	script	#ghmemorialmob03	FAKE_NPC,{
	end;

OnInstanceInit:
OnDisable:
	disablenpc instance_npcname("#ghmemorialmob03");
	end;

OnEnable:
	enablenpc instance_npcname("#ghmemorialmob03");
	donpcevent instance_npcname("#ghinstancewarp5")+"::OnEnable";
	donpcevent instance_npcname("#ghinstancewarp6")+"::OnEnable";
	.@map$ = instance_mapname("1@gl_k");
	.@label$ = instance_npcname("#ghmemorialmob03")+"::OnMyMobDead";
	mapannounce(.@map$, _("A portal has appeared to the northwest."), bc_map, C_YELLOW);
	areamonster(.@map$, 17, 259, 53, 180, _("Hungry Palace Guard"), MG_RAYDRIC, 11, .@label$);
	areamonster(.@map$, 17, 259, 53, 180, _("Outraged Archer"), MG_RAYDRIC_ARCHER, 14, .@label$);
	areamonster(.@map$, 62, 281, 73, 186, _("Hungry Palace Guard"), MG_RAYDRIC, 11, .@label$);
	areamonster(.@map$, 62, 281, 73, 186, _("Outraged Archer"), MG_RAYDRIC_ARCHER, 14, .@label$);
	areamonster(.@map$, 74, 251, 109, 224, _("Corrupted Palace Guard"), MG_RAYDRIC, 11, .@label$);
	areamonster(.@map$, 74, 251, 109, 224, _("Wandering Archer"), MG_RAYDRIC_ARCHER, 14, .@label$);
	areamonster(.@map$, 108, 281, 231, 234, _("Corrupted Palace Guard"), MG_RAYDRIC, 11, .@label$);
	areamonster(.@map$, 108, 281, 231, 234, _("Wandering Archer"), MG_RAYDRIC_ARCHER, 14, .@label$);
	end;

OnMyMobDead:
	.@map$ = instance_mapname("1@gl_k");
	.@label$ = instance_npcname("#ghmemorialmob03")+"::OnMyMobDead";
	.@mob_dead_num = 100 - mobcount(.@map$,.@label$);
	if (.@mob_dead_num > 85) {
		mapannounce(.@map$, _("Himelmez: Not bad. Thought you would be dead by now by my creatures~"), bc_map, C_WHITE);
		killmonster .@map$,.@label$;
		donpcevent instance_npcname("#GHMclear3")+"::OnEnable";
		donpcevent instance_npcname("Heinrich#ghinstance4")+"::OnEnable";
		donpcevent instance_npcname("Himelmez#ghinstance2")+"::OnEnable";
		donpcevent instance_npcname("Varmundt#ghinstance3")+"::OnEnable";
		donpcevent instance_npcname("#ghmemorialmob03")+"::OnDisable";
	}
	end;
}

// 1st MVP
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1@gl_k,0,0,0	script	#ghmemorialmob04	FAKE_NPC,{
	end;

OnInstanceInit:
OnDisable:
	disablenpc instance_npcname("#ghmemorialmob04");
	end;

OnEnable:
	enablenpc instance_npcname("#ghmemorialmob04");
	monster instance_mapname("1@gl_k"), 150, 258, _("Corrupted Soul"), MG_CORRUPTION_ROOT, 1, instance_npcname("#ghmemorialmob04")+"::OnMyMobDead";
	unittalk($@mobid[0], _("Grrrrrrhh~~~"));
	end;

OnMyMobDead:
	.@map$ = instance_mapname("1@gl_k");
	if (mobcount(.@map$,instance_npcname("#ghmemorialmob04")+"::OnMyMobDead") < 1) {
		mapannounce(.@map$, _("Opening 2nd floor entrance towards 12 O'clock direction."), bc_map, C_YELLOW);
		donpcevent instance_npcname("#ghinstancewarp7")+"::OnEnable";
		donpcevent instance_npcname("#ghinstancewarp14")+"::OnEnable";
		npctalk(_("I collected some items dropped from its body. You can take it from me."), instance_npcname("Varmundt#ghinstance3"));
		donpcevent instance_npcname("#effectGH01")+"::OnEnable";
		donpcevent instance_npcname("Heinrich#ghinstance5")+"::OnEnable";
		donpcevent instance_npcname("Varmundt#ghinstance4")+"::OnEnable";
		donpcevent instance_npcname("#ghmemorialmob04")+"::OnDisable";
	}
	end;
}

1@gl_k,150,257,3	script	#GHMclear3	HIDDEN_NPC,9,9,{
	end;

OnTouch:
	donpcevent instance_npcname("#controlGH3")+"::OnEnable";
	specialeffect EF_BASH;
	donpcevent instance_npcname("#GHMclear3")+"::OnDisable";
	end;

OnInstanceInit:
OnDisable:
	disablenpc instance_npcname("#GHMclear3");
	end;

OnEnable:
	enablenpc instance_npcname("#GHMclear3");
	initnpctimer;
	end;

OnTimer2000:
	mapannounce(instance_mapname("1@gl_k"), _("Himelmez: I'll wait for you at the north of the castle. I want to see you how lucky you are."), bc_map, C_WHITE);
	stopnpctimer;
	end;
}

1@gl_k,0,0,0	script	#controlGH3	FAKE_NPC,{
	end;

OnInstanceInit:
OnDisable:
	disablenpc instance_npcname("#controlGH3");
	end;

OnEnable:
	enablenpc instance_npcname("#controlGH3");
	initnpctimer;
	end;

OnTimer3000:
	npctalk(_("Guess you are either lucky or powerful, to make it this far."), instance_npcname("Himelmez#ghinstance2"));
	end;

OnTimer6000:
	npctalk(_("But, it doesn't matter."), instance_npcname("Himelmez#ghinstance2"));
	end;

OnTimer9000:
	npctalk(_("You will all die here."), instance_npcname("Himelmez#ghinstance2"));
	end;

OnTimer12000:
	npctalk(_("Himelmez! We will not let you get away from us!"), instance_npcname("Heinrich#ghinstance4"));
	end;

OnTimer15000:
	npctalk(_("Ha ha ha, worry about yourself. You think I am alone here?"), instance_npcname("Himelmez#ghinstance2"));
	end;

OnTimer18000:
	npctalk(_("Sir. Heinrich! I sense something strange and strong coming!"), instance_npcname("Varmundt#ghinstance3"));
	end;

OnTimer21000:
	npctalk(_("What... These are!"), instance_npcname("Heinrich#ghinstance4"));
	end;

OnTimer24000:
	npctalk(_("I will go on my way while my new toy entertains you."), instance_npcname("Himelmez#ghinstance2"));
	end;

OnTimer27000:
	npctalk(_("Fare well~, hope to see you again sometime, Heinrich."), instance_npcname("Himelmez#ghinstance2"));
	end;

OnTimer28000:
	donpcevent instance_npcname("Himelmez#ghinstance2")+"::OnDisable";
	end;

OnTimer31000:
	npctalk(_("Sir. Varmundt! Help those adventurers. I will go after Himelmez!"), instance_npcname("Heinrich#ghinstance4"));
	end;

OnTimer32000:
	donpcevent instance_npcname("Heinrich#ghinstance4")+"::OnDisable";
	end;

OnTimer35000:
	mapannounce(instance_mapname("1@gl_k"), _("An echoing comes from deep inside of the knight's shrine."), bc_map, C_WHITE);
	end;

OnTimer38000:
	donpcevent instance_npcname("#ghmemorialmob04")+"::OnEnable";
	stopnpctimer;
	donpcevent instance_npcname("#controlGH3")+"::OnDisable";
	end;
}

1@gl_k,144,258,6	script	Heinrich#ghinstance4	4_M_HEINRICH,{
	cutin "gl_heinrich1",2;
	mes("[Heinrich]");
	mes("Himelmez... I will never forget what you've done to my men.");
	close2;
	cutin "gl_heinrich1",255;
	end;

OnInstanceInit:
OnDisable:
	hideonnpc instance_npcname("Heinrich#ghinstance4");
	end;

OnEnable:
	hideoffnpc instance_npcname("Heinrich#ghinstance4");
	end;
}

1@gl_k,150,257,3	script	Himelmez#ghinstance2	4_F_HIMEL,{
	cutin "gl_himel2",2;
	mes("[Himelmez]");
	mes("Don't look at me nervous like that. It will be over soon...");
	close2;
	cutin "gl_himel2",255;
	end;

OnInstanceInit:
OnDisable:
	hideonnpc instance_npcname("Himelmez#ghinstance2");
	end;

OnEnable:
	hideoffnpc instance_npcname("Himelmez#ghinstance2");
	end;
}

1@gl_k,156,259,3	script	Varmundt#ghinstance3	4_M_BARMUND,{ // not disabling it so all players can get their reward
	if (questprogress(12318, HUNTING) == 2) {
		cutin "gl_barmund1", 2;
		mes("[Varmundt]");
		mes("This item has extraordinary aura with it. Can be very useful for someone special.");
		erasequest 12318;
		if (!questprogress(12319, HUNTING))
			setquest 12319;
		setquest 12320;
		erasequest 12320;
		getitem Temporal_Crystal, 1;
		getitem Coagulated_Spell, 1;
		getexp 250000, 250000;
		close2;
		cutin "gl_barmund1", 255;
		end;
	}
	cutin "gl_barmund1",2;
	mes("[Varmundt]");
	mes("I guess this is it. Is it impossible to stop the time traveler's will?! A portal seems to have appeared to the north.");
	close2;
	cutin "gl_barmund2",255;
	end;

OnInstanceInit:
OnDisable:
	hideonnpc instance_npcname("Varmundt#ghinstance3");
	end;

OnEnable:
	hideoffnpc instance_npcname("Varmundt#ghinstance3");
	end;
}

// Floor 2
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2@gl_k,148,67,1	script	Heinrich#ghinstance5	4_M_HEINRICH,{
	cutin "gl_heinrich1",2;
	mes("[Heinrich]");
	mes("Himelmez's closed space covers everywhere...");
	close2;
	cutin "gl_heinrich1",255;
	end;

OnInstanceInit:
OnDisable:
	hideonnpc instance_npcname("Heinrich#ghinstance5");
	end;

OnEnable:
	hideoffnpc instance_npcname("Heinrich#ghinstance5");
	end;
}

2@gl_k,151,71,7	script	Varmundt#ghinstance4	4_M_BARMUND,{
	cutin "gl_barmund1",2;
	mes("[Varmundt]");
	mes("How many times I do this job. In my dream, I did it over and over again...");
	close2;
	cutin "gl_barmund1",255;
	end;

OnInstanceInit:
OnDisable:
	hideonnpc instance_npcname("Varmundt#ghinstance4");
	end;

OnEnable:
	hideoffnpc instance_npcname("Varmundt#ghinstance4");
	end;
}

2@gl_k,150,67,0	script	#effectGH01	HIDDEN_NPC,10,10,{
	end;

OnTouch:
	if ('touch) {
		'touch = 0;
		specialeffect EF_BASH;
		donpcevent instance_npcname("#controlGH4")+"::OnEnable";
	}
	end;

OnEffect:
	specialeffect EF_LORD;
	end;

OnInstanceInit:
OnDisable:
	disablenpc instance_npcname("#effectGH01");
	end;

OnEnable:
	enablenpc instance_npcname("#effectGH01");
	'touch = 1; // Only activate OnTouch once
	end;
}

2@gl_k,0,0,0	script	#controlGH4	FAKE_NPC,{
	end;

OnInstanceInit:
OnDisable:
	disablenpc instance_npcname("#controlGH4");
	end;

OnEnable:
	enablenpc instance_npcname("#controlGH4");
	initnpctimer;
	end;

OnTimer3000:
	npctalk(_("This structure was not in the castle before!"), instance_npcname("Heinrich#ghinstance5"));
	donpcevent instance_npcname("#ghmemorialmob05")+"::OnEnable";
	end;

OnTimer6000:
	npctalk(_("This is Himelmez's closed space. We blocked each area and aisle."), instance_npcname("Varmundt#ghinstance4"));
	end;

OnTimer9000:
	npctalk(_("We tried to break it down but it's really strong."), instance_npcname("Heinrich#ghinstance5"));
	end;

OnTimer12000:
	npctalk(_("Step back. Let me try to dispel the magic."), instance_npcname("Varmundt#ghinstance4"));
	end;

OnTimer15000:
	donpcevent instance_npcname("#effectGH01")+"::OnEffect";
	end;

OnTimer18000:
	donpcevent instance_npcname("#effectGH01")+"::OnDisable";
	npctalk(_("I think that part of closed space is broke down."), instance_npcname("Varmundt#ghinstance4"));
	end;

OnTimer21000:
	npctalk(_("I have never seen this closed space."), instance_npcname("Varmundt#ghinstance4"));
	end;

OnTimer24000:
	npctalk(_("Himelmez hides stone chains in undead people's body."), instance_npcname("Varmundt#ghinstance4"));
	end;

OnTimer27000:
	npctalk(_("Maybe this closed space is maintained with these stone chains."), instance_npcname("Varmundt#ghinstance4"));
	end;

OnTimer30000:
	npctalk(_("If you want to break it, you have to kill one of those who have a stone chain."), instance_npcname("Varmundt#ghinstance4"));
	end;

OnTimer33000:
	npctalk(_("But, we can't recognize who has a stone chain so, we have to purify everything."), instance_npcname("Varmundt#ghinstance4"));
	end;

OnTimer36000:
	npctalk(_("It is inexcusable behavior."), instance_npcname("Heinrich#ghinstance5"));
	end;

OnTimer39000:
	npctalk(_("I already exterminated all my soldiers and maybe more..."), instance_npcname("Heinrich#ghinstance5"));
	end;

OnTimer42000:
	npctalk(_("Commander..."), instance_npcname("Varmundt#ghinstance4"));
	end;

OnTimer45000:
	npctalk(_("Commander! You need to be strong."), instance_npcname("Varmundt#ghinstance4"));
	end;

OnTimer48000:
	npctalk(_("Our enemy is not human."), instance_npcname("Varmundt#ghinstance4"));
	end;

OnTimer51000:
	npctalk(_("Even though you deny it, they'll never turn back to human."), instance_npcname("Varmundt#ghinstance4"));
	end;

OnTimer54000:
	npctalk(_("..."), instance_npcname("Heinrich#ghinstance5"));
	end;

OnTimer57000:
	npctalk(_("Well, let's go then."), instance_npcname("Varmundt#ghinstance4"));
	end;

OnTimer60000:
	npctalk(_("And you guys, just take a break and follow us."), instance_npcname("Varmundt#ghinstance4"));
	end;

OnTimer63000:
	npctalk(_("It could be hard fighting so, stay strong."), instance_npcname("Varmundt#ghinstance4"));
	end;

OnTimer66000:
	npctalk(_("Ok, it's time to begin Heinrich."), instance_npcname("Varmundt#ghinstance4"));
	end;

OnTimer69000:
	mapannounce(instance_mapname("2@gl_k"), _("A portal to the west has opened in the central hallway."), bc_map, C_YELLOW);
	donpcevent instance_npcname("#ghinstancewarp8")+"::OnEnable";
	donpcevent instance_npcname("#ghinstancewarp9")+"::OnEnable";
	donpcevent instance_npcname("#ghmemorialmob06")+"::OnEnable";
	donpcevent instance_npcname("Varmundt#ghinstance4")+"::OnDisable";
	donpcevent instance_npcname("Heinrich#ghinstance5")+"::OnDisable";
	end;

OnTimer70000:
	stopnpctimer;
	donpcevent instance_npcname("#controlGH4")+"::OnDisable";
	end;
}

2@gl_k,0,0,0	script	#ghmemorialmob05	FAKE_NPC,{
	end;

OnInstanceInit:
OnDisable:
	disablenpc instance_npcname("#ghmemorialmob05");
	end;

OnEnable:
	enablenpc instance_npcname("#ghmemorialmob05");
	.@map$ = instance_mapname("2@gl_k");
	.@label$ = instance_npcname("#ghmemorialmob05")+"::OnMyMobDead";
	areamonster(.@map$, 124, 20, 31, 162, _("Corrupted Palace Guard"), MG_RAYDRIC, 8, .@label$);
	areamonster(.@map$, 124, 20, 31, 162, _("Archer of Death"), MG_RAYDRIC_ARCHER, 8, .@label$);
	areamonster(.@map$, 124, 20, 31, 162, _("Corrupted Abysmal Knight"), MG_KNIGHT_OF_ABYSS, 8, .@label$);
	areamonster(.@map$, 124, 20, 31, 162, _("Suffered Khalitzburg"), MG_KHALITZBURG, 8, .@label$);
	areamonster(.@map$, 124, 20, 31, 162, _("Bloody Knight"), MG_BLOODY_KNIGHT, 8, .@label$);
	'MyMobs = 80;
	end;

OnMyMobDead:
	.@map$ = instance_mapname("2@gl_k");
	'MyMobs = 'MyMobs - 1;
	if ('MyMobs == 0) {
		mapannounce(.@map$, _("Evil Forces are appearing in this area."), bc_map, C_YELLOW, FW_NORMAL, 18);
		donpcevent instance_npcname("#ghmemorialmob06")+"::OnDisable2";
		donpcevent instance_npcname("#ghmemorialmob07")+"::OnEnable";
		donpcevent instance_npcname("#ghmemorialmob05")+"::OnDisable";
	} else {
		.@label$ = instance_npcname("#ghmemorialmob05")+"::OnMyMobDead";
		switch(rand(5)) {
		case 0:
			areamonster(.@map$, 124, 20, 31, 162, _("Corrupted Palace Guard"), 2468, 1, .@label$);
			break;
		case 1:
			areamonster(.@map$, 124, 20, 31, 162, _("Archer of Death"), 2469, 1, .@label$);
			break;
		case 2:
			areamonster(.@map$, 124, 20, 31, 162, _("Corrupted Abysmal Knight"), 2470, 1, .@label$);
			break;
		case 3:
			areamonster(.@map$, 124, 20, 31, 162, _("Suffered Khalitzburg"), 2471, 1, .@label$);
			break;
		case 4:
			areamonster(.@map$, 124, 20, 31, 162, _("Bloody Knight"), 2472, 1, .@label$);
			break;
		}
	}
	end;
}

2@gl_k,0,0,0	script	#ghmemorialmob06	FAKE_NPC,{
	end;

OnInstanceInit:
OnDisable:
	disablenpc instance_npcname("#ghmemorialmob06");
	end;

OnDisable2:
	stopnpctimer;
	disablenpc instance_npcname("#ghmemorialmob06");
	end;

OnEnable:
	enablenpc instance_npcname("#ghmemorialmob06");
	donpcevent instance_npcname("#ghmemorialmob06")+"::OnSpawn";
	end;

OnSpawn:
	initnpctimer;
	end;

OnTimer90000:
	.@map$ = instance_mapname("2@gl_k");
	.@label$ = instance_npcname("#ghmemorialmob05")+"::OnMyMobDead";
	setarray .@c[0],
		114,141,118,139,
		128,83,131,78,
		88,53,93,48,
		54,47,61,40,
		58,83,63,78,
		69,138,80,127,
		34,143,39,138;
	for (.@i = 0; .@i < getarraysize(.@c); .@i += 4) {
		areamonster(.@map$, .@c[.@i], .@c[.@i+1], .@c[.@i+2], .@c[.@i+3], _("Corrupted Palace Guard"), MG_RAYDRIC, 1, .@label$);
		areamonster(.@map$, .@c[.@i], .@c[.@i+1], .@c[.@i+2], .@c[.@i+3], _("Archer of Death"), MG_RAYDRIC_ARCHER, 1, .@label$);
		areamonster(.@map$, .@c[.@i], .@c[.@i+1], .@c[.@i+2], .@c[.@i+3], _("Corrupted Abysmal Knight"), MG_KNIGHT_OF_ABYSS, 1, .@label$);
		areamonster(.@map$, .@c[.@i], .@c[.@i+1], .@c[.@i+2], .@c[.@i+3], _("Suffered Khalitzburg"), MG_KHALITZBURG, 1, .@label$);
		areamonster(.@map$, .@c[.@i], .@c[.@i+1], .@c[.@i+2], .@c[.@i+3], _("Bloody Knight"), MG_BLOODY_KNIGHT, 1, .@label$);
	}
	end;

OnTimer92000:
	stopnpctimer;
	donpcevent instance_npcname("#ghmemorialmob06")+"::OnSpawn";
	end;
}

2@gl_k,0,0,0	script	#ghmemorialmob07	FAKE_NPC,{
	end;

OnInstanceInit:
OnDisable:
	disablenpc instance_npcname("#ghmemorialmob07");
	end;

OnEnable:
	enablenpc instance_npcname("#ghmemorialmob07");
	areamonster instance_mapname("2@gl_k"), 124, 20, 31, 162, _("1st Commander of Destruction"), MG_M_UNDEAD_KNIGHT, 1, instance_npcname("#ghmemorialmob07")+"::OnMyMobDead";
	end;

OnMyMobDead:
	.@map$ = instance_mapname("2@gl_k");
	if (mobcount(.@map$,instance_npcname("#ghmemorialmob07")+"::OnMyMobDead") < 1) {
		mapannounce(.@map$, _("A portal has opened to the east in the central hallway."), bc_map, C_YELLOW);
		donpcevent instance_npcname("#ghinstancewarp10")+"::OnEnable";
		donpcevent instance_npcname("#ghinstancewarp11")+"::OnEnable";
		donpcevent instance_npcname("#ghmemorialmob08")+"::OnEnable";
		donpcevent instance_npcname("#ghmemorialmob07")+"::OnDisable";
	}
	end;
}

2@gl_k,0,0,0	script	#ghmemorialmob08	FAKE_NPC,{
	end;

OnInstanceInit:
OnDisable:
	disablenpc instance_npcname("#ghmemorialmob08");
	end;

OnEnable:
	enablenpc instance_npcname("#ghmemorialmob08");
	.@map$ = instance_mapname("2@gl_k");
	.@label$ = instance_npcname("#ghmemorialmob08")+"::OnMyMobDead";
	areamonster .@map$, 175, 163, 265, 18, "Corrupted Palace Guard", 2468, 7, .@label$;
	areamonster .@map$, 175, 163, 265, 18, "Wandering Archer", 2469, 7, .@label$;
	areamonster .@map$, 175, 163, 265, 18, "Corrupted Abysmal Knight", 2470, 7, .@label$;
	areamonster .@map$, 175, 163, 265, 18, "Suffered Khalitzburg", 2471, 7, .@label$;
	areamonster .@map$, 175, 163, 265, 18, "Bloody Knight", 2472, 7, .@label$;
	'MyMobs = 35;
	end;

OnMyMobDead:
	.@map$ = instance_mapname("2@gl_k");
	'MyMobs = 'MyMobs-1;
	if ('MyMobs == 0) {
		mapannounce(.@map$, _("An evil presence has teleported into this area."), bc_map, C_YELLOW, FW_NORMAL, 18);
		donpcevent instance_npcname("#ghmemorialmob09")+"::OnEnable";
		donpcevent instance_npcname("#ghmemorialmob08")+"::OnDisable";
	} else {
		.@label$ = instance_npcname("#ghmemorialmob08")+"::OnMyMobDead";
		switch (rand(5)) {
		case 0:
			areamonster(.@map$, 175, 163, 265, 18, _("Corrupted Palace Guard"), MG_RAYDRIC, 1, .@label$);
			break;
		case 1:
			areamonster(.@map$, 175, 163, 265, 18, _("Wandering Archer"), MG_RAYDRIC_ARCHER, 1, .@label$);
			break;
		case 2:
			areamonster(.@map$, 175, 163, 265, 18, _("Corrupted Abysmal Knight"), MG_KNIGHT_OF_ABYSS, 1, .@label$);
			break;
		case 3:
			areamonster(.@map$, 175, 163, 265, 18, _("Suffered Khalitzburg"), MG_KHALITZBURG, 1, .@label$);
			break;
		case 4:
			areamonster(.@map$, 175, 163, 265, 18, _("Bloody Knight"), MG_BLOODY_KNIGHT, 1, .@label$);
			break;
		}
	}
	end;
}

2@gl_k,0,0,0	script	#ghmemorialmob09	FAKE_NPC,{
	end;

OnInstanceInit:
OnDisable:
	disablenpc instance_npcname("#ghmemorialmob09");
	end;

OnEnable:
	enablenpc instance_npcname("#ghmemorialmob09");
	areamonster(instance_mapname("2@gl_k"), 175, 163, 265, 18, _("2nd Commander of Destruction"), MG_F_UNDEAD_KNIGHT, 1, instance_npcname("#ghmemorialmob09")+"::OnMyMobDead");
	end;

OnMyMobDead:
	.@map$ = instance_mapname("2@gl_k");
	if (mobcount(.@map$,instance_npcname("#ghmemorialmob09")+"::OnMyMobDead") < 1) {
		mapannounce(.@map$, _("A new portal has appeared at the end of the central corridor."), bc_map, C_YELLOW);
		donpcevent instance_npcname("#ghinstancewarp12")+"::OnEnable";
		donpcevent instance_npcname("#ghinstancewarp13")+"::OnEnable";
		donpcevent instance_npcname("#controlGH6")+"::OnEnable";
		donpcevent instance_npcname("#ghmemorialmob08")+"::OnDisable";
		donpcevent instance_npcname("#ghmemorialmob09")+"::OnDisable";
	}
	end;
}

2@gl_k,0,0,0	script	#ghmemorialmob10	FAKE_NPC,{
	end;

OnInstanceInit:
OnDisable:
	disablenpc instance_npcname("#ghmemorialmob10");
	end;

OnEnable:
	enablenpc instance_npcname("#ghmemorialmob10");
	donpcevent instance_npcname("Gerhalt#ghinstance1")+"::OnDisable";
	monster(instance_mapname("2@gl_k"), 158, 255, _("Amdarais"), MG_AMDARAIS, 1, instance_npcname("#ghmemorialmob10")+"::OnMyMobDead");
	unittalk($@mobid[0], _("Run away... run away from me..."));
	initnpctimer;
	end;

OnTimer6000:
	unittalk($@mobid[0], _("I don't want... I don't want to kill anyone. Uhuuuuuh"));
	end;

OnTimer12000:
	unittalk($@mobid[0], _("Please kill me! Please!"));
	end;

OnTimer18000:
	unittalk($@mobid[0], _("Eeeeee...eee...die... die..."));
	end;

OnTimer24000:
	unittalk($@mobid[0], _("Demolition... Death!..."));
	stopnpctimer;
	end;

OnMyMobDead:
	if (mobcount(instance_mapname("2@gl_k"),instance_npcname("#ghmemorialmob10")+"::OnMyMobDead") < 1) {
		donpcevent instance_npcname("Hugin#ghinstance1")+"::OnEnable";
		donpcevent instance_npcname("#ghinstancewarp15")+"::OnEnable";
		for (.@i = 1; .@i <= 8; .@i++)
			enablenpc instance_npcname("Strange crack#"+.@i);
		stopnpctimer;
		donpcevent instance_npcname("#ghmemorialmob10")+"::OnDisable";
	}
	end;
}

2@gl_k,155,250,7	script	Heinrich#ghinstance6	4_M_HEINRICH,{
	cutin "gl_heinrich1",2;
	mes("[Heinrich]");
	mes("What are you decorating Himelmez!");
	close2;
	cutin "gl_heinrich1",255;
	end;

OnInstanceInit:
OnDisable:
	hideonnpc instance_npcname("Heinrich#ghinstance6");
	end;

OnEnable:
	hideoffnpc instance_npcname("Heinrich#ghinstance6");
	end;
}

2@gl_k,162,250,1	script	Varmundt#ghinstance5	4_M_BARMUND,{
	cutin "gl_barmund2",2;
	mes("[Varmundt]");
	mes("Can't take off this bridle...");
	close2;
	cutin "gl_barmund2",255;
	end;

OnInstanceInit:
OnDisable:
	hideonnpc instance_npcname("Varmundt#ghinstance5");
	end;

OnEnable:
	hideoffnpc instance_npcname("Varmundt#ghinstance5");
	end;
}

2@gl_k,158,252,3	script	Himelmez#ghinstance4	4_F_HIMEL,{
	cutin "gl_himel2",2;
	mes("[Himelmez]");
	mes("That is amazing ~ you made it all the way here. May I say thank you?");
	close2;
	cutin "gl_himel2",255;
	end;

OnInstanceInit:
OnDisable:
	hideonnpc instance_npcname("Himelmez#ghinstance4");
	end;

OnEnable:
	hideoffnpc instance_npcname("Himelmez#ghinstance4");
	end;
}

2@gl_k,150,179,0	script	#controlGH6	HIDDEN_NPC,2,2,{
	end;

OnTouch:
	mapannounce(instance_mapname("2@gl_k"), _("???: Do not come here! It's a trap... Kkkkah!!!"), bc_map, C_RED, FW_NORMAL, 18);
	specialeffect EF_BASH;
	donpcevent instance_npcname("Himelmez#ghinstance3")+"::OnEnable";
	donpcevent instance_npcname("Heinrich#ghinstance6")+"::OnEnable";
	donpcevent instance_npcname("Varmundt#ghinstance5")+"::OnEnable";
	donpcevent instance_npcname("Gerhalt#ghinstance1")+"::OnEnable";
	donpcevent instance_npcname("#controlGH6")+"::OnDisable";
	end;

OnInstanceInit:
OnDisable:
	disablenpc instance_npcname("#controlGH6");
	end;

OnEnable:
	enablenpc instance_npcname("#controlGH6");
	end;
}

2@gl_k,158,252,1	script	Himelmez#ghinstance3	4_F_HIMEL,7,7,{
	end;

OnTouch:
	specialeffect EF_BASH;
	donpcevent instance_npcname("#controlGH5")+"::OnEnable";
	donpcevent instance_npcname("Himelmez#ghinstance4")+"::OnEnable";
	donpcevent instance_npcname("Himelmez#ghinstance3")+"::OnDisable";
	end;

OnInstanceInit:
OnDisable:
	disablenpc instance_npcname("Himelmez#ghinstance3");
	end;

OnEnable:
	enablenpc instance_npcname("Himelmez#ghinstance3");
	end;
}

2@gl_k,158,255,3	script	Gerhalt#ghinstance1	4_LEVITATEMAN,{
	mes("[Gerhalt]");
	mes("Uuuuu... Khhhah!\r"
		"Just run away with the commander!");
	close;

OnInstanceInit:
OnDisable:
	hideonnpc instance_npcname("Gerhalt#ghinstance1");
	end;

OnEnable:
	hideoffnpc instance_npcname("Gerhalt#ghinstance1");
	end;

OnTalk3: /*Unused*/
	npctalk(_("Gerhalt : You can make my body but you can't take my soul Himelmez!"));
	end;

OnEffect1:
	specialeffect EF_BARRIER;
	end;

OnEffect2:
	specialeffect EF_CHAINCOMBO;
	end;

OnEffect3:
	specialeffect EF_MAPPILLAR2;
	end;

OnEffect4:
	specialeffect EF_MAPPILLAR;
	end;

OnEffect5:
	specialeffect EF_LORD;
	end;
}

2@gl_k,0,0,0	script	#controlGH5	FAKE_NPC,{
	end;

OnInstanceInit:
OnDisable:
	disablenpc instance_npcname("#controlGH5");
	end;

OnEnable:
	enablenpc instance_npcname("#controlGH5");
	initnpctimer;
	end;

OnTimer3000:
	npctalk(_("Amazing~ I thought that you were not even close to getting here..."), instance_npcname("Himelmez#ghinstance4"));
	end;

OnTimer6000:
	npctalk(_("Gerhalt : Kkkkah! Run away! I can't endure anymore!"), instance_npcname("Gerhalt#ghinstance1"));
	end;

OnTimer9000:
	npctalk(_("Gerhalt!"), instance_npcname("Heinrich#ghinstance6"));
	end;

OnTimer15000:
	npctalk(_("What are you doing to my soldier Himelmez!"), instance_npcname("Heinrich#ghinstance6"));
	end;

OnTimer18000:
	npctalk(_("Hoo hoo, I already found a piece of Ymir's heart Heinrich."), instance_npcname("Himelmez#ghinstance4"));
	end;

OnTimer21000:
	npctalk(_("If he did not bother me, it would have been faster."), instance_npcname("Himelmez#ghinstance4"));
	end;

OnTimer24000:
	npctalk(_("Gerhalt : Commandant... Come on, you need to run away from here... Ugh."), instance_npcname("Gerhalt#ghinstance1"));
	end;

OnTimer27000:
	npctalk(_("Really? What makes you think so?"), instance_npcname("Himelmez#ghinstance4"));
	end;

OnTimer30000:
	npctalk(_("Himelmez! You already made what you want so there is no more need for a sacrifice!"), instance_npcname("Heinrich#ghinstance6"));
	end;

OnTimer33000:
	npctalk(_("Let him go! I don't need to see anyone else suffer!"), instance_npcname("Heinrich#ghinstance6"));
	end;

OnTimer36000:
	npctalk(_("Let him go? I think... No..."), instance_npcname("Himelmez#ghinstance4"));
	end;

OnTimer39000:
	npctalk(_("Besides, this is your last surviving soldier Heinrich."), instance_npcname("Himelmez#ghinstance4"));
	end;

OnTimer42000:
	npctalk(_("He made life difficult for me."), instance_npcname("Himelmez#ghinstance4"));
	end;

OnTimer45000:
	npctalk(_("He is perfectly fit for my new creation Amdarais."), instance_npcname("Himelmez#ghinstance4"));
	end;

OnTimer48000:
	npctalk(_("I'll never forgive you."), instance_npcname("Heinrich#ghinstance6"));
	end;

OnTimer51000:
	npctalk(_("Uh uh~ I'm so scared."), instance_npcname("Himelmez#ghinstance4"));
	end;

OnTimer54000:
	npctalk(_("Anyway, we will have a chance to see because we need to talk more."), instance_npcname("Himelmez#ghinstance4"));
	end;

OnTimer57000:
	npctalk(_("So long boys."), instance_npcname("Himelmez#ghinstance4"));
	end;

OnTimer60000:
	donpcevent instance_npcname("Gerhalt#ghinstance1")+"::OnEffect1";
	end;

OnTimer63000:
	donpcevent instance_npcname("Himelmez#ghinstance4")+"::OnDisable";
	end;

OnTimer65000:
	donpcevent instance_npcname("Gerhalt#ghinstance1")+"::OnEffect3";
	end;

OnTimer66000:
	donpcevent instance_npcname("Gerhalt#ghinstance1")+"::OnEffect2";
	end;

OnTimer67000:
	npctalk(_("I'll never let you get away Himelmez!!"), instance_npcname("Heinrich#ghinstance6"));
	donpcevent instance_npcname("Gerhalt#ghinstance1")+"::OnEffect4";
	end;

OnTimer70000:
	donpcevent instance_npcname("Gerhalt#ghinstance1")+"::OnEffect3";
	donpcevent instance_npcname("Gerhalt#ghinstance1")+"::OnEffect4";
	donpcevent instance_npcname("Heinrich#ghinstance6")+"::OnDisable";
	npctalk(_("We have no choice. We have to fight against Amdarais!"), instance_npcname("Varmundt#ghinstance5"));
	donpcevent instance_npcname("Varmundt#ghinstance5")+"::OnDisable";
	end;

OnTimer73000:
	mapannounce(instance_mapname("2@gl_k"), _("Gerhalt's body changing."), bc_map, C_WHITE);
	end;

OnTimer76000:
	donpcevent instance_npcname("Gerhalt#ghinstance1")+"::OnEffect5";
	end;

OnTimer80000:
	donpcevent instance_npcname("#ghmemorialmob10")+"::OnEnable";
	stopnpctimer;
	donpcevent instance_npcname("#controlGH5")+"::OnDisable";
	end;
}

2@gl_k,158,241,1	script	Hugin#ghinstance1	4_M_SAGE_C,{
	if (questprogress(12319, HUNTING) == 2) {
		mes("[Hugin]");
		mes("Hm, you are very well. First of all, let me give you some loot from Amdarais.");
		erasequest 12319;
		setquest 12321;
		setquest 12322;
		erasequest 12321;
		if (gh_instance == 1) {
			getitem Temporal_Crystal, 1;
			getitem Coagulated_Spell, 1;
		} else {
			getitem Temporal_Crystal, 5;
			getitem Coagulated_Spell, 5;
			gh_instance = 1;
		}
		getexp(350000, 350000);
		next;
		mes("[Hugin]");
		mes("Varmundt's time is stopped by me. And your time will be distorted soon.");
		specialeffect2 EF_BLIND,AREA;
		soundeffect "_blind.wav",0;
		next;
		mes("[Hugin]");
		mes("Maybe this poor time traveler will try to stop Glast Heim's tragedy from happening.");
		next;
		mes("[Hugin]");
		mes("However, we will never overlook his behavior now and forever...");
		next;
		mes("[Hugin]");
		mes("Now, let me remove your memory. If you see me again, that will be brand new.");
		specialeffect2 EF_FREEZE;
		close2;
		getmapxy(.@map$, .@x, .@y, UNITTYPE_PC);
		warp .@map$,.@x,.@y;
		end;
	} else {
		mes("[Hugin]");
		mes("Oops I almost distorted the time gap. Come over here. We need to go out!");
		next;
		select("You were just with me...");
		mes("[Hugin]");
		mes("What did you say just before? Anyway that is not important, The gap of time will be closed so, we need to get out of here.");
		next;
		switch(select("Let me look around more:Please let me out")) {
		case 1:
			mes("[Hugin]");
			mes("Really? This place will be broke down so, please look around quickly.");
			close;
		case 2:
			close2;
			warp "glast_01",204,270;
			end;
		}
	}

OnInstanceInit:
OnDisable:
	disablenpc instance_npcname("Hugin#ghinstance1");
	end;

OnEnable:
	enablenpc instance_npcname("Hugin#ghinstance1");
	end;
}

// Treasure Room
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
// TODO: Need script command makeitem2
1@gl_k,269,267,0	script	Strange crack#entrace	HIDDEN_NPC,{
	if (!questprogress(12322)) {
		mes("The crack looks suspicious, but nothing more to check.");
		close;
	}
	.@map$ = instance_mapname("1@gl_k");
	warp .@map$,149,193;
	end;
}

1@gl_k,129,136,0	script	Strange crack#1	HIDDEN_NPC,{
	specialeffect EF_SPELLBREAKER;
	specialeffect EF_BASH;
	.@random = rand(1, 4);
	.@random_ = rand(1, 4);
	for (.@i = 1; .@i <= .@random; .@i++) {
		makeitem White_Jewel, 1, "this", 129, 138;
	}
	makeitem Coagulated_Spell, 1, "this", 129, 138;
	if (.@random_ == 4) {
		//makeitem2 Heavy_Sword, 1, "this", 129, 138, 0, 0, 0, 0, 0, 0, 0;
		makeitem Heavy_Sword, 1, "this", 129, 138;
	}
	// FIXME[Haru]: Intention is not clear. Either add 'end;' or add '/* Fall through */'

OnInstanceInit:
OnDisable:
	disablenpc instance_npcname("Strange crack#1");
	end;

OnEnable:
	enablenpc instance_npcname("Strange crack#1");
	end;
}

1@gl_k,135,136,0	script	Strange crack#2	HIDDEN_NPC,{
	specialeffect EF_SPELLBREAKER;
	specialeffect EF_BASH;
	.@random = rand(1, 4);
	.@random_ = rand(1, 4);
	for (.@i=1; .@i<=.@random; .@i++) {
		makeitem Blue_Jewel, 1, "this", 135, 138;
	}
	if (.@random_ == 4) {
		//makeitem2 Staff_Of_Geffen, 1, "this", 135, 138, 0, 0, 0, 0, 0, 0, 0;
		makeitem Staff_Of_Geffen, 1, "this", 135, 138;
	}
	makeitem Coagulated_Spell, 1, "this", 135, 138;
	// FIXME[Haru]: Intention is not clear. Either add 'end;' or add '/* Fall through */'

OnInstanceInit:
OnDisable:
	disablenpc instance_npcname("Strange crack#2");
	end;

OnEnable:
	enablenpc instance_npcname("Strange crack#2");
	end;

}
1@gl_k,141,136,0	script	Strange crack#3	HIDDEN_NPC,{
	specialeffect EF_SPELLBREAKER;
	specialeffect EF_BASH;
	.@random = rand(1, 4);
	.@random_ = rand(1, 4);
	for (.@i=1; .@i<=.@random; .@i++) {
		makeitem Red_Jewel, 1, "this", 141, 138;
	}
	makeitem Coagulated_Spell, 1, "this", 141, 138;
	makeitem Gold_Bullion, 1, "this", 141, 138;
	if (.@random_ == 4) {
		//makeitem2 Ceremonial_Sword, 1, "this", 141, 138, 0, 0, 0, 0, 0, 0, 0;
		makeitem Ceremonial_Sword, 1, "this", 141, 138;
	}
	// FIXME[Haru]: Intention is not clear. Either add 'end;' or add '/* Fall through */'

OnInstanceInit:
OnDisable:
	disablenpc instance_npcname("Strange crack#3");
	end;

OnEnable:
	enablenpc instance_npcname("Strange crack#3");
	end;
}

1@gl_k,147,136,0	script	Strange crack#4	HIDDEN_NPC,{
	specialeffect EF_SPELLBREAKER;
	specialeffect EF_BASH;
	.@random = rand(1, 4);
	.@random_ = rand(1, 4);
	for (.@i=1; .@i<=.@random; .@i++) {
		makeitem Scarlet_Jewel, 1, "this", 147, 138;
	}
	if (.@random_ == 4) {
		//makeitem2 Silversmith_Bracelet, 1, "this", 147, 138, 0, 0, 0, 0, 0, 0, 0;
		makeitem Silversmith_Bracelet, 1, "this", 147, 138;
	}
	makeitem Coagulated_Spell, 1, "this", 147, 138;
	makeitem Gold_Coin_Basket, 1, "this", 147, 138;
	makeitem Colorful_Brooch, 1, "this", 147, 138;
	// FIXME[Haru]: Intention is not clear. Either add 'end;' or add '/* Fall through */'

OnInstanceInit:
OnDisable:
	disablenpc instance_npcname("Strange crack#4");
	end;

OnEnable:
	enablenpc instance_npcname("Strange crack#4");
	end;
}

1@gl_k,153,136,0	script	Strange crack#5	HIDDEN_NPC,{
	specialeffect EF_SPELLBREAKER;
	specialeffect EF_BASH;
	.@random = rand(1, 4);
	.@random_ = rand(1, 4);
	for (.@i=1; .@i<=.@random; .@i++) {
		makeitem Azure_Jewel, 1, "this", 153, 138;
	}
	makeitem Coagulated_Spell, 1, "this", 153, 138;
	makeitem White_Gold_Bullion, 1, "this", 153, 138;
	if (.@random_ == 4) {
		//makeitem2 Goldsmithing_Dagger, 1, "this", 153, 138, 0, 0, 0, 0, 0, 0, 0;
		makeitem Goldsmithing_Dagger, 1, "this", 153, 138;
	}
	// FIXME[Haru]: Intention is not clear. Either add 'end;' or add '/* Fall through */'

OnInstanceInit:
OnDisable:
	disablenpc instance_npcname("Strange crack#5");
	end;

OnEnable:
	enablenpc instance_npcname("Strange crack#5");
	end;
}

1@gl_k,159,136,0	script	Strange crack#6	HIDDEN_NPC,{
	specialeffect EF_SPELLBREAKER;
	specialeffect EF_BASH;
	.@random = rand(1, 4);
	.@random_ = rand(1, 4);
	for (.@i=1; .@i<=.@random; .@i++) {
		makeitem Skyblue_Jewel, 1, "this", 159, 138;
	}
	makeitem Coagulated_Spell, 1, "this", 159, 138;
	makeitem Silver_Bullion, 1, "this", 159, 138;
	if (.@random_ == 4) {
		//makeitem2 Engraved_Armor, 1, "this", 159, 138, 0, 0, 0, 0, 0, 0, 0;
		makeitem Engraved_Armor, 1, "this", 159, 138;
	}
	// FIXME[Haru]: Intention is not clear. Either add 'end;' or add '/* Fall through */'

OnInstanceInit:
OnDisable:
	disablenpc instance_npcname("Strange crack#6");
	end;

OnEnable:
	enablenpc instance_npcname("Strange crack#6");
	end;
}

1@gl_k,165,136,0	script	Strange crack#7	HIDDEN_NPC,{
	specialeffect EF_SPELLBREAKER;
	specialeffect EF_BASH;
	.@random = rand(1, 4);
	for (.@i=1; .@i<=.@random; .@i++) {
		makeitem Violet_Jewel, 1, "this", 165, 138;
	}
	makeitem Coagulated_Spell, 1, "this", 165, 138;
	// FIXME[Haru]: Intention is not clear. Either add 'end;' or add '/* Fall through */'

OnInstanceInit:
OnDisable:
	disablenpc instance_npcname("Strange crack#7");
	end;

OnEnable:
	enablenpc instance_npcname("Strange crack#7");
	end;
}

1@gl_k,171,136,0	script	Strange crack#8	HIDDEN_NPC,{
	specialeffect EF_SPELLBREAKER;
	specialeffect EF_BASH;
	.@random = rand(1, 4);
	for (.@i=1; .@i<=.@random; .@i++) {
		makeitem Dark_Red_Jewel, 1, "this", 171, 138;
	}
	makeitem Coagulated_Spell, 1, "this", 171, 138;
	// FIXME[Haru]: Intention is not clear. Either add 'end;' or add '/* Fall through */'

OnInstanceInit:
OnDisable:
	disablenpc instance_npcname("Strange crack#8");
	end;

OnEnable:
	enablenpc instance_npcname("Strange crack#8");
	end;
}

// Merchant, and Trade NPC - Get Temporal Boots --> exchange to Temporal_*_Boots
// Upon trade all refines got removed
// Uses Temporal_Crystal
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
glast_01,210,273,5	script	Hugin's Butler	1_F_04,{
	disable_items;
	mes("[Hugin's Butler]"); // custom check
	if (MaxWeight - Weight < 1000) {
		mes("Your bag is too heavy. Reduce some weight and come back.");
		close;
	}
	mes("I would like to thank you for helping my master Hugin. I can transmute your ^FF0000Temporal Crystals^000000 into a pair of boots that have withstood the test of time... the ^FF0000Temporal Boots^000000.");
	next;
	mes("[Hugin's Butler]");
	mes("What would you like me to do young adventurer?");
	next;
	switch (select("Give me the Temporal Boots", "Upgrade my Temporal Boots")) {
	case 1:
		if (countitem(Temporal_Crystal) > 0) {
			mes("[Hugin's Butler]");
			mes("Take these Temporal Boots. We can upgrade your Temporal Boots with 5 Temporal Crystals.");
			delitem Temporal_Crystal, 1;
			getitem Temporal_Boots, 1;
			close;
		}
		mes("[Hugin's Butler]");
		mes("You need more Temporal Crystals. Come back when you get some more Temporal Crystals during your travel through Old Glast Heim.");
		close;
	case 2:
		.@part = EQI_SHOES;
		if (!getequipisequiped(.@part)) {
			mes("[Hugin's Butler]");
			mes("Wear the ^0000FFTemporal Boots^000000 you want to upgrade, and then talk to me once again.");
			close;
		}
		if (!isequipped(Temporal_Boots)) { // check
			mes("[Hugin's Butler]");
			mes("You are not wearing the Temporal Boots. Talk to me once you're wearing them.");
			close;
		}
		if (countitem(Temporal_Crystal) < 5) {
			mes("[Hugin's Butler]");
			mes("Not enough Temporal Crystals. You need ^FF00005 Temporal Crystals^000000 to upgrade your boots.");
			close;
		}
		mes("[Hugin's Butler]");
		mes("You can trade ^0000FF1 Temporal Boots and 5 Temporal Crystals^000000 for 1 of the following items. ^FF0000Previous refine rate will not be retained with these new ones^000000.");
		next;
		setarray .@type$[0], "Strength", "Intelligence", "Agility", "Vitality", "Dexterity", "Luck";
		setarray .@equip_type[0], Temporal_Str_Boots, Temporal_Int_Boots, Temporal_Agi_Boots, Temporal_Vit_Boots, Temporal_Dex_Boots, Temporal_Luk_Boots;
		.@select = select("Cancel", "Str Boots", "Int Boots", "Agi Boots", "Vit Boots", "Dex Boots", "Luk Boots");
		switch (.@select) {
		case 1:
			mes("[Hugin's Butler]");
			mes("Come back anytime you want.");
			close;
		case 2:
		case 3:
		case 4:
		case 5:
		case 6:
		case 7:
			mes("[Hugin's Butler]");
			mesf("Are you sure about buying Temporal ^FF0000%s^000000 Boots? There is no refund.", .@type$[.@select-2]);
			next;
			if (select("Think again", "Yes, I am sure.") == 2) {
				mes("[Hugin's Butler]");
				mes("The boots has been upgraded as you want.");
				delequip .@part;
				delitem Temporal_Crystal, 5;
				getitem2 .@equip_type[.@select-2], 1, 1, 0, 0, 0, 0, 0, 0; // Temporal_Str_Boots, Temporal_Int_Boots, Temporal_Agi_Boots, Temporal_Vit_Boots, Temporal_Dex_Boots, Temporal_Luk_Boots
				close;
			}
			mes("[Hugin's Butler]");
			mes("Ok, come back again when you are sure.");
			close;
		}
	}
}

// Enchant NPC - Coagulated Spell to enchants on 4th slot. First one to pick --> upgraded --> additional random enchant on 3rd slot
// Adding a socket on the Craftsman NPC will remove the 3rd and 4th slot enchants of the Temporal_*_Boots
// Enchanting can fail, the 3th slot random one is guaranteed
// Refine remains
// Item Used: Coagulated_Spell
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
glast_01,212,273,4	script	Hugin's Magic Master	1_F_01,{ // Custom text due to official enchant mechanics
	disable_items;
	if (MaxWeight - Weight < 1000) {
		mes("Your bag is too heavy. Reduce some weight and come back.");
		close;
	}
	mes("[Hugin's Magic Master]"); // Custom text
	mes("So you came to enchant the Temporal Boots. Be aware that adding a socket do your boots will remove my enchants as well as it's refine. It is only possible for the boots you are wearing.");
	next;
	if (select("How does the enchanting work?", "Give effect to my Temporal Boots") == 1) {
		mes("[Hugin's Magic Master]");
		mes("You can obtain ^0000FFCoagulated Spell^000000 through your time travels.");
		next;
		mes("[Hugin's Magic Master]");
		mes("I can enchant your Temporal Boots with a variing amount of that item. ^0000FFAvailable for all Temporal STAT Boots^000000.");
		next;
		mes("[Hugin's Magic Master]");
		mes("But, once you try to put a socket into the item, it will be resetted. So if you want a socket, you should do it first. Be sure to remember that.");
		next;
		mes("[Hugin's Magic Master]");
		mes("I don't give out effect randomly. You can pick which effect you want for the item.");
		next;
		mes("[Hugin's Magic Master]");
		mes("Of course it is for 4th slot only. You can have small effect at the start and then the effect grows stronger.\r"
			"^FF0000Remember: It can fail and break your item!^000000");
		next;
		mes("[Hugin's Magic Master]");
		mes("To get to the final option upgrade it will require way more Coagulated Spells. Don't forget that.");
		next;
		mes("[Hugin's Magic Master]");
		mes("Once the 4th slot completes the best option, you get to have a random bonus effect to the 3rd slot. With.. certain payment and a ^0000FFguaranteed success rate~^000000");
		next;
		mes("[Hugin's Magic Master]");
		mes("^FF0000Again: there is a risk on failing and breaking the item^000000.\r"
			"But if the enchant is applied successful, ^0000FFthe refine and everything else will be retained.^000000");
		next;
		mes("[Hugin's Magic Master]");
		mes("Phew... Anyways, that's all for basic enchant information. Now you should see for yourself.");
		close;
	}
	.@part = EQI_SHOES;
	if (!getequipisequiped(.@part)) {
		mes("[Hugin's Magic Master]");
		mes("Are you wearing the item?");
		close;
	}
	.@equip_refine = getequiprefinerycnt(.@part);
	.@equip_id = getequipid(.@part);
	.@equip_name$ = getequipname(.@part);
	.@card0 = getequipcardid(.@part, 0);
	.@card3 = getequipcardid(.@part, 3);
	setarray .@enchant1st[0], Fighting_Spirit4, Expert_Archer1, Spell2, Vitality2, Attack_Delay_1, Luck3;
	setarray .@enchant2nd[0], Fighting_Spirit5, Expert_Archer2, Spell3, Vitality3, Attack_Delay_2, Luck4;
	setarray .@enchant3rd[0], Fighting_Spirit6, Expert_Archer3, Spell4, MHP1, Attack_Delay_3, Luck5;
	setarray .@enchant4th[0], Fighting_Spirit7, Expert_Archer4, Spell5, MHP2, Attack_Delay_4, Luck6;
	setarray .@enchant_cost[0], 1, 4, 15, 30, 10; // Coagulated_Spell costs
	setarray .@enchant_rate[0], 90, 80, 70, 50, 100; // Enchant Success Rate in %
	.@random = rand(1, 100);
	switch (.@equip_id) {
	case Temporal_Str_Boots:
	case Temporal_Int_Boots:
	case Temporal_Agi_Boots:
	case Temporal_Vit_Boots:
	case Temporal_Dex_Boots:
	case Temporal_Luk_Boots:
	case Temporal_Str_Boots_:
	case Temporal_Int_Boots_:
	case Temporal_Agi_Boots_:
	case Temporal_Vit_Boots_:
	case Temporal_Dex_Boots_:
	case Temporal_Luk_Boots_:
		if (.@card3 == 0) { //4th slot 1st try enchanting
			.@cost = .@enchant_cost[0];
			.@scs = .@enchant_rate[0];
			.@number = 1;
			mes("[Hugin's Magic Master]");
			mesf("Want to enchant ^0000FF%s^000000? For the 1st enchanting, you need ^FF0000%d^000000 ^0000FFCoagulated Spells.^000000", .@equip_name$, .@cost);
			next;
			.@select = select("Quit", "Fighting Spirit", "Archery", "Spell", "Vitality", "Attack Speed", "Luck");
			switch (.@select) {
			case 1:
				mes("[Hugin's Magic Master]");
				mes("Ok, come back when you are ready.");
				close;
			case 2:
				.@enchant = .@enchant1st[.@select-2];
				break;
			case 3:
				.@enchant = .@enchant1st[.@select-2];
				break;
			case 4:
				.@enchant = .@enchant1st[.@select-2];
				break;
			case 5:
				.@enchant = .@enchant1st[.@select-2];
				break;
			case 6:
				.@enchant = .@enchant1st[.@select-2];
				break;
			case 7:
				.@enchant = .@enchant1st[.@select-2];
				break;
			}
		} else {
			if (.@card3 == .@enchant1st[0] || .@card3 == .@enchant1st[1] || .@card3 == .@enchant1st[2] ||
				.@card3 == .@enchant1st[3] || .@card3 == .@enchant1st[4] || .@card3 == .@enchant1st[5]) {
				.@cost = .@enchant_cost[1];
				.@scs = .@enchant_rate[1];
				.@number = 2;
			} else if (.@card3 == .@enchant2nd[0] || .@card3 == .@enchant2nd[1] || .@card3 == .@enchant2nd[2] ||
				.@card3 == .@enchant2nd[3] || .@card3 == .@enchant2nd[4] || .@card3 == .@enchant2nd[5]) {
				.@cost = .@enchant_cost[2];
				.@scs = .@enchant_rate[2];
				.@number = 3;
			} else if (.@card3 == .@enchant3rd[0] || .@card3 == .@enchant3rd[1] || .@card3 == .@enchant3rd[2] ||
				.@card3 == .@enchant3rd[3] || .@card3 == .@enchant3rd[4] || .@card3 == .@enchant3rd[5]) {
				.@cost = .@enchant_cost[3];
				.@scs = .@enchant_rate[3];
				.@number = 4;
			} else if (.@card3 == .@enchant4th[0] || .@card3 == .@enchant4th[1] || .@card3 == .@enchant4th[2] ||
				.@card3 == .@enchant4th[3] || .@card3 == .@enchant4th[4] || .@card3 == .@enchant4th[5]) {
				.@card2 = getequipcardid(.@part, 2);
				.@cost = .@enchant_cost[4];
				.@scs = .@enchant_rate[4];
				if (.@card2 != 0) {
					mes("[Hugin's Magic Master]"); // Custom text
					mes("Your shoes have reached the maximum option to enchant.");
					mes("Please bring me a new one if you want me to enchant again.");
					close;
				}
				// 3rd slot random enchanting
				switch (.@card3) {
				case Fighting_Spirit7:
				case Expert_Archer4:
				case Spell5:
				case MHP2:
				case Attack_Delay_4:
				case Luck6:
					.@enchant = callfunc("F_Rand", Bears_Power, Runaway_Magic, Speed_Of_Light, Muscle_Fool, Hawkeye, Lucky_Day);
					mes("[Hugin's Magic Master]"); // Custom text
					mes("Seems you already completed the best upgrade option in your 4th slot. For that I can give a random bonus effect to your 3rd slot. And of course, with certain payment...");
					next;
					mes("[Hugin's Magic Master]");
					mesf("Enchanting ^0000FF%s^000000's 3rd slot for obtaining a random bonus effect. Requires ^FF0000%d^000000 ^0000FFCoagulated Spells^000000", .@equip_name$, .@cost);
					next;
					if (select("Quit", "Effect Upgrade!") == 1) {
						mes("[Hugin's Magic Master]");
						mes("Ok, come back when you are ready.");
						close;
					}
					if (countitem(Coagulated_Spell) < .@cost) {
						mesf("Hmm, you are missing %s Coagulated Spells. Go get more, and then we can talk about more enchants.", .@cost - countitem(Coagulated_Spell));
						close;
					}
					if (.@random > .@scs) {
						mes("Arrggg, we failed. Better luck next time.");
						specialeffect2 EF_PHARMACY_FAIL; delitem Coagulated_Spell, .@cost; delequip .@part;
						close;
					}
					specialeffect2 EF_REPAIRWEAPON;
					delitem Coagulated_Spell, .@cost;
					delequip .@part;
					mes("[Hugin's Magic Master]");
					mes("This is it! This special stone is now yours Hahaha... I am really the only master of these things. Thank you for believing in me.");
					getitem2 .@equip_id, 1, 1, .@equip_refine, 0, .@card0, 0, .@enchant, .@card3;
					close;
				}
			}
			// 4th slot 2nd try enchanting
			if (.@card3 == .@enchant1st[0])
				.@enchant = .@enchant2nd[0];
			else if (.@card3 == .@enchant1st[1])
				.@enchant = .@enchant2nd[1];
			else if (.@card3 == .@enchant1st[2])
				.@enchant = .@enchant2nd[2];
			else if (.@card3 == .@enchant1st[3])
				.@enchant = .@enchant2nd[3];
			else if (.@card3 == .@enchant1st[4])
				.@enchant = .@enchant2nd[4];
			else if (.@card3 == .@enchant1st[5])
				.@enchant = .@enchant2nd[5];
			// 4th slot 3rd try enchanting
			if (.@card3 == .@enchant2nd[0])
				.@enchant = .@enchant3rd[0];
			else if (.@card3 == .@enchant2nd[1])
				.@enchant = .@enchant3rd[1];
			else if (.@card3 == .@enchant2nd[2])
				.@enchant = .@enchant3rd[2];
			else if (.@card3 == .@enchant2nd[3])
				.@enchant = .@enchant3rd[3];
			else if (.@card3 == .@enchant2nd[4])
				.@enchant = .@enchant3rd[4];
			else if (.@card3 == .@enchant2nd[5])
				.@enchant = .@enchant3rd[5];
			// 4th slot 4th try enchanting
			if (.@card3 == .@enchant3rd[0])
				.@enchant = .@enchant4th[0];
			else if (.@card3 == .@enchant3rd[1])
				.@enchant = .@enchant4th[1];
			else if (.@card3 == .@enchant3rd[2])
				.@enchant = .@enchant4th[2];
			else if (.@card3 == .@enchant3rd[3])
				.@enchant = .@enchant4th[3];
			else if (.@card3 == .@enchant3rd[4])
				.@enchant = .@enchant4th[4];
			else if (.@card3 == .@enchant3rd[5])
				.@enchant = .@enchant4th[5];
			mes("[Hugin's Magic Master]");
			mesf("Enchanting ^0000FF%s^000000's 4th slot as ^0000FF%d^000000 level effect. Requires ^FF0000%d^000000 ^0000FFCoagulated Spells.^000000", .@equip_name$, .@number, .@cost);
			next;
			if (select("Quit", "Effect Upgrade!") == 1) {
				mes("[Hugin's Magic Master]");
				mes("Ok, come back when you are ready.");
				close;
			}
			if (countitem(Coagulated_Spell) < .@cost) {
				mesf("Hmm, you are missing %d Coagulated Spells. Go get more, and then we can talk about more enchants.", .@cost - countitem(Coagulated_Spell));
				close;
			}
			if (.@random > .@scs) {
				mes("Arrggg, we failed. Better luck next time.");
				specialeffect2 EF_PHARMACY_FAIL;
				delitem Coagulated_Spell, .@cost;
				delequip .@part;
				close;
			}
		}
		break;
	default:
		mes("[Hugin's Magic Master]");
		mes("This is not the right item for this enchant. Remember, only those 6 types of Temporal Boots are available for enchanting.");
		close;
	}
	mes("[Hugin's Magic Master]");
	if (countitem(Coagulated_Spell) < .@cost) {
		mesf("Hmm, you are missing %d Coagulated Spells. Go get more, and then we can talk about more enchants.", .@cost - countitem(Coagulated_Spell));
		close;
	}
	if (.@random > .@scs) {
		mes("Arrggg, we failed. Better luck next time.");
		specialeffect2 EF_PHARMACY_FAIL;
		delitem Coagulated_Spell, .@cost;
		delequip .@part;
		close;
	}
	specialeffect2 EF_REPAIRWEAPON;
	delitem Coagulated_Spell, .@cost;
	delequip .@part;
	mes("[Hugin's Magic Master]");
	mesf("Adding enchant  number ^630000%d^000000.", .@number);
	getitem2 .@equip_id, 1, 1, .@equip_refine, 0, .@card0, 0, 0, .@enchant;
	close;
}

// Socket NPC - Corrupted_Charm or Temporal_Crystal to add card slot
// After the boots were slotted, you can still enchant, but slotting removes any enchants and refines applied before.
// Item Used: Corrupted_Charm, Temporal_Crystal
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
glast_01,210,270,0	script	Hugin's Craftsman	4_F_JOB_BLACKSMITH,{
	disable_items;
	if (MaxWeight - Weight < 1000) {
		mes("Your bag is too heavy. Reduce some weight and come back.");
		close;
	}
	mes("[Hugin's Craftsman]");
	mes("That Magic Master always says that enchanting Temporal Boots is the best. But, I think I can beat that!");
	next;
	mes("[Hugin's Craftsman]");
	mes("I can try putting a slot into your boots. But there is some ^FF0000risk of failing.^000000");
	next;
	mes("[Hugin's Craftsman]");
	mes("Bring me ^0000FF50 Contaminated Magic^000000 or ^0000FF10 Temporal Crystals^000000, and I will try to put a slot into your advanced Temporal Boots.");
	next;
	mes("[Hugin's Craftsman]");
	mes("But, it's possible to ^FF0000fail and break the item^000000. Is that ok?");
	next;
	if (select("Cancel", "Take the risk and try to add a slot") == 1) {
		mes("[Hugin's Craftsman]");
		mes("Ok, come back anytime you want.");
		close;
	}
	.@part = EQI_SHOES;
	if (!getequipisequiped(.@part)) {
	mes("[Hugin's Craftsman]");
	mes("Are you sure you are wearing the item?");
	close;
	}
	.@equip_id = getequipid(.@part);
	switch (.@equip_id) {
	case Temporal_Str_Boots:
	case Temporal_Int_Boots:
	case Temporal_Agi_Boots:
	case Temporal_Vit_Boots:
	case Temporal_Dex_Boots:
	case Temporal_Luk_Boots:
		mes("[Hugin's Craftsman]");
		mes("The ^FF0000Boots and all enchants or refines will be lost if you fail this.^000000\r"
				"Still want to risk it?");
		next;
		if (select("Cancel", "I am ok with it!") == 1) {
			mes("[Hugin's Craftsman]");
			mes("Ok, come back anytime you want.");
			close;
		}
		mes("[Hugin's Craftsman]");
		mes("Once again, ^FF0000That Magic Master won't enchant any item with a slot.^000000\r"
				"Still want to proceed?");
		next;
		if (select("Cancel", "I understand. Try to slot it.") == 1) {
			mes("[Hugin's Craftsman]");
			mes("Ok, come back anytime you want.");
			close;
		}
		mes("[Hugin's Craftsman]");
		mes("Then my last question:\r"
				"Which item are you gonna use to pay me?");
		next;
		setarray .@slotpay[0], Temporal_Crystal, Corrupted_Charm;
		setarray .@slotcost[0], 10, 50;
		setarray .@slotchance[0], 80, 65; // Custom rates
		.@select = select("Cancel", "Temporal Crystal", "Contaminated Magic");
		switch (.@select) {
		case 1:
			mes("[Hugin's Craftsman]");
			mes("Come back anytime you want.");
			close;
		case 2:
		case 3:
			.@item = .@slotpay[.@select-2];
			.@cost = .@slotcost[.@select-2];
			.@chance = .@slotchance[.@select-2];
			if (countitem(.@item) < .@cost) {
				mes("[Hugin's Craftsman]");
				mesf("Requires ^FF0000%d^000000 ^0000FF%s^000000.", .@cost, getitemname(.@item));
				close;
			}
		}
		.@random = rand(1, 100);
		if (.@random > .@chance) {
			mes("[Hugin's Craftsman]");
			mes("Arrggg, we failed. Better luck next time.");
			specialeffect2 EF_PHARMACY_FAIL;
			delitem .@item, .@cost;
			delequip .@part;
			close;
		}
		mes("[Hugin's Craftsman]");
		mesf("Yuhuu~ we succeed. There you go... A slot has been added to your ^FF0000%s^000000. Thank you for believing in me.", getitemname(.@equip_id));
		delitem .@item, .@cost;
		specialeffect2 EF_PHARMACY_OK;
		delequip .@part;
		// todo: read aegis name and attach "_" to worn constant
		if (.@equip_id == Temporal_Str_Boots) {
			getitem2 Temporal_Str_Boots_, 1, 1, 0, 0, 0, 0, 0, 0;
		} else if (.@equip_id == Temporal_Int_Boots) {
			getitem2 Temporal_Int_Boots_, 1, 1, 0, 0, 0, 0, 0, 0;
		} else if (.@equip_id == Temporal_Agi_Boots) {
			getitem2 Temporal_Agi_Boots_, 1, 1, 0, 0, 0, 0, .0, 0;
		} else if (.@equip_id == Temporal_Vit_Boots) {
			getitem2 Temporal_Vit_Boots_, 1, 1, 0, 0, 0, 0, 0, 0;
		} else if (.@equip_id == Temporal_Dex_Boots) {
			getitem2 Temporal_Dex_Boots_, 1, 1, 0, 0, 0, 0, 0, 0;
		} else if (.@equip_id == Temporal_Luk_Boots) {
			getitem2 Temporal_Luk_Boots_, 1, 1, 0, 0, 0, 0, 0, 0;
		}
		close;
	default:
		mes("[Hugin's Craftsman]");
		mes("This is not it! We need ^FF0000Advanced Temporal Boots^000000! The item ^0000FFwith a stat effect and without a slot^000000!");
		close;
	}
}

// Knight Cards
// White Knight Card cost 70 red coagulated spells or 3000 blue coagulated spells
// Khalitzburg Knight Card cost 100 red coagulated spells or 5000 blue coagulated spells
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
glast_01,188,273,5	script	White Knight#1a	4_WHITEKNIGHT,{
	disable_items;
	mes("[White Knight]"); // custom
	if (MaxWeight - Weight < 1000) {
		mes("Your bag is too heavy. Reduce some weight and come back.");
		close;
	}
	mes("I exchange you a White Knight Card for ^0000FF3000 Coagulated Spell^000000 or ^FF000070 Contaminated Magic^000000.");
	mes("<ITEMLINK>White Knight Card<INFO>4608</INFO></ITEMLINK>");
	next;
	setarray .@item[0], Coagulated_Spell, Corrupted_Charm;
	setarray .@cost[0], 3000, 70;
	.@select = select("Cancel", "^0000FFUse Coagulated Spell^000000", "^FF0000Use Contaminated Magic^000000");
	switch (.@select) {
	case 1:
		mes("[White Knight]");
		mes("Come back any time.");
		close;
	case 2:
	case 3:
		.@item = .@item[.@select-2];
		.@cost = .@cost[.@select-2];
		if (countitem(.@item) < .@cost) {
			mes("[White Knight]");
			mesf("Requires ^0000FF%d %s^000000.", .@cost, getitemname(.@item));
			close;
		}
		delitem .@item, .@cost;
		getitem White_Knightage_Card, 1;
		close;
	}
}

glast_01,192,273,3	script	Khalitzburg Knight#1a	4_F_KHALITZBURG,{
	disable_items;
	mes("[Khalitzburg Knight]"); // custom
	if (MaxWeight - Weight < 1000) {
		mes("Your bag is too heavy. Reduce some weight and come back.");
		close;
	}
	mes("I exchange you a Khalitzburg Knight Card for ^0000FF5000 Coagulated Spell^000000 or ^FF0000100 Contaminated Magic^000000.");
	mes("<ITEMLINK>Khalitzburg Knight Card<INFO>4609</INFO></ITEMLINK>");
	next;
	setarray .@item[0], Coagulated_Spell, Corrupted_Charm;
	setarray .@cost[0], 5000, 100;
	.@select = select("Cancel", "^0000FFUse Coagulated Spell^000000", "^FF0000Use Contaminated Magic^000000");
	switch (.@select) {
	case 1:
		mes("[Khalitzburg Knight]");
		mes("Come back any time.");
		close;
	case 2:
	case 3:
		.@item = .@item[.@select-2];
		.@cost = .@cost[.@select-2];
		if (countitem(.@item) < .@cost) {
			mes("[Khalitzburg Knight]");
			mesf("Requires ^0000FF%d %s^000000.", .@cost, getitemname(.@item));
			close;
		}
		delitem .@item, .@cost;
		getitem Khali_Knightage_Card, 1;
		close;
	}
}