I'm trying to make a script for a RSPS and the only problem I'm having is.
Sometimes whenever you're skilling, you will be attacked by a monster and it will kill you.
How do I check if a monster is attacking me on a private server?
Printable View
I'm trying to make a script for a RSPS and the only problem I'm having is.
Sometimes whenever you're skilling, you will be attacked by a monster and it will kill you.
How do I check if a monster is attacking me on a private server?
DTMs or bitmaps would be your best bet.
You could search for the hitsplats or your health bar above your head.
Look for the healthbar above your head, function I used:
Simba Code:function healthBar(b:tbox):boolean;
var
red, green, bar:tpointarray;
healthbar:t2dpointarray;
i:integer;
bx:tbox;
begin
if ((mainscreen.bounds.x1 + (b.x1 - 2)) < 0) then
exit(false);
findColors(green, 65280, b.x1 - 2, b.y1-7, b.x2, b.y2);
findColors(red, 255, b.x1 - 2, b.y1 - 7, b.x2, b.y2);
bar := mergeAtpa([green, red]);
if (length(bar) > 0) then
begin
healthbar := clustertpa(bar, 1);
if (length(healthbar) = 0) then
exit(false);
for i := 0 to high(healthbar) do
begin
bx := gettpabounds(healthbar[i]);
if ((bx.x1 - bx.x1) > 25) then
exit(true);
end;
end;
end;