SRL Archive - Test corner

Looting Items in a Item invested Area


Claymore

2012-01-06 02:08:37

Hello all, i'm currently developing a very nice accurate script for Waterfiends as we lack combat scripts and i need charms for 99 Summoning.

Right now im working at the harder parts of this script, which is looting. I found a problem however that the Waterfiend area is invested with junk loots scattered around.

How i search for my crimson charm is simply finding the water rune (because Waterfiends drop them 100% of the time PLUS they always appear on top of the other drops), right clicking, than selecting the crimson. (If it exists)

However when i made this function, it kept finding other water runes, checking it, than moving on to the next water rune, and so on until it found the drop i got from MY Waterfiend.

Solutions i tried but sort of failed:

I used a tracking function to track which monster im fighting. When that monster dies and i call up my FindItem function, i use the coordinates of the slain monster, create a TBox, and make my FindItem search in that area only.

Problem, the tracking function often picks up other Waterfiends along the way and get mixed up. This happens occasionally since they like to cross paths.


Taking any suggestions regarding drops and fighting for Waterfiend script. Right now im only 10% done with finding the monster, and picking up loot. Looking at Zybez and other guides to find an effecient, easy bot like method to fighting Waterfiends.

Brandon

2012-01-06 02:30:35

I personally use MMToMS(GetMMDotsOnMS('Item')) Or MMToMS(GetMMDotsOnMS('NPC')) and see which one is closest by distance from me.. right click that spot and then look for crimsons..

Thing is, one pixel off = 0.5-1 tile off.. its too delicate.. so it's bad but just throwing it out there. When reflection was around, I'd usually find which way my character was facing, and right click the tile infront of me (if only u can do that in colour).. Or you can do like I've seen other ppl do and just stand on the red-dots and pickup items that way lol..

Can always try finding waterfiends only in a one tile radius from you and use the hitsplat to determine if it's yours.. Why? Because when you hit, it's always either a solid blue or solid red.. when others hit, its maroon and if they hit 0's it doesn't show..

Claymore

2012-01-06 13:47:45

^ Thanks!

I think ill use the damage to determine where the monster's drops were. Its effective, but tedious :p



function LootItems: Boolean;
var
mmItems, TPA: TPointArray;
ATPA: T2DPointArray;
BoxArr: TBoxArray;
rBox: TBox;
P: TPoint;
l, i, z: Integer;
begin
mmItems := GetMMDotsOnMS('item');
l := Length(mmItems);

if L < 1 then
Exit;

SetLength(BoxArr, l);
for i := 0 to l - 1 do
begin
P := MMtoMS(mmItems[i]);
BoxArr[i] := IntToBox(Max(P.x - 35, MSX1), Max(P.y - 35, MSY1), Min(P.x + 35, MSX2), Min(P.y + 35, MSY2));
end;

{$IFDEF SMART}
if DEBUG_ENABLED then
for i := 0 to High(BoxArr) do
SMART_DrawBoxEx(True, BoxArr[i], clBlue);
{$ENDIF}

for z := 0 to l - 1 do
begin
for i := 0 to High(Items) do
begin
SetColorToleranceSpeed(2);
WriteLn('Looking for item ' + IntToStr(i));
SetColorspeed2Modifiers(Items[i].Hue, Items[i].Sat);
if FindColorsTolerance(TPA, Items[i].Color, BoxArr[z].x1, BoxArr[z].y1,
BoxArr[z].x2, BoxArr[z].y2, Items[i].Tol) then
begin
WriteLn('Found Colors!');
{$IFDEF SMART}
if DEBUG_ENABLED then
SMART_DrawDotsEx(False, TPA, clRed);
{$ENDIF}
ATPA := SplitTPA(TPA, Items[i].Size);
SortATPASize(ATPA, True);
rBox := GetTPABounds(ATPA[0]);
P := MiddleBox(rBox);
if not PointInBox(P, IntToBox(Monster.x1, Monster.y1, Monster.x2, Monster.y2)) then // Monster.xx is a TBox from a record. This box is the last known location of the box the monster was in.
Continue;
with rBox do
MouseBox(x1, y1, x2, y2, 3);

if WaitUpText('Take', 500) then
begin
ClickMouse2(False);
if WaitOptionMultiEx(['charm'], 'All', clickLeft, 500) then
Result := True;
if Result then
Exit;
end;
end;
end;
end;
SetColorToleranceSpeed(1);
SetColorspeed2Modifiers(0.2, 0.2);
end;


I made it only pick up charms. However im glad to say it works as it will only loot where the Monster.TBox is (Which was found through finding the monster, making a GetTPABounds, than tracking the monsters colors. Than it uses the suggested idea of GetMMOnMS.

Thanks guys! Any more inputs on this? I could use some ideas for my Waterfiend script :p

Narcle

2012-01-08 19:36:30

Claymore, take a look at my custom pickup in NAF. I even have all the colors set for charms (cts2). (Narcles AutoFight in members scripts, download NAF 0.9.0)

Also the fighting procedure might be enlightening too ;)

E:
Ah I see the problem, water runes on the ground everywhere =/

I think there's an easy solution to this. After you kill one let it search through the water runes (closest first obviously) then after it successfully picks up a charm mark it down somehow and make sure it only searches after a kill. Also if it fails to find one (rare chance one doesn't drop?) mark it as well so you can skip procedure. Otherwise it'll spam click the runes yes?