From 2a7dc535a68c325b35f11ea3ce52e8015cd88650 Mon Sep 17 00:00:00 2001 From: gumi Date: Fri, 6 Jan 2017 15:33:54 -0500 Subject: make the chests automatically close --- npc/001-2-22/chest.txt | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'npc/001-2-22/chest.txt') 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: -- cgit v1.2.3-60-g2f50