From ab6b97f77856f638a8efa210c1b6869c909c988f Mon Sep 17 00:00:00 2001 From: gumi Date: Tue, 3 Jan 2017 12:08:00 -0500 Subject: send to a random x,y when not walkable in `@w` --- npc/commands/warp.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'npc') diff --git a/npc/commands/warp.txt b/npc/commands/warp.txt index 55107c93..5bfb8c01 100644 --- a/npc/commands/warp.txt +++ b/npc/commands/warp.txt @@ -42,15 +42,19 @@ OnCall: .@y = atoi(.@atcmd_parameters$[2]); } + // FIXME: here getmapusers() is used only to check if the map exists + // replace this when/if we get a dedicated function for that if (getmapusers(.@map$) < 0) { end; // invalid map } - else if (!checkcell(.@map$, .@x, .@y, cell_chkpass)) + while (!checkcell(.@map$, .@x, .@y, cell_chkpass)) { - // XXX: maybe send to random location? - end; // invalid coordinates + if (.@e == 50) end; + .@x = rand(20, 250); + .@y = rand(20, 250); + ++.@e; } cwarp .@map$, .@x, .@y; // XXX: maybe here use a slide_or_warp function -- cgit v1.2.3-70-g09d2