I write simple function for you. If you call it from dialog, you will get merc. I dond check any demand, so you can use it for build some more complex function. If you build more code, share with others.
#include "_defines.fos"
#include "_npc_pids.fos"
import bool GetFreeHex(Map& map, uint radius, uint16& hx, uint16& hy) from "caravan";
import void r_AddMerc2Player(Critter & player, Critter @ npc) from "merc";
// Dialog result
void r_AddMercenary(Critter& player, Critter@ npc)
{
Map @mapa = player.GetMap();
if(@mapa!=null)
{
uint16 hX = player.HexX;
uint16 hY = player.HexY;
GetFreeHex(mapa, 1, hX, hY);
Critter@ merc = mapa.AddNpc(NPC_PID_BountyHunter_10, hX, hY, player.Dir,null,null,null);
r_AddMerc2Player(player, merc);
merc.Say(SAY_NORM_ON_HEAD, "I will save your ass Ulrek boy");
}
}