`to_health` is not health, same with stun. this is change of given stat or be precise "damage to X".
And what Meridian said still hold, unit is stunned when stun excess health. You have current health, stun and change to both.
You need calculate future version to know it.
Some thing like this:
var int status 0;
var int temp 0;
unit.getHealth temp;
add status temp;
unit.getStun temp;
sub status temp;
sub status to_health;
sub status to_stun;
if gt status 0;
#code
end;
not tested, could be some typos here.