From 5effe0983f93103370624e82bfc0879e611dd18d Mon Sep 17 00:00:00 2001 From: omatt Date: Mon, 19 Dec 2016 21:53:15 +0100 Subject: add a delay on close/open chest --- npc/000-1/chest.txt | 44 ++++++++++++++++------------------ npc/000-2-1/chest.txt | 65 +++++++++++++++++++++++++------------------------- npc/001-2-22/chest.txt | 26 ++++++++++---------- 3 files changed, 67 insertions(+), 68 deletions(-) (limited to 'npc') diff --git a/npc/000-1/chest.txt b/npc/000-1/chest.txt index 9e623aa8..94417a4e 100644 --- a/npc/000-1/chest.txt +++ b/npc/000-1/chest.txt @@ -3,6 +3,7 @@ // 4144 // Hal9000 // Reid +// gumi // Description: // A treasure chest, with... Treasures inside! // Variable: @@ -12,35 +13,32 @@ // 1 Treasure Chest has been opened. 000-1,83,70,0 script Chest#000-1 NPC_CHEST,{ - if (.dir != 4) - { - .dir = 2; - initnpctimer; - startnpctimer; - misceffect 24; - close; - } - .@q = getq(ShipQuests_TreasureChest); - if (.@q == 0) + if (.busy == false) { - inventoryplace OldBook, 1; - setq ShipQuests_TreasureChest, 1; - Zeny = Zeny + 100; - getitem OldBook, 1; - npctalk3 l("Chest opened."); - } + if (getq(ShipQuests_TreasureChest) == 0) + { + inventoryplace OldBook, 1; + setq ShipQuests_TreasureChest, 1; + npctalk3 l("Chest opened."); + Zeny += 100; + getitem OldBook, 1; + } - .dir = 6; - initnpctimer; - startnpctimer; - misceffect 25; - close; + misceffect .dir == 0 ? 24 : 25; // closed ? opening : closing + .dir = .dir == 0 ? 2 : 6; // closed ? opening : closing + .busy = true; // lock until available again + initnpctimer; + } + end; OnTimer160: + .dir = .dir == 6 ? 0 : 4; // closing ? closed : open + end; + +OnTimer500: stopnpctimer; - if (.dir == 2) .dir = 4; - if (.dir == 6) .dir = 0; + .busy = false; // unlock end; OnInit: diff --git a/npc/000-2-1/chest.txt b/npc/000-2-1/chest.txt index ff5a3232..69aaba96 100644 --- a/npc/000-2-1/chest.txt +++ b/npc/000-2-1/chest.txt @@ -2,6 +2,8 @@ // Authors: // 4144 // Reid +// omatt +// gumi // Description: // A box with clothes for new players. // Variable: @@ -11,45 +13,42 @@ // 2 Has the clothes. 000-2-1,51,37,0 script Chest#000-2-1 NPC_CHEST_BIG,{ - .@q = getq(ShipQuests_Arpan); - if (.@q == 0) goto L_Talk; - if (.dir == 4) goto L_Give; - - .dir = 2; - initnpctimer; - startnpctimer; - misceffect 24; - close; - -L_Give: - if (.@q > 1) goto L_Quit; - inventoryplace CreasedShirt, 2; + .@questState = getq(ShipQuests_Arpan); + + if (.@questState == 0) + { + npctalk3 l("You should talk to Magic Arpan first."); + end; + } + + if (.busy == false) + { + if (.dir == 4 && .@questState <= 1) + { + inventoryplace CreasedShirt, 2; + setq ShipQuests_Arpan, 2; + getitem CreasedShirt, 1; + getitem CreasedShorts, 1; + npctalk3 l("You take the clothes from the chest."); + } + + misceffect .dir == 0 ? 24 : 25; // closed ? opening : closing + .dir = .dir == 0 ? 2 : 6; // closed ? opening : closing + .busy = true; // lock the animation + initnpctimer; + } + end; - setq ShipQuests_Arpan, 2; - getitem CreasedShirt, 1; - getitem CreasedShorts, 1; - npctalk3 l("You take the clothes from the chest."); - goto L_Quit; +OnTimer220: + .dir = .dir == 6 ? 0 : 4; // closing ? closed : open + end; -OnTimer360: +OnTimer500: stopnpctimer; - if (.dir == 2) .dir = 4; - if (.dir == 6) .dir = 0; + .busy = false; // unlock the animation end; -L_Talk: - npctalk3 l("You should talk to Magic Arpan first."); - - close; - -L_Quit: - .dir = 6; - initnpctimer; - startnpctimer; - misceffect 25; - close; - OnInit: .distance = 2; end; diff --git a/npc/001-2-22/chest.txt b/npc/001-2-22/chest.txt index e20a00da..8cab6cf8 100644 --- a/npc/001-2-22/chest.txt +++ b/npc/001-2-22/chest.txt @@ -2,27 +2,29 @@ // Authors: // 4144 // Reid +// gumi // Description: // A box with clothes for new players. 001-2-22,51,37,0 script Chest#Artis NPC_CHEST_BIG,{ - .dir = 2; - initnpctimer; - startnpctimer; - close; + if (.busy == false) + { + misceffect .dir == 0 ? 24 : 25; // closed ? opening : closing + .dir = .dir == 0 ? 2 : 6; // closed ? opening : closing + .busy = true; // lock until available again + initnpctimer; + } + end; OnTimer220: - stopnpctimer; - if (.dir == 2) .dir = 4; - if (.dir == 6) .dir = 0; + .dir = .dir == 6 ? 0 : 4; // closing ? closed : open end; -L_Quit: - .dir = 6; - initnpctimer; - startnpctimer; - close; +OnTimer500: + stopnpctimer; + .busy = false; // unlock + end; OnInit: .distance = 2; -- cgit v1.2.3-70-g09d2