I am not familiar to the particular engine you are working with, but in most languages or cases you can use a 1xn matrix (i.e. a vector) where n is the total number of NPCs, that stores the 1-or-0 values, so the position within the vector is related to the NPC number.
For instance, in pseudo-code:
already_talked = {1,0,1...n}
//where n is the total number of NPCs
So the first value in the vector relates to NPC1, the second value relates to NPC2, and so on.
If you save that to a simple text file together to the other information you are saving, it would end up looking like a simple comma-separated entry inside the text file, like the following:
x = 400
y = 424
d = UP
name = Ezia
mapname = startmap
already_talked = 1,0,1
EDIT:
In reply to your further detailing given in the comments to my answer, I will add the following. If you want to save the "already talked" state for many different maps, you have three fine options.
1) just don't restart counting the NPC index every map. So, suppose in the first map you have 3 NPCs and in the second you have 4. The first NPC in the first map will be the number 1, the second will be the number 2, the third will be the number 3. Then, the first NPC in map 2 will be the number 4, the second in map two will be the number 5, the third will be the NPC number 6 and the fourth in map two will be the NPC number 7.
That way, you can still store everything only in one variable "already_talked".
2) another option, if you want to re-start the NPCs indexing every map, is the following. It might look messier but is actually simpler to maintain, is to just use one storing variable per map. So, in pseudo-code:
already_talked_map1 = {1,0,1 ... n1}
already_talked_map2 = {0,1,1 ... n2}
//where n1 and n2 are, respectively, the total number of NPCs in maps 1 and 2
3) a last option, also if you want to re-start the NPCs indexing every map, is to use a mxn matrix instead of a vector, so the rows indicate the map index you are referring to and the columns indicate the NPC indexing you are referring to. But in that case the way of storing the matrix in an external file together with other non-matrix information (e.g. char name, x, y, d, etc) may vary depending on the language and engine you are using.
Personal suggestion: I myself usually go for the second option if I don't have hundreds of maps. If you do have hundreds of maps, go for options one or three (the first if you want simple implementation).