Years ago I used to use something like this in pc_setpos, but I don't know if it still works.
The function of the code is supposed to be "when positioning a pc at a random map location, don't land on top of an NPC warp"
- } while(map_getcell(m,x,y,CELL_CHKNOPASS));+ } while((map_getcell(m,x,y,CELL_CHKNOPASS) || npc_check_areanpc(1,m,x,y,1)));
There's also a closed pull request addressing this issue in more detail: https://github.com/HerculesWS/Hercules/pull/266