PDA

View Full Version : MainScreen HP Detection!



n3ss3s
11-22-2007, 08:17 PM
I know YoHoJo has made this once, but I wanted to make one my way.

I hope there is none in SRL, atleast I haven't seen one.

Works, but sometimes the "hit splats" may come in the way which gives false results.


You are free to use as long as you credit me.

Enjoy ;)


Function GetHealthPoints: TPointArray;
Var
BarPoints: Array of TPointArray;
Green, Red, TPA: TPointArray;
Place, X, Y, I: Integer;
Dists: TIntegerArray;
Begin
FindColorsTolerance(Green, 65280, MSX1, MSY1, MSX2, MSY2, 0);
FindColorsTolerance(Red, 255, MSX1, MSY1, MSX2, MSY2, 0);
TPA := CombineTPA(Green, Red);
BarPoints := SplitTPAEx(TPA, 50, 15);
SetArrayLength(Dists, GetArrayLength(BarPoints));
For I := 0 To High(BarPoints) Do
Begin
MiddleTPAEx(BarPoints[i], X, Y);
Dists[i] := Distance(MSCX, MSCY, X, Y);
End;
InIntArrayEx(Dists, Place, AMin(Dists));
Result := BarPoints[Place];
End;

Function HealthPercent: Integer;
Var
Green, Red, I: Integer;
HPts: TPointArray;
Begin
HPts := GetHealthPoints;
For I := 0 To High(HPts) Do
Case GetColor(HPts[i].x, HPts[i].y) Of
255: Red := Red + 1;
65280: Green := Green + 1;
End;
Result := Round(Green / 150 * 100);
End;

Wizzup?
11-22-2007, 08:19 PM
I made this, too... Quite a while ago.. Together with GetDamageIn.. ;)

JuKKa
11-22-2007, 08:24 PM
I have had a great idea all day which i might fullfill now ..

Based on wizzups GetDamage and possibly a few of nesses functions..

edit wizzup i cant seem to find it possible for u to PM it or post.. xP

King of Knives
11-22-2007, 08:25 PM
Lol I've made something similar. To no surprise, you have done yours with TPointArrays :P Mine would get the HP percent of a HPbar within 2 tiles of where your char was, and it would not read your own. I never got around to posting it, because I found it pretty much useless...

-Knives

Wizzup?
11-22-2007, 09:17 PM
http://www.villavu.com/forum/showthread.php?t=11869?t=13212&highlight=damage

n3ss3s
11-23-2007, 10:41 AM
Im glad thats five months ago, Wizzy now yours is propably faster than before since those functions are in the plugin of yours :)

Yes, TPAs FTW!