RPG - NPCs?

Hi there!
What is the best way do build in NPCs?
Should I ask which map is activated and then draw the NPCs on there positions?
And to know if the Player can talk with the NPC to ask if the player coordinate are like X=54 & Y=230 and If he press Enter a Textbox will be shown?

How do you do it?

And I wonder how I could do it that the NPCs walk around.
Do I have to use a Timer or a own Thread for NPCs?
To check so that the Player cant go in the NPC I just create a Rectangle and check the collision woth the Heros Rectangle right?

just treat NPC’s as another entity… and I think u shuldnt use another thread for them. And I imagine that for movemtny just have two coordinates and move back & forth between them, or if you want to be fancy, just move around randomly

The question you should be asking should be less about NPCs and more about general entity systems and control, as h3ckboy mentioned. Just the fact that you’re considering a new thread for every entity (a very very bad idea, on a number of levels) tells me that you should go back and spend some time learning a few more basics first. Every Entity should be an individual object with something like an update() function, and all those updates should be called from a single game loop (powered by some sort of timer or equivalent system) every so many milliseconds.

I have an ArrayList or Vector of entities, and in every update loop i check each one if they should walk, or if the player is looking in a direction where an npc stands AND the player has pressed a button.

And how does look this List?
So I made a method checkNPC().
Where I ask whick Map is activated and then drawing the NPCs. And I ask if the player is near the NPCs to talk.
It works, but is your way better?

The list is just to keep track of NPC’s…