I've tested Marth's code with
print() in
OnBeginNeutralize and
OnFinishNeutralize to check everything that was happening (because I haven't set up
ShowMessageText). Completely worked. I then did
print(cPost) and
print(GetEntityName(cPost)) in
OnBeginNeutralize. Both printed the same thing on Kamino (I think
GetEntityName(cPost) might give you the in game names on maps which have them, if that line does anything at all. But for Kamino I saw cp1, cp2 etc). Then I went and tested the first response I posted where I was using
pTeam[cPost] instead of
pTeam[GetEntityName(cPost)] and
pTeam[(pName)]. Totally worked for me too. No idea why it didn't when you tried it (maybe there's a typo, I typed it out again). I would take Marth's idea of using
elseif pTeam[cPost] == 2 instead of
else in the
OnFinishNeutralize though; sometimes maps have natives and extra teams. The 2nd thing I posted (matrix method) is completely unnecessary, string indexed arrays do work.
Edit: This is the exact code I put at the end of
ScriptPostLoad() on Kamino. I have checked the log to make sure it directs to the right
ShowMessage every time since they just appear as [NULL] to me. So I can confirm this is working code for me.
Edit edit: Have you been using
pTeam anywhere else in your code? Because I've been assuming that you haven't but that might break the line
pTeam = {}, in which case you should try
local pTeam = {} (also in Marth's version) or rename pTeam to something else for this bit.