From 3650b0b6c021f12922b2ba1624b971a5984c51f1 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sat, 4 Jun 2022 01:35:54 -0300 Subject: Add a couple Treasure Chests to 032-2 (Past Tulimshar) --- npc/032-2/_import.txt | 1 + npc/032-2/episode.txt | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 npc/032-2/episode.txt diff --git a/npc/032-2/_import.txt b/npc/032-2/_import.txt index 6d9809f32..ac4567da5 100644 --- a/npc/032-2/_import.txt +++ b/npc/032-2/_import.txt @@ -2,3 +2,4 @@ // This file is generated automatically. All manually added changes will be removed when running the Converter. "npc/032-2/_mobs.txt", "npc/032-2/_warps.txt", +"npc/032-2/episode.txt", diff --git a/npc/032-2/episode.txt b/npc/032-2/episode.txt new file mode 100644 index 000000000..b27f87c18 --- /dev/null +++ b/npc/032-2/episode.txt @@ -0,0 +1,62 @@ +// TMW2 scripts. +// (Random) Treasure Chest +// Authored by Jesusalva with code parts from Evol, see 007-1/treasure +// Regenerates every 6 hours +032-2,0,0,0 script #chest_03220 NPC_CHEST,{ + + if (!.busy && !.empty) { + TreasureBox(75); // 0.75% better treasure find rate + + specialeffect(.dir == 0 ? 24 : 25, AREA, getnpcid()); // closed ? opening : closing + .dir = .dir == 0 ? 2 : 6; // closed ? opening : closing + .busy = true; // lock until available again + initnpctimer; + } else if (!.busy) { + mesc l("Someone looted this treasure box already..."); + } else { + end; + } + close; + +OnTimer160: + .dir = .dir == 6 ? 0 : 4; // closing ? closed : open + end; + +OnTimer500: + .busy = false; // unlock + if (.dir == 0 || .dir == 4) + stopnpctimer; // stop here if the chest is closed + end; + +OnInit: + .busy = false; + .distance = 2; + .empty = false; + +OnClock0156: +OnClock0756: +OnClock1356: +OnClock1956: + // Try to warp randomly to a walkable spot, up to 20 attempts + // Otherwise, it'll stay where it already is (but will close and refill). + .@e=0; .@x=0; .@y=0; + while (!checkcell(.map$, .@x, .@y, cell_chkpass)) + { + if (.@e == 20) { + .@x=.x; + .@y=.y; + break; + } + // Remember the +20 -20 margin adjustment + .@x = rand2(20, 180); + .@y = rand2(20, 180); + ++.@e; + } + .busy=false; + .empty=false; + movenpc .name$, .@x, .@y, 0; + end; +} + +032-2,0,0,0 duplicate(#chest_03220) #chest_03221 NPC_CHEST + -- cgit v1.2.3-60-g2f50