helped in discord
int x=0,y=0,i=0,master = 0;
struct map_session_data *pl_sd=NULL;
master = sd->bl.id;
if ( mob_countslave(&sd->bl) >= 1)
return 0;
do {
x = sd->bl.x + (rnd() % 10 - 5);
y = sd->bl.y + (rnd() % 10 - 5);
} while (map_getcell(sd->bl.m,x,y,CELL_CHKNOPASS) && i++ < 10);
if (i >= 10) {
x = sd->bl.x;
y = sd->bl.y;
}
pl_sd = map_nick2sd((char *)sd->status.name);
mob_clone_spawn(pl_sd, sd->bl.m, x, y, "", master, 0, 2, 0);
}
break;