Basically it's trying to find the creature and it can't, because it hasn't found the creature there.
This method only checks within a small amount of X, Y and Z of the specified location, so the creature has to be more or less on it.
Alternately, you can do this:
Code:
local Unit1 = nil
function A_OnCombat(Unit, Unit1, event)
if Unit1:GetHealthPct() < 10 then
Unit:RegisterEvent("A_phase2",500,0)
end
end
--- script stuff
function Unit1_Spawns_SoWeDefine(pUnit, Event)
Unit1 = pUnit
end
RegisterUnitEvent(npcid, 18, "Unit1_Spawns_SoWeDefine")