Your test is flawed:
1. Your two units spawn in direct line of sight.
2. endless calculations
3. AI shoots player
3. NVG removal script is executed
Place the two units like this:
o->
---------WALL------------
o->
And walk around the wall - the NVG-free unit won't see you unless you literally bump into it.