Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Kal Online
You last visited: Today at 23:50

  • Please register to post and access all features, it's quick, easy and FREE!


Code help

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jul 2013
Posts: 20
Received Thanks: 1
Question Code help

Hey!
I need some help regarding the code.
Problem is about walking to mob/monster. It walks perfect with 0x15 packet. Symptom is that at first few packets are good, so it does actually moves to the monster's position (distance is reducing).
But after few moves, suddenly the distance (difference between my x, y and monster's and vica versa) is larger than 1 packet sent before (distance is increasing). Wierd???
Here's a SS of my problem (note i print my numbers with %f )

*posted at bottom

I've tried using this tip below, but that part (Player[0].X+=tempx; Player[0].Y+=tempy; ) crashes engine:
Quote:
Originally Posted by meak1 View Post
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].== 0)
{
return 
1;
}
Sleep(600);
}
}

Here are snippets of my code:
MOB SEARCH:
PHP Code:
int SearchMob()
 {
    
//Kal::ChatBox( "[Lungi]: ",4,"start");
     
int i 0;
    while( 
true )
    {
        
Sleep(10);
        
int nearest 1100;
        
int id = -1;
        for ( 
100 i++ )
        
        if ( ( 
Monster[i].+1500 Player1[0].) && ( Monster[i].-1500  Player1[0].))
        {
            
Sleep(10);
        
//    Kal::ChatBox( "[Lungi]: ",5,"found");
            
int difx =Monster[i].X  Player1[0].X;
             
int dify Monster[i].Player1[0].Y;

            
float Range=((difx*difx)+(dify*dify));
            
float Mobrangesqrt(Range);
        
//    Kal::ChatBox( "[Lungi]: ",4,"Range start is: %d",Mobrange);    
            
Sleep(500);            
            if ( 
nearest Mobrange )
            {
                    
id i;
                    
nearest Mobrange;
            
//Kal::ChatBox( "[Lungi]: ",4,"mob near");
            
}
        
Sleep(100);
        }
        if ( 
id != -)
        {
            
target id;
        return 
1;
        }
            
        
Sleep(90);
    }

WALK TO MOB:
PHP Code:
int WalkToMob(int targetx){
    
bool forward true;
//    int moves = 0;
    
while(forward)
    {
    
Sleep(20);
        
Kal::ChatBox"[Lungi]: ",4,"walking");
        
int difx Monstertargetx ].Player1[0].X;
         
int dify Monstertargetx ].Player1[0].Y;
        
//Kal::ChatBox( "[Lungi]: ",4,"Difference is:  X: %d , Y: %d",difx,dify);
        
Sleep(100);
         
float Range=((difx*difx)+(dify*dify))*1.0;
    
float    distance=sqrtRange );
    
Kal::ChatBox"[Lungi]: ",4,"distance is: %f ",distance);
    
Sleep(50);
         if( 
Monstertargetx ].== 0)
        {
        
forward false;
            return 
1;
        
//Kal::ChatBox( "[Lungi]: ",4,"mob is shit");
        
}            
    if (
distance 35.0)
            {
                   
//    Kal::ChatBox( "[Lungi]: ",6,"we WILL move");
                
unsigned char tempx =    (( difx ) / sqrtRange ))  * 32;
                
unsigned char tempy =   (( dify ) / sqrtRange ) )  * 32;
                
Sleep(200);
                
SendKoemV2(0x15,"bbb",tempx,tempy,0);
                
// Player1[0].X+=tempx;
              //   Player1[0].Y+=tempy;
            //    Kal::ChatBox( "[Lungi]: ",2,"sending move packet");
[B]         int minus 0;
                if (
tempx 128)
                {
                    
Player1[0].+= tempx;
                }
                else
                {
                    if (
tempx 128)
                    {
                        
minus=tempx 256;
                        
Player1[0].+= minus;
                    }
                }
                if (
tempy 128)
                {
                    
Player1[0].+= tempy;
                }
                else
                {
                    if (
tempy 128)
                    {
                        
minus=tempy 256;
                        
Player1[0].Y+= minus;
                    }
                }
        
                
                }[/
B]
        else
        {
        
Sleep(100);
         
forward false;
         return 
2;   
    
//    Kal::ChatBox( "[Lungi]: ",4,"range is good, proceed attack");
    
}
        }
//    Kal::ChatBox( "[Lungi]: ",4,"failed loop");
    //return 1;

Here i don't know what's the bald part about.
I would appriciate any tip, suggestion, perhaps solution to my problem, if that's possible. I use these props on KoemV2 protected game.
Attached Images
File Type: jpg shot_2013_8_28_001.jpg (224.5 KB, 45 views)



Lungi is offline  
Old 08/28/2013, 17:05   #2
 
elite*gold: 0
Join Date: Dec 2008
Posts: 219
Received Thanks: 28
:O you use it on a pserver, and i guess this "codes" are eigther for koemv2 on pservers as i can see up there xD or they are simply just for int


Birne123 is offline  
Old 08/28/2013, 17:09   #3
 
elite*gold: 0
Join Date: Jul 2013
Posts: 20
Received Thanks: 1
I don't understand what you're saying. Is it wrong to try to learn how to code, and use it on pserver? This code should work on pserver with no problem, perhaps on int aswell, but i have no interest in int.
Please post only if you can help me!!
Greets, Lungi.
Lungi is offline  
Old 08/28/2013, 18:14   #4
 
elite*gold: 0
Join Date: Dec 2008
Posts: 11
Received Thanks: 1
OnMapClick



parostatek is offline  
Old 08/28/2013, 22:04   #5
 
elite*gold: 0
Join Date: Oct 2010
Posts: 158
Received Thanks: 73
Here is my old bot, it's slow abit but working fine:
Code:
if(TestBot == 1)
		{
			for(int i = 0; i < MAX_MOB; i++)
			{
				if((ActivateMonsters[i].MonsterID != 0)&&(ActivateMonsters[i].mHp != 0))
				{
					Kal::UpperChat(red,"Searching for nearest mob.");
					for(int a = 0; a < MAX_MOB; a++)
					{
					  if((ActivateMonsters[a].MonsterID != 0)&&(ActivateMonsters[a].mHp != 0))
				       {
						int FarX = ActivateMonsters[a].mX - Player[0].dwPlayerX;
						int FarY = ActivateMonsters[a].mY - Player[0].dwPlayerY;
						float Range = (FarX*FarX)+(FarY*FarY);
						if(NearLimit > sqrt(Range))
						{
							NearLimit = sqrt(Range);
							TargetMonster=a;
						}
					  }
					}
					if( NearLimit < 5000 )
					{
					  Kal::UpperChat(red,"Found nearest mob, now moving to it. It range: %d Mob number: %d.",NearLimit,TargetMonster);
					  if(NearLimit > 65)
					    Kal::MoveTo(ActivateMonsters[TargetMonster].mX,ActivateMonsters[TargetMonster].mY);
					  for(int b = 0; b < 20; b++)
					  {
					  if(ActivateMonsters[TargetMonster].mHp == 0)
						  break;
						if(NormalHit2 < timeGetTime()-1300)
			               {
			                SendEngine(0x0F,"bdd",1,ActivateMonsters[TargetMonster].MonsterID,0);
			                NormalHit2 = timeGetTime();
			               }
			           else if(PowerfulPush2 < timeGetTime()-5000)
			               {
			                SendEngine(0x10,"bbd",16,1,ActivateMonsters[TargetMonster].MonsterID);
		                    SendEngine(0x10,"bbd",17,1,ActivateMonsters[TargetMonster].MonsterID);
			                Kal::ChatBox("[Prince] ",1,"Powerful Upward Slash.");
			                PowerfulPush2 = timeGetTime();
			               }
			           else if(HalfSwing2 < timeGetTime()-11100)
			               {
			                SendEngine(0x10,"bbd",25,1,ActivateMonsters[TargetMonster].MonsterID);
		                    SendEngine(0x10,"bbd",17,1,ActivateMonsters[TargetMonster].MonsterID);
			                Kal::ChatBox("[Prince] ",1,"HalfSwing.");
			                HalfSwing2 = timeGetTime();
			               }
			           else if(Zerk2 < timeGetTime()-601100)
			               {
			                SendEngine(0x10,"b",24);
			                Zerk2 = timeGetTime();
			               }
					   Sleep(1000);
					  }
					}
					Kal::UpperChat(red,"Moving back now.");
					NearLimit=65535;
					Kal::MoveTo(MyX,MyY);
					Sleep(1000);
				}
				if(i == MAX_MOB)
				{
					i=0;
					Kal::UpperChat(green,"AnotherLoop.");
				}
			}
		}
mohm195 is offline  
Old 08/28/2013, 23:21   #6
 
elite*gold: 0
Join Date: Apr 2011
Posts: 30
Received Thanks: 1
Kal::MoveTo(ActivateMonsters[TargetMonster].mX,ActivateMonsters[TargetMonster].mY);
When u Tell what that Func does it helps.
VirusBastard is offline  
Old 08/28/2013, 23:56   #7
 
elite*gold: 0
Join Date: Oct 2010
Posts: 158
Received Thanks: 73
This should help:

mohm195 is offline  
Old 08/29/2013, 15:50   #8
 
elite*gold: 0
Join Date: Jul 2013
Posts: 20
Received Thanks: 1
Quote:
Originally Posted by mohm195 View Post
Here is my old bot, it's slow abit but working fine:
Code:
if(TestBot == 1)
		{
			for(int i = 0; i < MAX_MOB; i++)
			{
				if((ActivateMonsters[i].MonsterID != 0)&&(ActivateMonsters[i].mHp != 0))
				{
					Kal::UpperChat(red,"Searching for nearest mob.");
					for(int a = 0; a < MAX_MOB; a++)
					{
					  if((ActivateMonsters[a].MonsterID != 0)&&(ActivateMonsters[a].mHp != 0))
				       {
						int FarX = ActivateMonsters[a].mX - Player[0].dwPlayerX;
						int FarY = ActivateMonsters[a].mY - Player[0].dwPlayerY;
						float Range = (FarX*FarX)+(FarY*FarY);
						if(NearLimit > sqrt(Range))
						{
							NearLimit = sqrt(Range);
							TargetMonster=a;
						}
					  }
					}
					if( NearLimit < 5000 )
					{
					  Kal::UpperChat(red,"Found nearest mob, now moving to it. It range: %d Mob number: %d.",NearLimit,TargetMonster);
					  if(NearLimit > 65)
					    Kal::MoveTo(ActivateMonsters[TargetMonster].mX,ActivateMonsters[TargetMonster].mY);
					  for(int b = 0; b < 20; b++)
					  {
					  if(ActivateMonsters[TargetMonster].mHp == 0)
						  break;
						if(NormalHit2 < timeGetTime()-1300)
			               {
			                SendEngine(0x0F,"bdd",1,ActivateMonsters[TargetMonster].MonsterID,0);
			                NormalHit2 = timeGetTime();
			               }
			           else if(PowerfulPush2 < timeGetTime()-5000)
			               {
			                SendEngine(0x10,"bbd",16,1,ActivateMonsters[TargetMonster].MonsterID);
		                    SendEngine(0x10,"bbd",17,1,ActivateMonsters[TargetMonster].MonsterID);
			                Kal::ChatBox("[Prince] ",1,"Powerful Upward Slash.");
			                PowerfulPush2 = timeGetTime();
			               }
			           else if(HalfSwing2 < timeGetTime()-11100)
			               {
			                SendEngine(0x10,"bbd",25,1,ActivateMonsters[TargetMonster].MonsterID);
		                    SendEngine(0x10,"bbd",17,1,ActivateMonsters[TargetMonster].MonsterID);
			                Kal::ChatBox("[Prince] ",1,"HalfSwing.");
			                HalfSwing2 = timeGetTime();
			               }
			           else if(Zerk2 < timeGetTime()-601100)
			               {
			                SendEngine(0x10,"b",24);
			                Zerk2 = timeGetTime();
			               }
					   Sleep(1000);
					  }
					}
					Kal::UpperChat(red,"Moving back now.");
					NearLimit=65535;
					Kal::MoveTo(MyX,MyY);
					Sleep(1000);
				}
				if(i == MAX_MOB)
				{
					i=0;
					Kal::UpperChat(green,"AnotherLoop.");
				}
			}
		}
Thanks for willing to help, but that code doesn't really help, as i only need move to mob fix or code that would work :/
Lungi is offline  
Old 08/29/2013, 21:38   #9
 
elite*gold: 0
Join Date: Oct 2010
Posts: 158
Received Thanks: 73
Code:
void ****(int X, int Y)
{
for(int i=0;i<500;i++)
{
  int FarX=X - Player[0].X;
  int FarY=Y - Player[0].Y;
  float Range = (FarX*FarX)+(FarY*FarY);
  if(sqrt(Range) > 65)
  {
     unsigned char TempX =    (( difx ) / sqrt( Range ))  * 32; 
     unsigned char TempY =   (( dify ) / sqrt( Range ) )  * 32; 
     SendKoemV2(0x14,"bbb",tempx,tempy,0);
	 if (TempX < 128)
{
Player[0].X+=TempX;
}
else
{
if (TempX > 128)
{
minus2=TempX - 256;
Player[0].X+=minus2;
}
}
if (TempY < 128)
{
Player[0].Y+=TempY;
}
else
{
if (TempY > 128)
{
minus2=TempY - 256;
Player[0].Y+=minus2;
}
} 
  }
}
}


mohm195 is offline  
Thanks
1 User
Reply



« how i can unlock hanin items | XiuOnline Reloaded »

Similar Threads
[GAMESCOM-SHOP] Vindictus Code, FireFall BETA Code, McGame.com Code, Victory Ukash
10/18/2012 - elite*gold Trading - 8 Replies
Hallo Leute hab ein paar Sachen auf der Gamescom gesammelt und übrig, diese möchte ich hier verkaufen. Ich akzeptiere nur Paypal, E*gold und Paysafecards! Hier ist eine Liste mit Bildern (natürlich sind die Codes zensiert :D): 1. Firefall Beta KEY Ihr macht den Preis! Bild 2. Vindictus Code 50 e*gold Bild
used king Rammus code OR katarina kitty cat code (KR) → used PAX sivir code (NA / EU)
08/21/2012 - League of Legends Trading - 1 Replies
your "already used in the NA / EU servers is Pax Sivir Code" Do you have? Want to exchange "Pax Sivir Code" I "king Rammus code OR Katarina kitty cat code" will provide I use this code in the NA / EU servers did not. just. South Korea on a server, you should not use Pax Sivir Code. If you are interested in this deal, contact me. e-mail: [email protected]
used king Rammus code OR katarina kitty cat code (KR) → used PAX sivir code (NA / EU)
08/20/2012 - League of Legends Trading - 0 Replies
Hello Korea is my server users. I NA / EU servers have already been used in the "Pax Sivir Code" wants As a reward, "king Rammus code OR Katarina kitty cat code" I will send you to gift. Have already used the code, Feel free to do the exchange! Please send mail [email protected]



All times are GMT +1. The time now is 23:50.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Abuse
Copyright ©2018 elitepvpers All Rights Reserved.