diff options
author | Jesusaves <cpntb1@ymail.com> | 2022-06-04 02:00:35 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2022-06-04 02:00:35 -0300 |
commit | cd85f89af12067e72343ad5c2b3a79583108464a (patch) | |
tree | 856f29c7144e7aff05d0c27e2a1b082728420660 /npc | |
parent | c9b66babed21d523957417839a6cc83bfc50001a (diff) | |
download | serverdata-cd85f89af12067e72343ad5c2b3a79583108464a.tar.gz serverdata-cd85f89af12067e72343ad5c2b3a79583108464a.tar.bz2 serverdata-cd85f89af12067e72343ad5c2b3a79583108464a.tar.xz serverdata-cd85f89af12067e72343ad5c2b3a79583108464a.zip |
Random mazes may now have random treasure chests on them.
Currently disabled by default.
Diffstat (limited to 'npc')
-rw-r--r-- | npc/functions/maze.txt | 18 |
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; } |