I've coded this as it's missing in GoS EXT.
Generates 2 callbacks, OnLoseVision and OnGainVision returning the unit you Lost/Gained vision on.
Save it in Common folder.
Example script:
require("visionCallback") OnGainVision(function(unit) print(unit.charName .. " appeared.") end) OnLoseVision(function(unit) print(unit.charName .. " disappeared.") end)
Result:
You can access to the table these 2 callbacks use with the following code:
print(type(_VISION_TABLE)) -- table
Not recommended editing it unless you know what you are doing!
Credits:
MeoBeo's Buff script