Thomas
2015-05-15 09:51:45
Hey,
How would I prevent my basic combat script to attack a NPC that is currently in its death animation?
Perhaps I should start sorting the various TPoints of the models and then start right clicking each of them to select option that isn't 'Attack *Troll' but 'Attack Troll'.
How would I prevent my basic combat script to attack a NPC that is currently in its death animation?
Perhaps I should start sorting the various TPoints of the models and then start right clicking each of them to select option that isn't 'Attack *Troll' but 'Attack Troll'.
function isCombat(): boolean;
begin
if length(ogl.getTextures(7750, mainScreen.getBounds())) or length(ogl.getModels(1452224228, mainScreen.getBounds())) then //either the target reticule or the monster info
exit(true);
end;
procedure attack();
begin
if length(ogl.getModels(403123861, mainScreen.getBounds())) then
begin
wait(gaussRangeInt(500, 1500)); //this currently works semi well (just wait till the one in front of you (closest) is dead
mouse(ogl.getModels(403123861, mainScreen.getBounds()).closest(mainScreen.playerPoint).rand(5), MOUSE_MOVE);
if isMouseOverText(['Attack']) then
fastClick(MOUSE_RIGHT);
if chooseOption.isOpen(500) then
chooseOption.select(['Attack'], 200);
wait(gaussRangeInt(200, 600)); //could replace this with a timer later on, but I like how waits actually pauze my mainloop and save resources
end
else if random(2) then
minimap.setAngle(random(350));
end;
procedure mainloop();
begin
..........
FailTimer.start();
while (not isCombat()) do //have not decided if I would just use; if...then or while...do --> suggestions welcome!
begin
if (FailTimer.getTime() > (randomRange(1000, 1200) * 20)) or (not isLoggedIn()) then
exit();
attack();
end;
..........
end;