summaryrefslogtreecommitdiff
path: root/npc/functions/maze.txt
diff options
context:
space:
mode:
Diffstat (limited to 'npc/functions/maze.txt')
-rw-r--r--npc/functions/maze.txt18
1 files changed, 17 insertions, 1 deletions
diff --git a/npc/functions/maze.txt b/npc/functions/maze.txt
index c1a8d86d1..8cb7a2be5 100644
--- a/npc/functions/maze.txt
+++ b/npc/functions/maze.txt
@@ -74,7 +74,7 @@ function script CreateMaze {
}
/////////////////////////////////////////////////////////////////////////////////
-// InitMaze(duration=2 hours, random=yes)
+// InitMaze(duration=2 hours, random_coords=yes, treasure=no)
// Puts maze to work and send player there.
// Exit must have been configured prior to the maze.
function script InitMaze {
@@ -101,7 +101,23 @@ function script InitMaze {
}
} while (!checknpccell(MAZE_MAP$, .@x, .@y, cell_chkpass));
+ // Teleport the player
warp MAZE_MAP$, .@x, .@y;
+
+ // Add a random treasure chest if set to do so
+ if (getarg(2, false)) {
+ .@n$=instance_npcname("#T_"+MAZE_MAP$, MAZE_INST);
+ .@mx=getmapinfo(MAPINFO_SIZE_X, MAZE_MAP$)-20;
+ .@my=getmapinfo(MAPINFO_SIZE_Y, MAZE_MAP$)-20;
+ do {
+ .@x = rand2(20, .@mx);
+ .@y = rand2(20, .@my);
+ .@e += 1;
+ if (.@e > 20)
+ break;
+ } while (!checknpccell(MAZE_MAP$, .@x, .@y, cell_chkpass));
+ movenpc(.@n$, .@x, .@y);
+ }
return true;
}