I can see what you've gone for and I would also be taking a similar approach with an array with locator id but it will need some tweaks, specifically you should not go for this idea then use a new variable for each dialogue and a new text object also.
- Use the same text object for dialogue and set its position to the npc you are near. Set text to npc, not npc to text...
- For dialogue use one global variable that tracks the array position, not a different variable for each npc or dialogue...
- Possibly make use of an npc family so you can reference 'npcs' instead of individual ones. This way you can pick out a single npc to set visible and make the rest invisible in one event...
Also I think you missed off a part of the event in screenshots as I didn't notice anywhere you increase the position variable to move through the dialogue. My guess it is the last one where you press spacebar but you didn't show the full event.