diff --git a/src/map/npc.cpp b/src/map/npc.cpp index 7bd0d8febf..39981bb254 100644 --- a/src/map/npc.cpp +++ b/src/map/npc.cpp @@ -220,7 +220,7 @@ int npc_enable_sub(struct block_list *bl, va_list ap) { TBL_PC *sd = (TBL_PC*)bl; - if (nd->sc.option&OPTION_INVISIBLE) + if (nd->sc.option&(OPTION_INVISIBLE|OPTION_CLOAK)) return 1; switch (nd->subtype) { @@ -347,8 +347,21 @@ bool npc_enable_target(const char* name, uint32 char_id, int flag) map_foreachinmap(npc_cloaked_sub, nd->bl.m, BL_PC, nd->bl.id); // Because npc option has been updated we remove the npc id from sd->cloaked_npc } - if( flag&11 && (nd->u.scr.xs >= 0 || nd->u.scr.ys >= 0) )// check if player standing on a OnTouchArea - map_foreachinallarea( npc_enable_sub, nd->bl.m, nd->bl.x-nd->u.scr.xs, nd->bl.y-nd->u.scr.ys, nd->bl.x+nd->u.scr.xs, nd->bl.y+nd->u.scr.ys, BL_PC, nd ); + if (flag&11) { // check if player standing on a OnTouchArea + int xs = -1, ys = -1; + switch (nd->subtype) { + case NPCTYPE_SCRIPT: + xs = nd->u.scr.xs; + ys = nd->u.scr.ys; + break; + case NPCTYPE_WARP: + xs = nd->u.warp.xs; + ys = nd->u.warp.ys; + break; + } + if (xs >= 0 || ys >= 0) + map_foreachinallarea( npc_enable_sub, nd->bl.m, nd->bl.x-xs, nd->bl.y-ys, nd->bl.x+xs, nd->bl.y+ys, BL_PC, nd ); + } return true; } @@ -1183,7 +1196,7 @@ int npc_touch_areanpc2(struct mob_data *md) for( i = 0; i < mapdata->npc_num_area; i++ ) { - if( mapdata->npc[i]->sc.option&OPTION_INVISIBLE ) + if( mapdata->npc[i]->sc.option&(OPTION_INVISIBLE|OPTION_CLOAK) ) continue; switch( mapdata->npc[i]->subtype )