The green outline and red outline are both constant colors. Just do a tpa search.
I use this to find if they are dead(TPoint of the middle of the tracked npc).
function FindDeath(P: TPoint): Boolean;
var
TPA: TPointArray;
ATPA: T2DPointArray;
B, tB: TBox;
Len, i, Dist: Integer;
begin
Result := False;
if not LoggedIn then Exit;
B := IntToBox(P.x - 45, P.y - 55, P.x + 45, P.y + 20);
if (B.X1 < MSX1) then B.X1 := MSX1;
if (B.Y1 < MSY1) then B.Y1 := MSY1;
if (B.X2 > MSX2) then B.X2 := MSX2;
if (B.Y2 > MSY2) then B.Y2 := MSY2;
if FindColorsSpiralTolerance(MSCX, MSCY, TPA, 132923, B.X1, B.Y1, B.X2, B.Y2, 0) then
begin
ATPA := SplitTPA(TPA, 10);
SortATPASize(ATPA, True);
if not (Length(ATPA) > 0) then Exit;
for i := 0 to High(ATPA) do
begin
Len := Length(ATPA[i]);
if (Len > 0) then
begin
tB := GetTPABounds(ATPA[i]);
Dist := Distance(tB.X1, tB.Y1, tB.X2, tB.Y2);
m_Debug('HP bar dist: ' + ToStr(Dist), False);
Result := (Dist > 54);
if Result then
begin
if Debug then
begin
SMART_DrawBoxEx(False, B, clBlue);
SMART_DrawBoxEx(False, GetTPABounds(ATPA[i]), clWhite);
end;
Exit;
end;
end;
end;
end;
end;