diff options
author | gumi <mekolat@users.noreply.github.com> | 2017-01-06 15:33:54 -0500 |
---|---|---|
committer | gumi <mekolat@users.noreply.github.com> | 2017-01-06 21:21:38 -0500 |
commit | 2a7dc535a68c325b35f11ea3ce52e8015cd88650 (patch) | |
tree | df12b4f70147e2140b044239881cb72caec2ec05 | |
parent | 5effe0983f93103370624e82bfc0879e611dd18d (diff) | |
download | serverdata-2a7dc535a68c325b35f11ea3ce52e8015cd88650.tar.gz serverdata-2a7dc535a68c325b35f11ea3ce52e8015cd88650.tar.bz2 serverdata-2a7dc535a68c325b35f11ea3ce52e8015cd88650.tar.xz serverdata-2a7dc535a68c325b35f11ea3ce52e8015cd88650.zip |
make the chests automatically close
-rw-r--r-- | npc/000-1/chest.txt | 24 | ||||
-rw-r--r-- | npc/000-2-1/chest.txt | 27 | ||||
-rw-r--r-- | npc/001-2-22/chest.txt | 23 |
3 files changed, 63 insertions, 11 deletions
diff --git a/npc/000-1/chest.txt b/npc/000-1/chest.txt index 94417a4e..79dc6a5b 100644 --- a/npc/000-1/chest.txt +++ b/npc/000-1/chest.txt @@ -12,7 +12,7 @@ // 0 Treasure Chest has not been opened yet. // 1 Treasure Chest has been opened. -000-1,83,70,0 script Chest#000-1 NPC_CHEST,{ +000-1,83,70,0 script Chest#000-1 NPC_CHEST,3,3,{ if (.busy == false) { @@ -25,7 +25,7 @@ getitem OldBook, 1; } - misceffect .dir == 0 ? 24 : 25; // closed ? opening : closing + misceffect .dir == 0 ? 24 : 25, getnpcid(0); // closed ? opening : closing .dir = .dir == 0 ? 2 : 6; // closed ? opening : closing .busy = true; // lock until available again initnpctimer; @@ -37,10 +37,28 @@ OnTimer160: end; OnTimer500: - stopnpctimer; .busy = false; // unlock + + if (.dir == 0) + { + stopnpctimer; // stop here if the chest is closed + } + end; + +OnUnTouch: + if (getareausers(.x - 3, .y - 3, .x + 3, .y + 3) > 0 || .dir == 0) + { + end; + } +OnTimer30000: + .busy = true; + .dir = 6; // closing + misceffect 25, getnpcid(0); // closing + setnpctimer 0; +OnTouch: end; + OnInit: .distance = 2; end; diff --git a/npc/000-2-1/chest.txt b/npc/000-2-1/chest.txt index 69aaba96..b02235c3 100644 --- a/npc/000-2-1/chest.txt +++ b/npc/000-2-1/chest.txt @@ -12,7 +12,7 @@ // 1 Talked to Arpan and needs to get clothes. // 2 Has the clothes. -000-2-1,51,37,0 script Chest#000-2-1 NPC_CHEST_BIG,{ +000-2-1,51,37,0 script Chest#000-2-1 NPC_CHEST_BIG,2,4,{ .@questState = getq(ShipQuests_Arpan); @@ -24,7 +24,7 @@ if (.busy == false) { - if (.dir == 4 && .@questState <= 1) + if (.@questState <= 1) { inventoryplace CreasedShirt, 2; setq ShipQuests_Arpan, 2; @@ -33,7 +33,7 @@ npctalk3 l("You take the clothes from the chest."); } - misceffect .dir == 0 ? 24 : 25; // closed ? opening : closing + misceffect .dir == 0 ? 24 : 25, getnpcid(0); // closed ? opening : closing .dir = .dir == 0 ? 2 : 6; // closed ? opening : closing .busy = true; // lock the animation initnpctimer; @@ -45,8 +45,25 @@ OnTimer220: end; OnTimer500: - stopnpctimer; - .busy = false; // unlock the animation + .busy = false; // unlock + + if (.dir == 0) + { + stopnpctimer; // stop here if the chest is closed + } + end; + +OnUnTouch: + if (getareausers(.x - 2, .y - 4, .x + 2, .y + 6) > 0 || .dir == 0) + { + end; + } +OnTimer30000: + .busy = true; + .dir = 6; // closing + misceffect 25, getnpcid(0); // closing + setnpctimer 0; +OnTouch: end; OnInit: diff --git a/npc/001-2-22/chest.txt b/npc/001-2-22/chest.txt index 8cab6cf8..58ecfeae 100644 --- a/npc/001-2-22/chest.txt +++ b/npc/001-2-22/chest.txt @@ -6,11 +6,11 @@ // Description: // A box with clothes for new players. -001-2-22,51,37,0 script Chest#Artis NPC_CHEST_BIG,{ +001-2-22,51,37,0 script Chest#Artis NPC_CHEST_BIG,2,4,{ if (.busy == false) { - misceffect .dir == 0 ? 24 : 25; // closed ? opening : closing + misceffect .dir == 0 ? 24 : 25, getnpcid(0); // closed ? opening : closing .dir = .dir == 0 ? 2 : 6; // closed ? opening : closing .busy = true; // lock until available again initnpctimer; @@ -22,8 +22,25 @@ OnTimer220: end; OnTimer500: - stopnpctimer; .busy = false; // unlock + + if (.dir == 0) + { + stopnpctimer; // stop here if the chest is closed + } + end; + +OnUnTouch: + if (getareausers(.x - 2, .y - 4, .x + 2, .y + 6) > 0 || .dir == 0) + { + end; + } +OnTimer30000: + .busy = true; + .dir = 6; // closing + misceffect 25, getnpcid(0); // closing + setnpctimer 0; +OnTouch: end; OnInit: |