From d5e0b951e5460e1aa6d6ad0aeda70fc119554310 Mon Sep 17 00:00:00 2001 From: Lance Date: Fri, 9 Jun 2006 18:09:17 +0000 Subject: git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7076 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/script.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'src/map') 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; } -- cgit v1.2.3-60-g2f50