Help creating dialog boxes

just wondering how would I create a dialog system for rpg type of game? when the character walk near the non playable characters or when we press enter next to them a dailog box pops up just wondering how would i do that thank you.