im asking because im trying to make my script talk to npcs one after the other. So talk to one man, then when the conversation is over, talk to another, and so on without breaking. Right now my script works fine, but sometimes it just stops trying to talk to them for a few seconds and then finally talks. Even when there are some right next to me.
NPC man = npcs.closest("Man");
ifgetMap().canReach(man) && !me.isMoving() && !dialogues.inDialogue() && man != null)
{
man.interact("Talk-to");
}