diff options
author | Jesusaves <cpntb1@ymail.com> | 2019-01-26 15:33:44 -0200 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2019-01-26 15:33:44 -0200 |
commit | 7c33d9f46270227afdc29c2203b47495463429f2 (patch) | |
tree | a328668b4fc303537eefa085d412226afc4214bf /npc/015-6 | |
parent | 2837174f65d7ab1a749d3ac3ac9d4f8fd88fe4cc (diff) | |
download | serverdata-7c33d9f46270227afdc29c2203b47495463429f2.tar.gz serverdata-7c33d9f46270227afdc29c2203b47495463429f2.tar.bz2 serverdata-7c33d9f46270227afdc29c2203b47495463429f2.tar.xz serverdata-7c33d9f46270227afdc29c2203b47495463429f2.zip |
Ok, random treasure chests works, scatter them on the major dungeons.
Diffstat (limited to 'npc/015-6')
-rw-r--r-- | npc/015-6/_import.txt | 1 | ||||
-rw-r--r-- | npc/015-6/treasure.txt | 65 |
2 files changed, 66 insertions, 0 deletions
diff --git a/npc/015-6/_import.txt b/npc/015-6/_import.txt index cebd2b9d2..733918207 100644 --- a/npc/015-6/_import.txt +++ b/npc/015-6/_import.txt @@ -3,3 +3,4 @@ "npc/015-6/_mobs.txt", "npc/015-6/_warps.txt", "npc/015-6/mapflags.txt", +"npc/015-6/treasure.txt", diff --git a/npc/015-6/treasure.txt b/npc/015-6/treasure.txt new file mode 100644 index 000000000..5fc1a1c0f --- /dev/null +++ b/npc/015-6/treasure.txt @@ -0,0 +1,65 @@ +// TMW2 Script + +// (Random) Treasure Chest +// Authored by Jesusalva +// Regenerates every 6 hours + +015-6,0,0,0 script #chest_01560 NPC_CHEST,{ + + if (!.busy && !.empty) { + TreasureBox(); + + .empty=true; + 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 = rand(20, 500); + .@y = rand(20, 190); + ++.@e; + } + .busy=false; + .empty=false; + movenpc .name$, .@x, .@y, 0; + end; +} + +015-6,0,0,0 duplicate(#chest_01560) #chest_01561 NPC_CHEST + |