summaryrefslogtreecommitdiff
path: root/npc
diff options
context:
space:
mode:
Diffstat (limited to 'npc')
-rw-r--r--npc/002-3/doors.txt29
-rw-r--r--npc/016-1/captain.txt21
-rw-r--r--npc/functions/instances.txt62
-rw-r--r--npc/scripts.conf1
4 files changed, 63 insertions, 50 deletions
diff --git a/npc/002-3/doors.txt b/npc/002-3/doors.txt
index b0caea5a7..82a005a08 100644
--- a/npc/002-3/doors.txt
+++ b/npc/002-3/doors.txt
@@ -29,35 +29,6 @@ OnTouch:
close;
-OnInterIfInit:
-
- // Candor Instance (we do all tests for debugmes here)
- .CANDOR_INSTID = instance_create("002-1@CandorInst", 0, IOT_NONE);
- if (.CANDOR_INSTID < 0) debugmes "Error: No instance ID";
- else {
- debugmes "created new instance id: " + str(.CANDOR_INSTID);
- .CANDOR1$=instance_attachmap("002-1", .CANDOR_INSTID, 0, "002-1@Candor");
- if (.CANDOR1$ == "") debugmes "Error: Map 002-1 CANDY failed";
-
- .CANDOR3$=instance_attachmap("002-3", .CANDOR_INSTID, 0, "002-3@Candor");
- if (.CANDOR3$ == "") debugmes "Error: Map 002-3 CANDY failed";
-
- .CANDOR4$=instance_attachmap("002-4", .CANDOR_INSTID, 0, "002-4@Candor");
- if (.CANDOR4$ == "") debugmes "Error: Map 002-4 CANDY failed";
-
- debugmes "Nard's Ship in Candor instance is set.";
- instance_set_timeout(1000000, 1000000, .CANDOR_INSTID);
- instance_init(.CANDOR_INSTID);
- }
-
- // Tulim Instance
- .TULIM_INSTID = instance_create("002-1@TulimInst", 0, IOT_NONE);
- instance_attachmap("002-1", .TULIM_INSTID, 0, "002-1@Tulim");
- instance_attachmap("002-3", .TULIM_INSTID, 0, "002-3@Tulim");
- instance_attachmap("002-4", .TULIM_INSTID, 0, "002-4@Tulim");
- instance_set_timeout(1000000, 1000000, .TULIM_INSTID);
- instance_init(.TULIM_INSTID);
- end;
}
002-3,44,28,0 script AreaNPC#doors5 NPC_HIDDEN,0,0,{
diff --git a/npc/016-1/captain.txt b/npc/016-1/captain.txt
index 28a4ea1d8..0e37e8f84 100644
--- a/npc/016-1/captain.txt
+++ b/npc/016-1/captain.txt
@@ -185,25 +185,4 @@ OnInit:
.distance = 5;
end;
-
-OnInterIfInit:
- // Tulim Instance
- .TULIM_INSTID = instance_create("016-1@TulimInst", 0, IOT_NONE);
- instance_attachmap("016-1", .TULIM_INSTID, 0, "016-1@Tulim");
- instance_set_timeout(1000000, 1000000, .TULIM_INSTID);
- instance_init(.TULIM_INSTID);
-
- // Hurns Instance
- .HURNS_INSTID = instance_create("016-1@HurnsInst", 0, IOT_NONE);
- instance_attachmap("016-1", .HURNS_INSTID, 0, "016-1@Hurns");
- instance_set_timeout(1000000, 1000000, .HURNS_INSTID);
- instance_init(.HURNS_INSTID);
-
- // Nivalis Instance
- .NIVAL_INSTID = instance_create("016-1@NivalInst", 0, IOT_NONE);
- instance_attachmap("016-1", .NIVAL_INSTID, 0, "016-1@Nival");
- instance_set_timeout(1000000, 1000000, .NIVAL_INSTID);
- instance_init(.NIVAL_INSTID);
- end;
-
}
diff --git a/npc/functions/instances.txt b/npc/functions/instances.txt
new file mode 100644
index 000000000..6f125bbc6
--- /dev/null
+++ b/npc/functions/instances.txt
@@ -0,0 +1,62 @@
+// TMW2 scripts.
+// Authors:
+// Jesusalva
+// Description:
+// Controls global instances and reset them when they break
+
+000-0,0,0,0 script #GlobalInstanceCore NPC_HIDDEN,{
+ end;
+
+OnInterIfInit:
+OnRestart:
+ /* Nard's Ship */
+ // Candor Instance (we do all tests for debugmes here)
+ .CANDOR_INSTID = instance_create("002-1@CandorInst", 0, IOT_NONE);
+ if (.CANDOR_INSTID < 0) debugmes "Error: No instance ID";
+ else {
+ debugmes "created new instance id: " + str(.CANDOR_INSTID);
+ .CANDOR1$=instance_attachmap("002-1", .CANDOR_INSTID, 0, "002-1@Candor");
+ if (.CANDOR1$ == "") debugmes "Error: Map 002-1 CANDY failed";
+
+ .CANDOR3$=instance_attachmap("002-3", .CANDOR_INSTID, 0, "002-3@Candor");
+ if (.CANDOR3$ == "") debugmes "Error: Map 002-3 CANDY failed";
+
+ .CANDOR4$=instance_attachmap("002-4", .CANDOR_INSTID, 0, "002-4@Candor");
+ if (.CANDOR4$ == "") debugmes "Error: Map 002-4 CANDY failed";
+
+ debugmes "Nard's Ship in Candor instance is set.";
+ instance_set_timeout(1000000, 1000000, .CANDOR_INSTID);
+ instance_init(.CANDOR_INSTID);
+ }
+
+ // Tulim Instance
+ .TULIM_INSTID = instance_create("002-1@TulimInst", 0, IOT_NONE);
+ instance_attachmap("002-1", .TULIM_INSTID, 0, "002-1@Tulim");
+ instance_attachmap("002-3", .TULIM_INSTID, 0, "002-3@Tulim");
+ instance_attachmap("002-4", .TULIM_INSTID, 0, "002-4@Tulim");
+ instance_set_timeout(1000000, 1000000, .TULIM_INSTID);
+ instance_init(.TULIM_INSTID);
+
+
+ /* La Marine's Ship */
+ // Tulim Instance
+ .TULIM_INSTID = instance_create("016-1@TulimInst", 0, IOT_NONE);
+ instance_attachmap("016-1", .TULIM_INSTID, 0, "016-1@Tulim");
+ instance_set_timeout(1000000, 1000000, .TULIM_INSTID);
+ instance_init(.TULIM_INSTID);
+
+ // Hurns Instance
+ .HURNS_INSTID = instance_create("016-1@HurnsInst", 0, IOT_NONE);
+ instance_attachmap("016-1", .HURNS_INSTID, 0, "016-1@Hurns");
+ instance_set_timeout(1000000, 1000000, .HURNS_INSTID);
+ instance_init(.HURNS_INSTID);
+
+ // Nivalis Instance
+ .NIVAL_INSTID = instance_create("016-1@NivalInst", 0, IOT_NONE);
+ instance_attachmap("016-1", .NIVAL_INSTID, 0, "016-1@Nival");
+ instance_set_timeout(1000000, 1000000, .NIVAL_INSTID);
+ instance_init(.NIVAL_INSTID);
+
+ end;
+
+}
diff --git a/npc/scripts.conf b/npc/scripts.conf
index 874d942a7..597ba324a 100644
--- a/npc/scripts.conf
+++ b/npc/scripts.conf
@@ -4,6 +4,7 @@
"npc/functions/permissions.txt",
"npc/functions/main.txt",
"npc/functions/util.txt",
+"npc/functions/instances.txt",
// General-purpose Framework functions
"npc/functions/array.txt",