summaryrefslogtreecommitdiff
path: root/npc/re/instances/ghost_palace.txt
blob: e4ca12f997eb88e0ec963482576ddcb2fb5fe543 (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
//================= Hercules Script =======================================
//=       _   _                     _
//=      | | | |                   | |
//=      | |_| | ___ _ __ ___ _   _| | ___  ___
//=      |  _  |/ _ \ '__/ __| | | | |/ _ \/ __|
//=      | | | |  __/ | | (__| |_| | |  __/\__ \
//=      \_| |_/\___|_|  \___|\__,_|_|\___||___/
//================= License ===============================================
//= This file is part of Hercules.
//= http://herc.ws - http://github.com/HerculesWS/Hercules
//=
//= Copyright (C)  2016 Hercules Dev Team
//= Copyright (C)  Asheraf
//= Copyright (C)  pengc2010
//=
//= 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/>.
//=========================================================================
//= Ghost Palace
//================= Current Version =======================================
//= 1.1
//=========================================================================

dali02,44,129,5	script	Unpleasent Royal Guard	4_M_SAKRAYROYAL,{
	if (BaseLevel < 120) {
		mes("[Unpleasent Royal Guard]");
		mes("Althought I need help with a task, you are not strong enough to assist me, noob~!");
		next();
		mes("[Unpleasent Royal Guard]");
		mes("Come back after when you have done some training and are at least level 120!");
		close();
	}
	if (questprogress(1261)) {
		mes("[Unpleasent Royal Guard]");
		mes("The monsters that attacked the palace are wandering around the secret entrance. It would be very bad if they spotted us... Please wait until the time limit for re-entrance passed.");
		close();
	}
	if (questprogress(1260)) {
		if (has_instance("1@spa") == "") {
			mes("[Unpleasent Royal Guard]");
			mes("Did the gate close?\r"
				"Please enter the gate as soon as you can next time.");
			erasequest(1260);
			close();
		}
		mes("[Unpleasent Royal Guard]");
		mes("Please go ahead, ^0000ffThe entrance is behind me.^000000\r"
			"I will be right behind you!");
		close();
	}
	.@party_id = getcharid(CHAR_ID_PARTY);
	if (!.@party_id) {
		mes("[Unpleasent Royal Guard]");
		mes("This is a solo instance. Please form a solo party before continuing.");
		close();
	}
	if (getcharid(CHAR_ID_CHAR) != getpartyleader(.@party_id, 2)) {
		mes("[Unpleasent Royal Guard]");
		mes("I'm looking for adventurers to help me!\r"
			"I want to talk to the team leader, can I?");
		close();
	}
	mes("[Unpleasent Royal Guard]");
	mes("I need some help, even from the likes of you.");
	next();
	mes("[Unpleasent Royal Guard]");
	mes("In the middle of the battle the princess disappeared while I was guarding the palace.");
	next();
	mes("[Unpleasent Royal Guard]");
	mes("You run ahead and i will catch up.\r"
		"We must save her.");
	next();
	if (select("I will help.", "This is not a good time.") == 2) {
		mes("[Unpleasent Royal Guard]");
		mes("Even now all the royal guards are fighting and dying to the monsters.");
		next();
		mes("[Unpleasent Royal Guard]");
		mes("We must save the princess no matter how much fear grips our hearts!");
		close();
	}
	.@instance = instance_create(_("Ghost Palace"), .@party_id);
	.@p_name$ = getpartyname(.@party_id);
	.@md_name$ = _("Ghost Palace");
	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@spa", .@instance) != "") {
		instance_set_timeout(3600, 300, .@instance);
		instance_init(.@instance);
		if (!questprogress(1260))
			setquest(1260);
		mes("[Unpleasent Royal Guard]");
		mes("Thank You..\r"
			"I will open the secret passage to ^0000FFGhost Palace.^000000\r"
			"Please be ready!");
		close();
	} else {
		instance_destroy(.@instance);
		mesf("^0000FF%s^000000 - Reservation Failed!", .@md_name$);
		close();
	}
}

dali02,41,134,0	script	Interdimensional Device::gpportal	PORTAL,{
	if (BaseLevel < 120) {
		mes("[Unpleasent Royal Guard]");
		mes("Althought I need help with a task, you are not strong enough to assist me, noob~!");
		next();
		mes("[Unpleasent Royal Guard]");
		mes("Come back after when you have done some training and are at least level 120!");
		close();
	}
	if (questprogress(1261)) {
		if (questprogress(1261, PLAYTIME) == 2) {
			erasequest(1261);
			if (questprogress(1260))
				erasequest(1260);
			end;
		}
		mes("[Unpleasent Royal Guard]");
		mes("The monsters that attacked the palace are wandering around the secret entrance. It would be very bad if they spotted us... Please wait until the time limit for re-entrance passed.");
		close();
	}
	if (getcharid(CHAR_ID_CHAR) == getpartyleader(.@party_id, 2) && !questprogress(1260)) {
		mes("[Unpleasent Royal Guard]");
		mes("I'm looking for adventurers to help me!\r"
			"I want to talk to the team leader, can I?");
		close();
	}
	mes("[Unpleasent Royal Guard]");
	mes("I can see the secret passage into the Palace... Are you ready to save the princess?!");
	next();
	if (select("Enter", "Stop") == 2) {
		mes("[Unpleasent Royal Guard]");
		mes("Even now all the royal guards are fighting and dying to the monsters.");
		next();
		mes("[Unpleasent Royal Guard]");
		mes("We must save the princess no matter how much fear grips our hearts!");
		close();
	}
	if (has_instance("1@spa") == "") {
		mes("^FF0000Inside the device you see a dark hole. If you wish to enter you may wish to talk to the Unpleasant Royal Guard first.^000000");
		close();
	}
	mapannounce("dali", sprintf(_$("%s of the party, %s, is entering the Ghost Palace."), strcharinfo(PC_NAME), getpartyname(getcharid(CHAR_ID_PARTY))), bc_map, C_SPRINGGREEN);
	if (!questprogress(1260))
		setquest(1260);
	setquest(1261);
	warp("1@spa", 198, 188);
	close();
}

1@spa,197,204,5	script	King#gp1	4_M_RUSKING,{
	mes("[King]");
	mes("You are hereby appointed as the personal guard to Princess Tiara. I trust your loyalty above all else.");
	npctalk(_("You are hereby appointed as the personal guard to Princess Tiara. I trust your loyalty above all else."), instance_npcname("King#gp1"));
	next();
	mes("[Lurid Royal Guard]");
	mes("I will protect the Princess with my life.");
	npctalk(_("I will protect the Princess with my life."), instance_npcname("Lurid Royal Guard#gp1"));
	next();
	mes("[King]");
	mes("The marriage arrangements are going as planned. The prince is here to meet the princess.");
	npctalk(_("The marriage arrangements are going as planned. The prince is here to meet the princess."), instance_npcname("King#gp1"));
	next();
	mes("[Lurid Royal Guard]");
	mes("...Yes, your majesty.");
	npctalk(_("...Yes, your majesty."), instance_npcname("Lurid Royal Guard#gp1"));
	next();
	mes("[King]");
	mes("My gods, there are monsters in the castle! Get rid of them now!");
	npctalk(_("My gods, there are monsters in the castle! Get rid of them now!"), instance_npcname("King#gp1"));
	close2();
	donpcevent(instance_npcname("#gp1control")+"::OnStart");
	end;
}

1@spa,1,1,1	script	#gp1control	HIDDEN_NPC,{
	end;
OnStart:
	hideonnpc(instance_npcname("Lurid Royal Guard#gp1"));
	hideonnpc(instance_npcname("King#gp1"));
	sleep(1000);
OnSummon:
	sleep(2000);
	.@map$ = instance_mapname("1@spa");
	areamonster(.@map$, 182, 190, 214, 214, _("Cursed Sentinel"), CURSED_SENTINEL, 2, instance_npcname("#gp1control")+"::OnMyMobDead");
	areamonster(.@map$, 182, 190, 214, 214, _("Cursed Solider"), CURSED_SOLDIER, 2, instance_npcname("#gp1control")+"::OnMyMobDead");
	end;
OnMyMobDead:
	if (mobcount(instance_mapname("1@spa"), instance_npcname("#gp1control")+"::OnMyMobDead"))
		end;
	if ('gp1 < 2) {
		++'gp1;
		donpcevent(instance_npcname("#gp1control")+"::OnSummon");
		end;
	}
	mapannounce(instance_mapname("1@spa"), _("The passage on 2nd floor in the palace of the ghost is open."), bc_map, C_YELLOW);
	enablenpc(instance_npcname("#gp1warp"));
	disablenpc(instance_npcname("#gp1control"));
	end;
OnInstanceInit:
	'gp1 = 0;
	disablenpc(instance_npcname("#gp1warp"));
	end;
}

1@spa,132,122,0	script	Lurid Royal Guard#gp2	4_M_SAKRAYROYAL,{
	cutin("npc-tiara", 3);
	mes("[Lurid Royal Guard]");
	mes("Your Highness, the King has invited a prince from a neighboring country to be your betrothed. Be ready to meet him...");
	npctalk(_("Your Highness, the King has invited a prince from a neighboring country to be your betrothed. Be ready to meet him..."), instance_npcname("Lurid Royal Guard#gp2"));
	next();
	mes("[Princess Tiara]");
	mes("If...if a marriage is arranged what should I do ?");
	npctalk(_("If...if a marriage is arranged what should I do ?"), instance_npcname("Tiara Princess#gp2"));
	next();
	mes("[Lurid Royal Guard]");
	mes("The only thing I can do is protect you from physical harm.");
	npctalk(_("The only thing I can do is protect you from physical harm."), instance_npcname("Lurid Royal Guard#gp2"));
	next();
	mes("[Princess Tiara]");
	mes("Then, what can I do?");
	npctalk(_("Then, what can I do?"), instance_npcname("Tiara Princess#gp2"));
	next();
	mes("[Lurid Royal Guard]");
	mes("......");
	mes("You must decide that for yourself your highness...");
	npctalk(_("You must decide that for yourself your highness..."), instance_npcname("Lurid Royal Guard#gp2"));
	next();
	mes("[Princess Tiara]");
	mes("Would it be easier for you if I were married and sent off to another country?");
	npctalk(_("Would it be easier for you if I were married and sent off to another country?"), instance_npcname("Tiara Princess#gp2"));
	next();
	cutin("", 255);
	mes("[Lurid Royal Guard]");
	mes("I will alway stand by you and protect you forever.");
	npctalk(_("I will alway stand by you and protect you forever."), instance_npcname("Lurid Royal Guard#gp2"));
	next();
	mes("[Princess Tiara]");
	mes("Monsters in the castle? Protect me!");
	npctalk(_("Monsters in the castle? Protect me!"), instance_npcname("Tiara Princess#gp2"));
	next();
	mes("[Lurid Royal Guard]");
	mes("Step back, Let's go!");
	npctalk(_("Step back, Let's go!"), instance_npcname("Lurid Royal Guard#gp2"));
	close2();
	donpcevent(instance_npcname("#gp2control")+"::OnStart");
	end;
}

1@spa,1,1,1	script	#gp2control	HIDDEN_NPC,{
	end;
OnStart:
	hideonnpc(instance_npcname("Lurid Royal Guard#gp2"));
	hideonnpc(instance_npcname("Tiara Princess#gp2"));
	sleep(1000);
OnSummon:
	sleep(2000);
	.@map$ = instance_mapname("1@spa");
	areamonster(.@map$, 143, 96, 94, 143, _("Broken Mind"), BROKEN_MIND, 3, instance_npcname("#gp2control")+"::OnMyMobDead");
	areamonster(.@map$, 143, 96, 94, 143, _("Floating Word"), FLOATING_WORD, 4, instance_npcname("#gp2control")+"::OnMyMobDead");
	areamonster(.@map$, 143, 96, 94, 143, _("Like Love"), LIKE_LOVE, 3, instance_npcname("#gp2control")+"::OnMyMobDead");
	end;
OnMyMobDead:
	if (mobcount(instance_mapname("1@spa"), instance_npcname("#gp2control")+"::OnMyMobDead"))
		end;
	mapannounce(instance_mapname("1@spa"), _("The passage on the 3rd floor of the palace is open."), bc_map, C_YELLOW);
	enablenpc(instance_npcname("#gp2warp"));
	disablenpc(instance_npcname("#gp2control"));
	end;
OnInstanceInit:
	disablenpc(instance_npcname("#gp2warp"));
	end;
}

1@spa,32,54,1	script	King#gp3	4_M_RUSKING,{
	mes("[King]");
	mes("It was you who brought the monsters here, you want to get rid of me and have the princess for yourself?");
	npctalk(_("It was you who brought the monsters here, you want to get rid of me and have the princess for yourself?"), instance_npcname("King#gp3"));
	next();
	mes("[Lurid Royal Guard]");
	mes("It's a trap, you should trust me, your majesty!");
	npctalk(_("It's a trap, you should trust me, your majesty!"), instance_npcname("Lurid Royal Guard#gp3"));
	next();
	mes("[King]");
	mes("Shut up! You're betrayed me ! I trusted you... you must pay for your disgrace.");
	npctalk(_("Shut up! You're betrayed me ! I trusted you... you must pay for your disgrace."), instance_npcname("King#gp3"));
	next();
	mes("[King]");
	mes("You will suffer for the rest of your life.");
	npctalk(_("You will suffer for the rest of your life."), instance_npcname("King#gp3"));
	close2();
	donpcevent(instance_npcname("#gp3control")+"::OnStart");
	end;
}

1@spa,54,28,0	script	#gp3warp	WARPNPC,1,1,{
	if (!'gp5) {
		warp("1@spa", 218, 186);
	} else {
		if (questprogress(40024))
			completequest(40024);
		mes("It is time to leave Palace of the ghost.\r"
			"Everything is completed.\r"
			"Everything will be vanished...");
		close2();
		if (first_time_gpmission)
			getitem(Gray_Shard, 1);
		if (!first_time_gpmission) {
			getitem(Gray_Shard, 2);
			getexp(900000, 500000);
			++first_time_gpmission;
		}
		warp("dali02", 49, 127);
		end;
	}
	end;
}

1@spa,35,56,1	script	Ominous Voice#gp3	4_TRACE,{
	end;
OnStart:
	initnpctimer();
	end;
OnTimer3000:
	npctalk(_("Oh, faithful royal guard, you are trapped."));
	end;
OnTimer6000:
	npctalk(_("The conspiracy in the palace has your princess in grave danger..."));
	end;
OnTimer9000:
	npctalk(_("Who are you? Show yourself!"), instance_npcname("Lurid Royal Guard#gp3"));
	end;
OnTimer12000:
	npctalk(_("Ah... so you do hear me?"));
	end;
OnTimer15000:
	npctalk(_("...?"), instance_npcname("Lurid Royal Guard#gp3"));
	end;
OnTimer18000:
	npctalk(_("I...I..."), instance_npcname("Lurid Royal Guard#gp3"));
	end;
OnTimer21000:
	npctalk(_("Kukuku... What do you want boy?"));
	end;
OnTimer24000:
	stopnpctimer();
	hideonnpc(instance_npcname("Ominous Voice#gp3"));
	hideonnpc(instance_npcname("Lurid Royal Guard#gp3"));
	donpcevent(instance_npcname("#gp3control")+"::OnSummon");
	end;
}

1@spa,1,1,1	script	#gp3control	HIDDEN_NPC,{
	end;
OnStart:
	hideonnpc(instance_npcname("King#gp3"));
	hideonnpc(instance_npcname("Soldier#gp3_1"));
	hideonnpc(instance_npcname("Soldier#gp3_2"));
	hideonnpc(instance_npcname("Soldier#gp3_3"));
	hideonnpc(instance_npcname("Captain of the Guard#gp3"));
	donpcevent(instance_npcname("Ominous Voice#gp3")+"::OnStart");
	end;
OnSummon:
	initnpctimer();
	.@map$ = instance_mapname("1@spa");
	'talkid[0] = areamonster(.@map$, 61, 63, 24, 24, _("Cursed Memory"), CURSED_MEMORY, 2 + 'gp3, instance_npcname("#gp3control")+"::OnMyMobDead");
	'talkid[1] = areamonster(.@map$, 61, 63, 24, 24, _("Colorless Vow"), COLORLESS_VOW, 3 + 'gp3, instance_npcname("#gp3control")+"::OnMyMobDead");
	'talkid[2] = areamonster(.@map$, 61, 63, 24, 24, _("Old Friendship"), OLD_FRIENDSHIP, 2 + 'gp3, instance_npcname("#gp3control")+"::OnMyMobDead");
	end;
OnTimer2000:
	stopnpctimer();
	unittalk('talkid[0], _("Faithful Guards"));
	unittalk('talkid[1], _("Run!"));
	unittalk('talkid[2], _("Being framed..."));
	end;
OnMyMobDead:
	if (mobcount(instance_mapname("1@spa"), instance_npcname("#gp3control")+"::OnMyMobDead"))
		end;
	if (!'gp3) {
		mapannounce(instance_mapname("1@spa"), _("The passage on the 4rd floor of the palace is open."), bc_map, C_YELLOW);
		enablenpc(instance_npcname("#gp3warp"));
		donpcevent(instance_npcname("#gp4control")+"::OnSummon");
		disablenpc(instance_npcname("#gp1warp"));
	}
	++'gp3;
	if ('gp3 < 5) {
		donpcevent(instance_npcname("#gp3control")+"::OnSummon");
	} else {
		stopnpctimer();
		disablenpc(instance_npcname("#gp3control"));
	}
	end;
OnInstanceInit:
	disablenpc(instance_npcname("#gp3warp"));
	'gp3 = 0;
	end;
}

1@spa,199,214,1	script	Lurid Royal Guard#gp4	4_M_SAKRAYROYAL,{
	mes("[Lurid Royal Guard]");
	mes("Where is Princess Tiara?");
	npctalk(_("Where is Princess Tiara?"), instance_npcname("Lurid Royal Guard#gp4"));
	next();
	mes("[Visiting Prince]");
	mes("You are too late... but you brought what I was looking for. Thanks for your help.");
	npctalk(_("You are too late... but you brought what I was looking for. Thanks for your help."), instance_npcname("Visiting Prince#gp4"));
	next();
	mes("[Visiting Prince]");
	mes("Cursed Thanatos Magic Trace! Are you ready to have a new master?");
	npctalk(_("Cursed Thanatos Magic Trace! Are you ready to have a new master?"), instance_npcname("Visiting Prince#gp4"));
	next();
	cutin("tartanos", 3);
	mes("[Thanatos Magic Trace]");
	mes("How dare you!");
	npctalk(_("How dare you!"), instance_npcname("Thanatos Magic Trace#gp4"));
	next();
	mes("[Visiting Prince]");
	mes("Aah, aah!!!");
	npctalk(_("Aah, aah!!!"), instance_npcname("Visiting Prince#gp4"));
	close2();
	cutin("", 255);
	donpcevent(instance_npcname("#gp4control")+"::OnBoss");
	end;
}

1@spa,1,1,1	script	#gp4control	HIDDEN_NPC,{
	end;
OnStart:
	end;
OnSummon:
	.@map$ = instance_mapname("1@spa");
	areamonster(.@map$, 182, 217, 214, 188, _("Cursed Sentinel"), CURSED_SENTINEL, rand(2, 3), instance_npcname("#gp4control")+"::OnMyMobDead");
	areamonster(.@map$, 182, 217, 214, 188, _("Sweet Slaughter"), SWEET_SLAUGHTER, rand(2, 3), instance_npcname("#gp4control")+"::OnMyMobDead");
	end;
OnMyMobDead:
	if (mobcount(instance_mapname("1@spa"), instance_npcname("#gp4control")+"::OnMyMobDead"))
		end;
	++'gp4;
	if ('gp4 > 3)
		donpcevent(instance_npcname("#gp4control")+"::OnStory");
	else
		donpcevent(instance_npcname("#gp4control")+"::OnSummon");
	end;
OnStory:
	for(.@i = 1; .@i <= 4; ++.@i)
		enablenpc(instance_npcname("Soldier's Corpse#gp4_"+.@i));
	enablenpc(instance_npcname("Captain's Corpse#gp4"));
	enablenpc(instance_npcname("King's Corpse#gp4"));
	enablenpc(instance_npcname("Lurid Royal Guard#gp4"));
	enablenpc(instance_npcname("Thanatos Magic Trace#gp4"));
	enablenpc(instance_npcname("Visiting Prince#gp4"));
	end;
OnBoss:
	for(.@i = 1; .@i <= 4; ++.@i)
		hideonnpc(instance_npcname("Soldier's Corpse#gp4_"+.@i));
	hideonnpc(instance_npcname("Captain's Corpse#gp4"));
	hideonnpc(instance_npcname("King's Corpse#gp4"));
	hideonnpc(instance_npcname("Lurid Royal Guard#gp4"));
	hideonnpc(instance_npcname("Thanatos Magic Trace#gp4"));
	hideonnpc(instance_npcname("Visiting Prince#gp4"));
	sleep(1000);
	monster(instance_mapname("1@spa"), 197, 218, _("Torturous Redeemer"), TORTUROUS_REDEEMER, 1, instance_npcname("#gp4control")+"::OnBossDead");
	end;
OnBossDead:
	monster(instance_mapname("1@spa"), 197, 180, _("Sweet Slaughter"), SWEET_SLAUGHTER, 1, instance_npcname("#gp4control")+"::OnMobDead");
	end;
OnMobDead:
	mapannounce(instance_mapname("1@spa"), _("The passage on the 5th floor of the palace is open."), bc_map, C_YELLOW);
	enablenpc(instance_npcname("#gp4warp"));
	donpcevent(instance_npcname("#gp5control")+"::OnStart");
	disablenpc(instance_npcname("#gp4control"));
	end;
OnInstanceInit:
	disablenpc(instance_npcname("#gp4warp"));
	for(.@i = 1; .@i <= 4; ++.@i)
		disablenpc(instance_npcname("Soldier's Corpse#gp4_"+.@i));
	disablenpc(instance_npcname("Captain's Corpse#gp4"));
	disablenpc(instance_npcname("King's Corpse#gp4"));
	disablenpc(instance_npcname("Lurid Royal Guard#gp4"));
	disablenpc(instance_npcname("Thanatos Magic Trace#gp4"));
	disablenpc(instance_npcname("Visiting Prince#gp4"));
	'gp4 = 0;
	end;
}

1@spa,57,42,0	script	Lurid Royal Guard#gp5	4_M_SAKRAYROYAL,{
	mes("[Princess Tiara]");
	mes("You kept your promise.");
	npctalk(_("You kept your promise."), instance_npcname("Tiara Princess#gp5"));
	next();
	mes("[Lurid Royal Guard]");
	mes("princess!");
	npctalk(_("princess"), instance_npcname("Lurid Royal Guard#gp5"));
	next();
	cutin("npc-tiara", 3);
	mes("[Princess Tiara]");
	mes("Thank you..now I can rest at beside you...");
	npctalk(_("Thank you..now I can rest at beside you..."), instance_npcname("Tiara Princess#gp5"));
	next();
	mes("[Lurid Royal Guard]");
	mes("No..NO!!!!!!");
	npctalk(_("No..NO!!!!!!"), instance_npcname("Lurid Royal Guard#gp5"));
	next();
	mes("[The Voice of Princess Tiara]");
	mes("I want to be with you forever in peace...forever...");
	npctalk(_("I want to be with you forever in peace...forever..."), instance_npcname("Tiara Princess#gp5"));
	next();
	cutin("b-tiara", 3);
	mes("[Lurid Royal Guard]");
	mes("no.....Ahh ahh ahh!!!~!");
	npctalk(_("no.....Ahh ahh ahh!!!~!"), instance_npcname("Lurid Royal Guard#gp5"));
	next();
	mes("[The Voice of Princess Tiara]");
	mes("I love you...");
	npctalk(_("I love you..."), instance_npcname("Tiara Princess#gp5"));
	close2();
	cutin("", 255);
	donpcevent(instance_npcname("#gp5control")+"::OnStart2");
	end;
}

1@spa,40,44,6	script	Sakray#gp5	4_M_SAKRAY,{
	cutin("sakray", 3);
	mes("[Lurid Royal Guard]");
	mes("Are you satisfied..? Thanatos Magic Trace?");
	npctalk(_("Are you satisfied..? Thanatos Magic Trace?"), instance_npcname("Sakray#gp5"));
	next();
	mes("[Thanatos Magic Trace]");
	mes("I need more blood..Sakray, offer me his blood.");
	npctalk(_("I need more blood..Sakray, offer me his blood."), instance_npcname("Thanatos Magic Trace#gp5"));
	next();
	mes("[Sakray]");
	mes("Okay, that is good. A traveler.\r"
		"Did you see?");
	npctalk(_("Okay, that is good. A traveler. Did you see?"), instance_npcname("Sakray#gp5"));
	next();
	mesf("[%s]", strcharinfo(PC_NAME));
	mes("Sakray, What do you want sympathy? Or is it a trap?");
	unittalk(getcharid(CHAR_ID_ACCOUNT), _("Sakray, What do you want sympathy? Or is it a trap?"));
	next();
	mes("[Sakray]");
	mes("Non...I did not need to make an effort to catch a novice.");
	npctalk(_("Non...I did not need to make an effort to catch a novice."), instance_npcname("Sakray#gp5"));
	next();
	mesf("[%s]", strcharinfo(PC_NAME));
	mes("If so... then why...?");
	unittalk(getcharid(CHAR_ID_ACCOUNT), _("If so... then why...?"));
	next();
	cutin("cry-b", 3);
	mes("[Sakray]");
	mes("I wanted to get rid of a piece of humanity inside of me through you.");
	npctalk(_("I wanted to get rid of a piece of humanity inside of me through you."), instance_npcname("Sakray#gp5"));
	next();
	mes("[Sakray]");
	mes("I am quite satisfied with the result.");
	next();
	mes("[Thanatos Magic Trace]");
	mes("Sakray, offer the blood to me now!");
	npctalk(_("Sakray, offer the blood to me now!"), instance_npcname("Thanatos Magic Trace#gp5"));
	next();
	mes("[Sakray]");
	mes("If you were me, what would you do?");
	next();
	mes("[Sakray]");
	mes("Can you set yourself free from this curse?");
	next();
	mesf("[%s]", strcharinfo(PC_NAME));
	mes("...");
	unittalk(getcharid(CHAR_ID_ACCOUNT), _("..."));
	next();
	mes("[Sakray]");
	mes("Heh heh... I will keep watching you until the day you grow up enough.");
	next();
	mes("[Sakray]");
	mes("I am willing to hunt you later for Thanatos.");
	next();
	cutin("", 255);
	mes("[Sakray]");
	mes("Farewell then.");
	close2();
	donpcevent(instance_npcname("#gp5control")+"::OnEnd");
	hideonnpc(instance_npcname("Sakray#gp5"));
	hideonnpc(instance_npcname("Thanatos Magic Trace#gp5"));
	end;
}

1@spa,1,1,1	script	#gp5control	HIDDEN_NPC,{
	end;
OnStart:
	stopnpctimer instance_npcname("#gp3control");
	disablenpc(instance_npcname("#gp3control"));
	killmonster(instance_mapname("1@spa"), "All");
	disablenpc(instance_npcname("#gp3warp"));
	enablenpc(instance_npcname("Lurid Royal Guard#gp5"));
	enablenpc(instance_npcname("Tiara Princess#gp5"));
	end;
OnStart2:
	hideonnpc(instance_npcname("Lurid Royal Guard#gp5"));
	hideonnpc(instance_npcname("Tiara Princess#gp5"));
	sleep(2000);
OnSummon:
	initnpctimer();
	.@map$ = instance_mapname("1@spa");
	'talkid[0] = areamonster(.@map$, 61, 63, 24, 24, _("Forgotten Name"), FORGOTTEN_NAME, rand(1, 2), instance_npcname("#gp5control")+"::OnMyMobDead");
	'talkid[1] = areamonster(.@map$, 61, 63, 24, 24, _("Colorless Vow"), COLORLESS_VOW, 2, instance_npcname("#gp5control")+"::OnMyMobDead");
	'talkid[2] = areamonster(.@map$, 61, 63, 24, 24, _("Sweet Slaughter"), SWEET_SLAUGHTER, rand(1, 2), instance_npcname("#gp5control")+"::OnMyMobDead");
	end;
OnTimer2000:
	stopnpctimer();
	unittalk('talkid[0], _("What is this..??"));
	unittalk('talkid[1], _("Wake up! look at us... We are monsters?"));
	unittalk('talkid[2], _("Sakray killed the princess!"));
	end;
OnMyMobDead:
	if (mobcount(instance_mapname("1@spa"), instance_npcname("#gp5control")+"::OnMyMobDead"))
		end;
	++'gp5;
	if ('gp5 > 2)
		donpcevent(instance_npcname("#gp5control")+"::OnStory");
	else
		donpcevent(instance_npcname("#gp5control")+"::OnSummon");
	end;
OnBossDead:
	enablenpc(instance_npcname("Sakray#gp5"));
	enablenpc(instance_npcname("Thanatos Magic Trace#gp5"));
	end;
OnStory:
	stopnpctimer();
	'BossID = monster(instance_mapname("1@spa"), 44, 47, _("Torturous Redeemer"), E_TORTUROUS_REDEEMER, 1, instance_npcname("#gp5control")+"::OnBossDead");
	unittalk('BossID, _("Thanatos Magic Trace! I will destroy you if I can't have you... Oh no! How could this be?"));
	sleep(3000);
	unitkill('BossID);
	end;
OnEnd:
	hideoffnpc(instance_npcname("Voice of Princess Tiara"));
	hideoffnpc(instance_npcname("Voice of Sakray"));
	hideoffnpc(instance_npcname("Thanatos Magic Trace"));
	npctalk(_("What can I do for you?"), instance_npcname("Voice of Princess Tiara"));
	sleep(3000);
	npctalk(_("I will always stand by you. Please reset beside me."), instance_npcname("Voice of Sakray"));
	sleep(3000);
	npctalk(_("Your soul is mine until you find the blood that satisfies me.."), instance_npcname("Thanatos Magic Trace"));
	sleep(3000);
	npctalk(_("Reset in the shadow with me."), instance_npcname("Voice of Sakray"));
	sleep(3000);
	npctalk(_("In the dark forever..."), instance_npcname("Voice of Sakray"));
	sleep(3000);
	mapannounce(instance_mapname("1@spa"), _("It is time to leave the Ghost Palace."), bc_map, C_YELLOW);
	enablenpc(instance_npcname("King#gpend"));
	enablenpc(instance_npcname("#gp3warp"));
	hideonnpc(instance_npcname("Voice of Princess Tiara"));
	hideonnpc(instance_npcname("Voice of Sakray"));
	hideonnpc(instance_npcname("Thanatos Magic Trace"));
	end;
OnInstanceInit:
	disablenpc(instance_npcname("Lurid Royal Guard#gp5"));
	disablenpc(instance_npcname("Tiara Princess#gp5"));
	disablenpc(instance_npcname("Thanatos Magic Trace#gp5"));
	disablenpc(instance_npcname("Sakray#gp5"));
	disablenpc(instance_npcname("King#gpend"));
	hideonnpc(instance_npcname("Voice of Princess Tiara"));
	hideonnpc(instance_npcname("Voice of Sakray"));
	hideonnpc(instance_npcname("Thanatos Magic Trace"));
	'gp5 = 0;
	end;
}

1@spa,48,29,1	script	King#gpend	4_M_RUSKING,{
	mes("[King]");
	mes("Hey there, are you alive?\r"
		"I did not expect to meet someone alive");
	next();
	mes("[King]");
	mes("Do you possibly have ^009900Gray Piece^000000?\r"
		"Can you give it to me?\r"
		"The old memory of faithful royal guard,\r"
		"the memory of everyone he loved becomes broken pieces and are contained inside of them.");
	next();
	mes("[King]");
	mes("Will you give ^009900Gray Piece^000000 to me?\r"
		"The guilt is eating my soul.\r"
		"My soul is stuck in ghost palace.");
	next();
	mes("[King]");
	mes("I am collecting Sakray's abandoned memories from these shards.");
	next();
	mes("[King]");
	mes("If you give any Gray Shards to me, I can make equipment for you.");
	next();
	mes("[King]");
	mes("The cursed knight...\r"
		"Please help me save the soul of Sakray.");
	next();
	setarray(.@items_list,
			 Thanos_Sword, Thanos_Great_Sword, Thanos_Spear, Thanos_Long_Spear, Thanos_Staff, Thanos_Rod, Thanos_Bow,
			 Thanos_Dagger, Thanos_Katar, Thanos_Knuckle, Thanos_Hammer, Thanos_Axe, Thanos_Violin, Thanos_Whip, Shield_Of_Gray,
			 Armor_Of_Gray, Gray_Robe, Cloak_Of_Gray, Boots_Of_Gray, Gray_Helmet);

	setarray(.@cost, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 100, 100, 100, 100, 100, 100);
	.@menulist$ = "";
	for (.@i = 0; .@i < getarraysize(.@items_list); ++.@i)
		.@menulist$ += getitemname(.@items_list[.@i])+":";
	while (true) {
		.@choice = select(.@menulist$, "Cancel") - 1;
		if (.@choice == getarraysize(.@items_list)) {
			mes("[King]");
			mes("Someday, Sakray will get out of his curse for sure.\r"
				"I believe collecting Gray Shards is the only method to save him.");
			close();
		}
		next();
		mes("[King]");
		mesf("to make a ^FF0000%s^000000 \r"
			 "I need %d ^009900Gray Shard^000000", getitemname(.@items_list[.@choice]), .@cost[.@choice]);
		switch (select("Cancel", sprintf(_$("hand over %d Gray Shard."), .@cost[.@choice]))) {
		case 1:
			next();
			mes("[King]");
			mes("Someday, Sakray will get out of curse for sure. I believe");
			next();
			break;
		case 2:
			next();
			if (countitem(Gray_Shard) < .@cost[.@choice]) {
				mes("[King]");
				mes("You don't have enough Gray Shards.");
				mesf("I need %d Gray Shards to make a ^FF0000%s.^000000", .@cost[.@choice], getitemname(.@items_list[.@choice]));
				break;
			}
			mes("[King]");
			mesf("I will make a ^FF0000%s^000000 \r"
				 "with %d ^009900Gray Shard^000000", getitemname(.@items_list[.@choice]), .@cost[.@choice]);
			next();
			mes("[King]");
			mes("You see a light through the folded hands of the king and it gradually takes on a shape.");
			next();
			mes("[King]");
			mesf("All right, it is done.\r"
				 "Take this ^FF0000%s.^000000\r"
				 "Use it to confront Sakray and Thanatos.", getitemname(.@items_list[.@choice]));
			next();
			mes("[King]");
			mes("The power requires a sacrifice.\r"
				"Please be careful...");
			delitem(Gray_Shard, .@cost[.@choice]);
			getitem(.@items_list[.@choice], 1);
			close();
		}
	}
}

// 1st floor npc's
1@spa,198,201,1	script	Lurid Royal Guard#gp1	4_M_SAKRAYROYAL,{
	end;
}

1@spa,197,217,0	warp	#gp1warp	1,1,1@spa,114,120

// 2nd floor npc's
1@spa,135,125,3	script	Tiara Princess#gp2	4_F_MAYSEL,{
	end;
}

1@spa,117,137,0	warp	#gp2warp	1,1,1@spa,60,43

// 3rd floor npc's
1@spa,30,58,5	script	Lurid Royal Guard#gp3	4_M_SAKRAY_TIED,{
	end;
}

1@spa,28,52,0	script	Captain of the Guard#gp3	4_M_KY_KNT,{
	end;
}

1@spa,30,52,0	script	Soldier#gp3_1	4_M_KY_SOLD,{
	end;
}

1@spa,34,53,1	script	Soldier#gp3_2	4_M_CRU_SOLD,{
	end;
}

1@spa,25,53,0	script	Soldier#gp3_3	4_M_CRU_SOLD,{
	end;
}

// 4th floor npc's
1@spa,201,198,1	script	Soldier's Corpse#gp4_1	4_M_DIEMAN,{
	end;
}

1@spa,191,207,0	script	Soldier's Corpse#gp4_2	4_M_DIEMAN,{
	end;
}

1@spa,206,209,0	script	Soldier's Corpse#gp4_3	4_M_DIEMAN,{
	end;
}

1@spa,189,193,0	script	Soldier's Corpse#gp4_4	4_M_DIEMAN,{
	end;
}

1@spa,211,194,4	script	Captain's Corpse#gp4	4_M_LIEMAN,{
	end;
}

1@spa,194,214,5	script	King's Corpse#gp4	4_M_TRISTAN,{
	end;
}

1@spa,197,218,5	script	Visiting Prince#gp4	4_M_KNIGHT_SILVER,{
	end;
}

1@spa,197,218,0	script	Thanatos Magic Trace#gp4	HIDDEN_WARP_NPC,{
	end;
}

1@spa,178,186,0	warp	#gp4warp	1,1,1@spa,30,57

// 5th floor npc's
1@spa,60,43,3	script	Tiara Princess#gp5	4_F_MAYSEL,{
	end;
}

1@spa,40,44,0	script	Thanatos Magic Trace#gp5	HIDDEN_WARP_NPC,{
	end;
}

1@spa,40,46,0	script	Voice of Princess Tiara	CLEAR_NPC,{
	end;
}

1@spa,42,43,0	script	Voice of Sakray	CLEAR_NPC,{
	end;
}

1@spa,40,41,0	script	Thanatos Magic Trace	CLEAR_NPC,{
	end;
}