summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorLance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-09 18:09:17 +0000
committerLance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-09 18:09:17 +0000
commitd5e0b951e5460e1aa6d6ad0aeda70fc119554310 (patch)
tree90bc385f131c92a6754cba375d9b2367e81d4c33 /src/map
parent76217d3ca250922d3a55ed73a55e22a678afd49f (diff)
downloadhercules-d5e0b951e5460e1aa6d6ad0aeda70fc119554310.tar.gz
hercules-d5e0b951e5460e1aa6d6ad0aeda70fc119554310.tar.bz2
hercules-d5e0b951e5460e1aa6d6ad0aeda70fc119554310.tar.xz
hercules-d5e0b951e5460e1aa6d6ad0aeda70fc119554310.zip
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7076 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/script.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/map/script.c b/src/map/script.c
index a7c9f4b6e..8c84e89de 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -679,7 +679,7 @@ struct {
{buildin_cmdothernpc,"cmdothernpc","ss"},
{buildin_atcommand,"atcommand","*"}, // [MouseJstr]
{buildin_charcommand,"charcommand","*"}, // [MouseJstr]
-// {buildin_movenpc,"movenpc","siis"}, // [MouseJstr]
+ {buildin_movenpc,"movenpc","sii"}, // [MouseJstr]
{buildin_message,"message","s*"}, // [MouseJstr]
{buildin_npctalk,"npctalk","*"}, // [Valaris]
{buildin_hasitems,"hasitems","*"}, // [Valaris]
@@ -8975,16 +8975,28 @@ int buildin_getmapmobs(struct script_state *st)
int buildin_movenpc(struct script_state *st)
{
- struct map_session_data *sd;
- char *map,*npc;
+ TBL_NPC *nd = NULL;
+ char *npc;
int x,y;
+ short m;
- sd = script_rid2sd(st);
-
- map = conv_str(st,& (st->stack->stack_data[st->start+2]));
+ npc = conv_str(st,& (st->stack->stack_data[st->start+2]));
x = conv_num(st,& (st->stack->stack_data[st->start+3]));
y = conv_num(st,& (st->stack->stack_data[st->start+4]));
- npc = conv_str(st,& (st->stack->stack_data[st->start+5]));
+
+ if ((nd = npc_name2id(npc)) == NULL)
+ return -1;
+
+ if ((m=nd->bl.m) < 0 || nd->bl.prev == NULL)
+ return -1; //Not on a map.
+
+ if (x < 0) x = 0;
+ else if (x >= map[m].xs) x = map[m].xs-1;
+ if (y < 0) y = 0;
+ else if (y >= map[m].ys) y = map[m].ys-1;
+ map_foreachinrange(clif_outsight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl);
+ map_moveblock(&nd->bl, x, y, gettick());
+ map_foreachinrange(clif_insight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl);
return 0;
}