summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-05-07 08:07:19 -0300
committerJesusaves <cpntb1@ymail.com>2020-05-07 08:35:31 -0300
commit32a73d0a043212fc5cf8131b387736fbab8fe391 (patch)
tree01c63742a151cd255ba5a1f70df2c35f7d4faf95
parentc40d8c47cefc4bab1f62911bcab0484b0d141fd0 (diff)
downloadserverdata-32a73d0a043212fc5cf8131b387736fbab8fe391.tar.gz
serverdata-32a73d0a043212fc5cf8131b387736fbab8fe391.tar.bz2
serverdata-32a73d0a043212fc5cf8131b387736fbab8fe391.tar.xz
serverdata-32a73d0a043212fc5cf8131b387736fbab8fe391.zip
Random, Wild Treasure Chests were sighted in Hurnscald Caves!
Watch out for them!
-rw-r--r--npc/functions/treasure.txt68
1 files changed, 68 insertions, 0 deletions
diff --git a/npc/functions/treasure.txt b/npc/functions/treasure.txt
index ca03329a..e00a40d4 100644
--- a/npc/functions/treasure.txt
+++ b/npc/functions/treasure.txt
@@ -51,4 +51,72 @@ function script TreasureBox {
return;
}
+// Animation code by Evol Team
+// 4144, gumi, Hal9000, Reid
+// (Random) Treasure Chest
+// Authored by Jesusalva
+// Regenerates every 6 hours
+008-3-0,0,0,0 script #chest_008-3-0 NPC_CHEST,{
+ /*
+ // Extract the map name - Seems unused
+ explode(.@ni$, .name$, "_");
+ .@map$=.@ni$[1];
+ //if (.@map$ == "") debugmes "Error";
+ */
+
+ // Conditionals
+ if (!.busy) {
+ TreasureBox();
+
+ 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 {
+ mesc l("Someone looted this treasure box already...");
+ }
+ 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;
+
+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, getmapinfo(MAPINFO_SIZE_X, .@m$)-20);
+ .@y = rand2(20, getmapinfo(MAPINFO_SIZE_X, .@m$)-20);
+ ++.@e;
+ }
+ .busy=false;
+ .empty=false;
+ movenpc .name$, .@x, .@y, 0;
+ end;
+}
+
+// Lets bring some treasure to The Mana World
+008-3-1,0,0,0 duplicate(#chest_008-3-0) #chest_008-3-1 NPC_CHEST
+008-3-2,0,0,0 duplicate(#chest_008-3-0) #chest_008-3-2 NPC_CHEST