You can achieve this by using an if-else statement and tokens. For example:
if hero lacks token “has spoken to NPC”
(four spaces) NPC says “Howdy! I don’t believe I’ve met you before.”
(four spaces) hero receives token “has spoken to NPC”
(four spaces) NPC says “It’s nice to see you again!
I hope you find this helpful!