Originally posted by [b]NoH[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=4978
This is gonna sound weird, so stay with me...
Shop NPCs can't have their view id set to -1, or the map server will complain (unless it's a floating shop). Why would you want to have an unclickable Shop NPC you could ask? Simply to use him with the callshop script command. If you can't have an invisible NPC in this case, it doesn't only mean you have to have a visible NPC somewhere, but it also means this visible, clickable, NPC must be in the AREA_SIZE range of the NPC calling his shop, since npc_buysellsel calls a npc_checknear. It kinda ruins the purpose of this command most of the time.
The only way around is to have a "floating shop", with no map specified. This is very simple to do, yet it's not intuitive and I had to go through the sources to understand that. I guess most of the scripters won't do it and just give up with this command.
To change that and allow invisible shops unconditionally, in npc_parse_shop, change:
CODE
if( m >= 0 )
{// normal shop npc
map_addnpc(m,nd);
map_addblock(&nd->bl);
status_set_viewdata(&nd->bl, nd->class_);
status_change_init(&nd->bl);
unit_dataset(&nd->bl);
nd->ud.dir = dir;
clif_spawn(&nd->bl);
} else
{// 'floating' shop?
map_addiddb(&nd->bl);
}
->
CODE
if( m >= 0 && nd->class_ > 0 )
{// normal shop npc
map_addnpc(m,nd);
map_addblock(&nd->bl);
status_set_viewdata(&nd->bl, nd->class_);
status_change_init(&nd->bl);
unit_dataset(&nd->bl);
nd->ud.dir = dir;
clif_spawn(&nd->bl);
} else
{// 'floating' shop?
map_addiddb(&nd->bl);
}