hey all , i have troubles making my bot run to mob and then attack it , i've tried searching the forum for such a thing with no success , my bot currently attacks just when a mob attacks me , any ideas ?
i got my normal/skill attacks working , i just wanna make it more realistic , i don't wanna attack mobs from long range , i want it to run till it reaches the mob then attacks it .Quote:
It's totally sux atm cuz normal hit & skill are server sided.
Take a look at meak1 sources.
int WalkToMob(int target){
while(true){
difx=Mob[target].X-Player[0].X;
dify=Mob[target].Y-Player[0].Y;
range=((difx*difx)+(dify*dify))*1.0;
/*ATTACK IT*/
if (sqrt(range) < 33.0)
{
printf("Attack!\n");
return 2;
}
else
{
tempx=((difx)/sqrt(range))*32;
tempy=((dify)/sqrt(range))*32;
tempz = (MyHeightDetour(Something(Player[0].X+tempx,0x20),Something(Player[0].Y+tempy,0x20))*10)-Player[0].Z;
PacketSend(0x12,"bbb",tempx,tempy,tempz);
Player[0].X+=tempx;
Player[0].Y+=tempy;
Player[0].Z+=tempz;
//printf("%d %d\n",Player[0].X,Player[0].Y);
if(Mob[target].X == 0)
{
return 1;
}
Sleep(600);
}
}
}
ye sorry that i didnt post him a full source.Quote:
nope thats not enough @ hehepwnz. he wants to know the speed of the character => coordinates per time to walk to the mob and attack it, when standing next to him (for other characters who see him)
i'll post a source snippet later (when on my pc ^^)
can i get an explaination for this function MyHeightDetour ? , thank you all for your supportQuote:
PHP Code:int WalkToMob(int target){
while(true){
difx=Mob[target].X-Player[0].X;
dify=Mob[target].Y-Player[0].Y;
range=((difx*difx)+(dify*dify))*1.0;
/*ATTACK IT*/
if (sqrt(range) < 33.0)
{
printf("Attack!\n");
return 2;
}
else
{
tempx=((difx)/sqrt(range))*32;
tempy=((dify)/sqrt(range))*32;
tempz = (MyHeightDetour(Something(Player[0].X+tempx,0x20),Something(Player[0].Y+tempy,0x20))*10)-Player[0].Z;
PacketSend(0x12,"bbb",tempx,tempy,tempz);
Player[0].X+=tempx;
Player[0].Y+=tempy;
Player[0].Z+=tempz;
//printf("%d %d\n",Player[0].X,Player[0].Y);
if(Mob[target].X == 0)
{
return 1;
}
Sleep(600);
}
}
}
Quote:
DWORD OrigHeight = SearchPattern("55 8B EC 81 EC 94 00 00 00 D9 45 08 D8 35 ? ? ? ? D9 5D 08",0x00400000,0x007FFFFF);
DWORD MyHeightBack = OrigHeight + 9;
float Naked MyHeightDetour(DWORD x,DWORD y,...)
{
__asm
{
push ebp
mov ebp, esp
sub esp, 94h
jmp MyHeightBack
}
}
DWORD Naked Something(DWORD some,DWORD some2,...)
{
_asm
{
push ebp
mov ebp, esp
push ecx
fild [ebp+0x08]
mov eax, [ebp+0x0C]
shl eax, 0Dh
mov [ebp-0x04], eax
fisub [ebp-0x04]
mov esp, ebp
pop ebp
fstp [ebp-0x04]
mov eax,[ebp-0x04]
retn
}
}
int Height(int X, int Y)
{
return (int)MyHeightDetour(Something(X,0x20),Something(Y, 0x20))*10;
}
Well i got it stand in a spot , fight (with skills also) , use scrolls when needed , behade and pick ofc , and some other shit like if u want to mockery mobs when appear for fast fighting or using berserk every 1 min , and i made a list for specified items to pick you know for not picking useless items , that's what i did so far works perfectly but i still cant get it walks like real playerQuote:
Sorry for bumping this1, but nonosocr1986:
Any luck getting it to look real?