SRL Archive - OSR Help

question about finding monsters


l6bustank

2012-12-06 12:53:52

Hi all, I have decided to make myself a fighter script.

I have used FindObjCustom, which is complete bs imo when it comes to finding NPCs. This morning i started to learn about TPA-related object finding.

Which method do you guys think is best?
Idc if complicated or not, everything is learnable (as a matter of fact i already managed to make a crude TPA script).

YoHoJo

2012-12-06 12:55:10

Everyone will suggest TPA/ATPA related things over FindObj.
You can get pretty specific/crafty with TPAs!

l6bustank

2012-12-06 12:58:21

From: YoHoJo
Everyone will suggest TPA/ATPA related things over FindObj.
You can get pretty specific/crafty with TPAs!


Ok, is there a way to find a monster while its moving?

euphemism

2012-12-06 13:03:44

From: l6bustank
Ok, is there a way to find a monster while its moving?


Yes, you will need to write a finding function that is both accurate, and fast enough to find the monster (or monsters) such that by the time the mouse is moving to what your function has determined to be the monster, the monster is still in that same spot.

YoHoJo

2012-12-06 13:09:01

From: euphemism
Yes, you will need to write a finding function that is both accurate, and fast enough to find the monster (or monsters) such that by the time the mouse is moving to what your function has determined to be the monster, the monster is still in that same spot.


Really man?! REALLY?! WE DID NOT KNOW THAT! :duh: <3 :)

Um make a TPA/ATPA and pick a prominent color, then pick a decent sized search box, then count the colors in the box, if they are large, then click it.
Loop the function until uptext is found (or too many tries have expired).
Pretty sure it can be executed fast enough before a monster moves too. If not, just make a TPA and have a really good color/ACA(auto color aid) for the monster so it only finds the monster.

That's a decent basic idea/outline of what to do. Now you've got some studying to do!

TPA/TPAs are considered a bit more advanced than regular techniques (I think?), but they are SUPER powerful tools and used in all sorts of situations!

Check out some scripts/tutorials that use them.

l6bustank

2012-12-06 13:11:21

Found this tut, will keep looking and trying too, thanks guys!
http://villavu.com/forum/showthread.php?t=76005

YoHoJo

2012-12-06 13:13:43

This one's a bit long/dense(I think?) but it's really good!
You don't need ALL of the techniques it teaches you it covers a lot of the TPA/ATPA functions, you just need the ones relevant to you and it has nice pictures!
http://villavu.com/forum/showthread.php?t=49067

l6bustank

2012-12-06 13:15:31

From: YoHoJo
This one's a bit long/dense(I think?) but it's really good!
You don't need ALL of the techniques it teaches you it covers a lot of the TPA/ATPA functions, you just need the ones relevant to you and it has nice pictures!
http://villavu.com/forum/showthread.php?t=49067

Ooo, looks bad-ass, i'll get cracking right away :D

euphemism

2012-12-06 14:24:55

From: YoHoJo
Really man?! REALLY?! WE DID NOT KNOW THAT! :duh: <3 :)


Apologies for trying to help.

Nexz

2012-12-10 19:57:10

One I made works great IMO:
{
FindObjDual(TPA, Dist, XSortFrom, YSortFrom,
Color1, Tol1, HMod1, SMod1, MinCount1,
Color2, Tol2, HMod2, SMod2, MinCount2)
}
function FindObjDual(var TPAResult: TPointArray;
Dist, XSortFrom, YSortFrom: Integer;
Color1, Tol1: Integer; HMod1, SMod1: Extended; MinCount1: Integer;
Color2, Tol2: Integer; HMod2, SMod2: Extended; MinCount2: Integer): Boolean;
var
CTS, I, II: Integer;
TPA1, TPA2, TPA3, TPA4, TPA5: TPointArray;
ATPA1: T2DPointArray;
Box1: TBox;
Point1: TPoint;
begin
TPAResult := [];
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(HMod1, SMod1);
FindColorsTolerance(TPA1, Color1, MSX1, MSY1, MSX2, MSY2, Tol1);
SetColorSpeed2Modifiers(HMod2, SMod2);
FindColorsTolerance(TPA2, Color2, MSX1, MSY1, MSX2, MSY2, Tol2);
ColorToleranceSpeed(CTS);
TPA3 := CombineTPA(TPA1, TPA2);
ATPA1 := SplitTPA(TPA3, Dist);
for I := 0 to High(ATPA1) do
begin
Box1 := GetTPABounds(ATPA1[I]);
TPA4 := [];
TPA5 := [];
for II := 0 to High(TPA1) do
begin
if (InRange(TPA1[II].X, Box1.X1, Box1.X2)
and InRange(TPA1[II].Y, Box1.Y1, Box1.Y2)) then
begin
TPA4 := CombineTPA(TPA4, [TPA1[II]]);
end;
end;
for II := 0 to High(TPA2) do
begin
if (InRange(TPA2[II].X, Box1.X1, Box1.X2)
and InRange(TPA2[II].Y, Box1.Y1, Box1.Y2)) then
begin
TPA5 := CombineTPA(TPA5, [TPA2[II]]);
end;
end;
if (Length(TPA4) >= MinCount1) and (Length(TPA5) >= MinCount2) then
begin
Point1 := IntToPoint(Box1.X1 + ((Box1.X2 - Box1.X1) / 2), Box1.Y1
+ ((Box1.Y2 - Box1.Y1) / 2));
TPAResult := CombineTPA(TPAResult, [Point1]);
end;
end;
SortTPAFrom(TPAResult, IntToPoint(XSortFrom, YSortFrom));
if (Length(TPAResult) > 0) then
Result := True;
end;
It's like FindObjTPA (uses MinCount) but with 2 colors (and cts2) so way more accurate.
If you want to know how to use it take a look at my tanner script, link in signature. If you need more help just ask.