summaryrefslogtreecommitdiff
path: root/npc
diff options
context:
space:
mode:
Diffstat (limited to 'npc')
-rw-r--r--npc/014-5/sagratha.txt19
-rw-r--r--npc/015-8/config.txt43
-rw-r--r--npc/015-8/sealedshrine.txt15
3 files changed, 32 insertions, 45 deletions
diff --git a/npc/014-5/sagratha.txt b/npc/014-5/sagratha.txt
index 455ea04c8..d06a3e9b0 100644
--- a/npc/014-5/sagratha.txt
+++ b/npc/014-5/sagratha.txt
@@ -124,23 +124,8 @@ L_Open:
//addmapmask instance_mapname("014-5-1"), 1;
changemusic "014-5-1", "eric_matyas_ghouls.ogg";
*/
- .@q2=getq2(HurnscaldQuest_Sagratha);
- // Map name limit: 4 chars (sgt1)
- .@mapn$="sgt1@"+getcharid(0);
- .@map2$="sgt2@"+getcharid(0);
- if (isinstance(.@q2) && .@q2 != 0) {
- warp .@mapn$, 33, 44;
- } else {
- .@inst = instance_create("Sagratha House "+getcharid(0), getcharid(3), IOT_CHAR);
- instance_attachmap("014-5-1", .@inst, false, .@mapn$);
- //instance_attachmap("015-8", .@inst, false, .@mapn$);
- instance_attachmap("015-8-1", .@inst, false, .@map2$);
- // 40 minutes (2400s) inside, or 5 minutes (300s) outside
- instance_set_timeout(2400, 300, .@inst);
- instance_init(.@inst);
- setq2 HurnscaldQuest_Sagratha, .@inst;
- warp .@mapn$, 33, 44;
- }
+ .@mapn$=SaggyInstCheck();
+ warp .@mapn$, 33, 44;
changemusic .@mapn$, "eric_matyas_ghouls.ogg";
closeclientdialog;
close;
diff --git a/npc/015-8/config.txt b/npc/015-8/config.txt
index c7c8343d7..75fa95002 100644
--- a/npc/015-8/config.txt
+++ b/npc/015-8/config.txt
@@ -6,6 +6,34 @@
015-8 mapflag zone MMO
+// Check instances and rebuild if needed
+// Returns map name
+// SaggyInstCheck( {house=true} )
+function script SaggyInstCheck {
+ .@house=getarg(0, true);
+
+ .@q2=getq2(HurnscaldQuest_Sagratha);
+ // Map name limit: 4 chars (sgt1)
+ .@mapn$="sgt1@"+getcharid(0);
+ .@map2$="sgt2@"+getcharid(0);
+ if (!(isinstance(.@q2) && .@q2 != 0)) {
+ .@inst = instance_create("Sagratha House "+getcharid(0), getcharid(3), IOT_CHAR);
+ instance_attachmap("014-5-1", .@inst, false, .@mapn$);
+ //instance_attachmap("015-8", .@inst, false, .@mapn$);
+ instance_attachmap("015-8-1", .@inst, false, .@map2$);
+ // 40 minutes (2400s) inside, or 5 minutes (300s) outside
+ instance_set_timeout(2400, 300, .@inst);
+ instance_init(.@inst);
+ setq2 HurnscaldQuest_Sagratha, .@inst;
+ }
+
+ if (.@house) {
+ return .@mapn$;
+ } else {
+ return .@map2$
+ }
+}
+
015-8,99,179,0 script #Exit0158 NPC_HIDDEN,0,0,{
end;
@@ -24,20 +52,7 @@ OnTouch:
mesc l("Return to Sagratha's House?");
if (askyesno() == ASK_YES) {
- .@q2=getq2(HurnscaldQuest_Sagratha);
- // Map name limit: 4 chars (sgt1)
- .@mapn$="sgt1@"+getcharid(0);
- .@map2$="sgt2@"+getcharid(0);
- if (!(isinstance(.@q2) && .@q2 != 0)) {
- .@inst = instance_create("Sagratha House "+getcharid(0), getcharid(3), IOT_CHAR);
- instance_attachmap("014-5-1", .@inst, false, .@mapn$);
- //instance_attachmap("015-8", .@inst, false, .@mapn$);
- instance_attachmap("015-8-1", .@inst, false, .@map2$);
- // 40 minutes (2400s) inside, or 5 minutes (300s) outside
- instance_set_timeout(2400, 300, .@inst);
- instance_init(.@inst);
- setq2 HurnscaldQuest_Sagratha, .@inst;
- }
+ .@mapn$=SaggyInstCheck();
warp .@mapn$, 33, 35;
changemusic .@mapn$, "eric_matyas_ghouls.ogg";
}
diff --git a/npc/015-8/sealedshrine.txt b/npc/015-8/sealedshrine.txt
index c892163f1..c0ba73350 100644
--- a/npc/015-8/sealedshrine.txt
+++ b/npc/015-8/sealedshrine.txt
@@ -633,20 +633,7 @@ OnInit:
if (askyesno() == ASK_YES) {
closeclientdialog;
- .@q2=getq2(HurnscaldQuest_Sagratha);
- // Map name limit: 4 chars (sgt1)
- .@mapn$="sgt1@"+getcharid(0);
- .@map2$="sgt2@"+getcharid(0);
- if (!(isinstance(.@q2) && .@q2 != 0)) {
- .@inst = instance_create("Sagratha House "+getcharid(0), getcharid(3), IOT_CHAR);
- instance_attachmap("014-5-1", .@inst, false, .@mapn$);
- //instance_attachmap("015-8", .@inst, false, .@mapn$);
- instance_attachmap("015-8-1", .@inst, false, .@map2$);
- // 40 minutes (2400s) inside, or 5 minutes (300s) outside
- instance_set_timeout(2400, 300, .@inst);
- instance_init(.@inst);
- setq2 HurnscaldQuest_Sagratha, .@inst;
- }
+ .@map2$=SaggyInstCheck(false);
warp .@map2$, 50, 78;
end;
}