If you have a complex system of NPCs and dialogues, you might need to store the progress in some data object, I recommend JSON.
For example, there may be a record in JSON for each NPC, where you can track if the player has talked to that NPC, how many times, their friendship status etc.
{
"NPC": "Governor",
"DialogueCount": 2,
"Location": "Town",
"Attitude": "friendly"
}