Hello Everyone! I don't know if any of you ever had problems with moving NPC
's or Monster
's, but I
've had Problems
with them and I am willing to simplify
your life with a
tutorial on How to Find a Moving NPC or Monster without any more
headache. If you are
tired to see
your bot
trying to find
your NPC, but can't because someone is near you and
he
has the
same color as your Script, so
your bot keep
s moving the mouse on this guy
's monsters because he is the closest
to them until he get
's further away,
until finally you gain priority to kill the monsters since your in the better spot. (unsure if this is the idea you are trying to convey/talk about)
Why Would you want to use This Method?
Well, I am not here to
force you to use
my method, but It is very effective. You can continue to use Simple Method like this:
Simba Code:
if (findobjcustom(x,y,['Wilderness'],[2172972],5)) then
But like I said,
if I come
near
you with the
same
color as your
script,
you will have a lot of
fun
watching your
bot hovering the
mouse on me
trying to find the
target as
you can see on this Picture! --That I don't have :O-- (lol :P)
How to do it:
Basically, At the end of this
tutorial,
your
function for
finding the NPC will look like the
function
below. In this case, I was searching a NPC and I had to
click and
choose a
n option on him.
Simba Code:
Function TalkingToMages: Boolean;
Var
TPAA: T2DPointArray; // The Variables of the Functions
TPA: TPointArray;
CTS, I, Retry: Integer;
Begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, YourColorHere, MSX1, MSY1, MSX2, MSY2, Tolerance); // Enter the Color and Tolerance Here at the Right place.
ColorToleranceSpeed(CTS);
TPAA := TPAToATPAEx(TPA, Width, Heigh); //Put the Width and Heigh here
SortATPASize(TPAA, True);
For I := 0 To High(TPAA) Do
If GetArraylength(TPAA[i]) > 5 Then // Set How Much Points you need for your function to take Action
Begin
repeat
inc(Retry);
MiddleTPAEx(TPAA[i], X, Y);
MMouse(X, Y, 3, 3);
if (IsUpTextMultiCustom(['age', 'amorak'])) then // Enter The name of Your NPC or Monster
Begin
Result := True;
GetMousePos(X, Y);
mouse(x,y,3,3,false);
wait(100 + random(200));
ChooseOption('elep');
wait(5000 + random(1000));
Break;
End;
until (Retry = 15);
Break;
end;
end;
This
may look
scary for
now, but
it will become
a lot
easier
after I explain
to you
step by
step,
(of) hat to do!
Lets
get started!
Step 1 : Get Your Color!
Since NPC
's or Monster
s move,
you want to
pick the color on
his head;
it will be a lot
easier for
your
script to
find out the NPC like that, because
if you
pick a color that is only visible on
(the) chest
(chest of the monster?) and your NPC cannot be found from the angle on the screen, then
your function will
return
false
as if there
was no NPC.
For this
reason, I decided to
pick goblins as
an example for
this
script.
As
you see,
the
color of
the
head of
this goblin is 5940087. For tolerance,
it is pretty much testing
what works best, I would always recommend
start
ing with a
tolerance of 7 and
if you don't like the
result,
you can
adjust it to your liking/which ever works for you. If you are
wondering
what happen
s when
you reduce your tolerance,
it will search for
colors that are near to the one you
picked. If you rise it,
it will search for
colors that are more likely the
same as
your color.
With
your color and
tolerance,
you have to to put them in
to the function. Here is a
picture on
where to
put them :
Step 2 : Get the Width and Height
This is
by far the most important
part of
this function. The
end result will
depend
on how good you do it. So, let me explain how we get this. Did you always wonder
how
people
were getting their
distance in-
game, since there is no option that
tell
s us
the exact distance
between points? Well, there is a way to know how
far
each point
is from
each
other and
it is with
pick
ing the color. Before I explain
how to do it,
take a look at this
picture I posted
below:
Why are we doing this? We want to
make a
box, so
when our
script
does the
function,
our character will find
dots of our
color and
if there is
enough
dot
to make the
same box as
us, the function will return
true and
he will click in the middle of the
box. Now, lets get into the
topic; how to get these values. As you can see,
we don't see my
mouse on the
screen,
so I made a
red
dot to
indicate
where
my mouse was!
__________________________________________________ _____________
What you want to do: First,
get beside your NPC
(like I did
) th
en
click on Pick Color on Simba. The screen will freeze and that's exactly what we want. What
we want to do is
get the
dimension of the
head. As your see, I moved my
mouse to
what
would be my bottom
right corner and I took note of the
coordinates that w
ere in the
red
box(638,624). After, I did the
same, but on the opposite side,
so I moved my
mouse to
what would be my
top
left
corner and
took note of the coordinates (635,771). So,
now do you see the
box I was
talking
about?
The next
step is
to get
the width and
height. First,
put the value of the same
type
together, so 638 with 635 and 624 with 771 = (638,635) and (624,771). If you are wondering why
my second
value is so
high, it's
because I took a
picture and the coordinates from it
(the picture), but I didn't place paint in the same arena as I took the
coordinates with the first picture and it wasn't on the same place on my
main screen, so I got coordinates that are wrong, but it won't happen if you do it on your
playing
screen. For this
reason,
we will change our 771 for 625. Now, it should be (638,635) and (624,625).
Why
do we need
these values
? If you do 638 - 635 = 3 and this is our
width. 624 - 625 = -1, but we can't have
a negative
value, so we turn it into
a positive
(value) by which
I mean 1 and this is our
height. Wow! We are almost done! Enter
the
width and
height to their
respective
place
shown on the
picture below and
when you
script, use this function; (It will
search for array that will allow him to make a
box like this on this
picture.)
Step 3 - Get the Up Text
As you see on the picture,
when you move your
mouse
over the Goblin,
there is a
n Up Text. Never
use the
first letter, because it will make it longer for your
bot to
detect, if it is the
right NPC. So
here
is what our Up Text would be : "
oblin" that we would add on here on this picture below.
So, Our Script Should look like this now
Simba Code:
Function TalkingToMages: Boolean;
Var
TPAA: T2DPointArray; // The Variables of the Functions
TPA: TPointArray;
CTS, I, Retry: Integer;
Begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 5940048, MSX1, MSY1, MSX2, MSY2, 7); // Enter the Color and Tolerance Here at the Right place.
ColorToleranceSpeed(CTS);
TPAA := TPAToATPAEx(TPA, 3, 1); //Put the Width and Height here
SortATPASize(TPAA, True);
For I := 0 To High(TPAA) Do
If GetArraylength(TPAA[i]) > 5 Then // Set how many points you need for your function to take Action
Begin
repeat
inc(Retry);
MiddleTPAEx(TPAA[i], x, y);
MMouse(X, Y, 3, 3);
if (IsUpTextMultiCustom(['oblin'])) then // Enter the name of your NPC or Monster
Begin
Result := True;
GetMousePos(X, Y);
mouse(x,y,3,3,false);
wait(100 + random(200));
ChooseOption('elep');
wait(5000 + random(1000));
Break;
End;
until (Retry = 15);
Break;
end;
end;
In this
case,
my function was
click on
a NPC that I had to
talk and
choose a
n option to
teleport. Here,
we want to
attack a goblin so
we are going to change the
end of this
function to attack instead of
trying to
find the
option
teleport on Goblin.
Simba Code:
Function TalkingToMages: Boolean;
Var
TPAA: T2DPointArray; // The Variables of the Functions
TPA: TPointArray;
CTS, I, Retry: Integer;
Begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 5940048, MSX1, MSY1, MSX2, MSY2, 7); // Enter the Color and Tolerance here at the right place.
ColorToleranceSpeed(CTS);
TPAA := TPAToATPAEx(TPA, 3, 1); //Put the Width and Height here
SortATPASize(TPAA, True);
For I := 0 To High(TPAA) Do
If GetArraylength(TPAA[i]) > 5 Then // Set how many Points you need for your function to take Action
Begin
repeat
inc(Retry);
MiddleTPAEx(TPAA[i], x, y);
MMouse(X, Y, 3, 3);
if (IsUpTextMultiCustom(['oblin'])) then // Enter the name of your NPC or Monster
Begin
Result := True;
GetMousePos(X, Y);
mouse(x,y,3,3,true);
wait(5000 + random(1000));
Writeln('We have found our Goblin, Yeh!');
Break;
End;
until (Retry = 15);
Break;
end;
end;
Now,
we are
good. Also, I added what we
call a FailSafe, so
if the Script
doesn't find the goblin after 15
attempts, it will end. That's where
you can enter in
your script a procedure to
walk
to a
new place to
try to find
another NPC or change the
angle of
the compass. This method
can also be used to find Object in the
(use "a" instead?) World;
so I hope I helped you out to
make
a better Script with the
ability to find NPC
's way easier without any more
trouble.