Yes, it's possible using game state, it's a global variable, when you open a chest by pressing a key, then game state changes to dialog state may cause players, enemies, time, etc. are stopped except dialog text with typewriting effect. Then the last dialog, press key again changes from dialog state to game state, it continues the game.