summaryrefslogtreecommitdiff
path: root/npc/001-2-34
diff options
context:
space:
mode:
Diffstat (limited to 'npc/001-2-34')
-rw-r--r--npc/001-2-34/doors.txt54
1 files changed, 37 insertions, 17 deletions
diff --git a/npc/001-2-34/doors.txt b/npc/001-2-34/doors.txt
index ca513945..d53dfc82 100644
--- a/npc/001-2-34/doors.txt
+++ b/npc/001-2-34/doors.txt
@@ -5,25 +5,45 @@
// Doors NPCs.
001-2-34,23,29,0 script ToTrainingRoom#001-2-34 NPC_HIDDEN,0,0,{
-
OnTouch:
- if ((getmapusers($@MAP_NAME$) == 0) && ($@FightingIsActive > 0))
- {
- set $@FightingIsActive, 0;
- killmonsterall "001-2-36";
- }
- if (mobcount("001-2-36","all") > 0 && $@FightingIsActive > 0)
- {
- narrator
- l("You hear some sound behind the door."),
- l("Somebody is probably training, better wait for him to finish.");
- }
- else
- {
- warp "001-2-36", 36, 30;
+ function doorBlock {
+ .@trainingMap$ = "001-2-36"; // map to create
+ .@CharID = getcharid(CHAR_ID_CHAR); // character ID used for set the name of instance
+
+ // check if a valid instance exists and warp
+ if (.instid >= 0 && isinstance(.instid))
+ {
+ warp(.@CharID+.@trainingMap$, 36, 30);
+ end;
+ }
+
+ // else create new instance
+ .instid = instance_create("training@instance", getcharid(CHAR_ID_ACCOUNT), IOT_CHAR);
+ if (.instid < 0)
+ {
+ debugmes "Error: creating instance";
+ end;
+ }
+
+ .@instanceMapName$ = instance_attachmap(.@trainingMap$, .instid, 0, .@CharID+.@trainingMap$ );
+ if (.@instanceMapName$ == "")
+ {
+ debugmes "Error: instance attach map error";
+ end;
+ }
+
+ instance_set_timeout(1000000, 1000000, .instid);
+ instance_init(.instid);
+
+ // respawn the player in front of door of training room if the player relog inside the instance
+ // do not effect the savepoint
+ setmapflagnosave(.@instanceMapName$, .map$, 24, 29);
+
+ warp(.@CharID+.@trainingMap$, 36, 30);
+ end;
}
- closeclientdialog;
- close;
+ doorBlock;
+ end;
}