Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > 12Sky2
You last visited: Today at 09:11

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

Advertisement



[Help] Coding Autowalk/Need good C++ Coder

Discussion on [Help] Coding Autowalk/Need good C++ Coder within the 12Sky2 forum part of the MMORPGs category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jul 2010
Posts: 623
Received Thanks: 175
[Help] Coding Autowalk/Need good C++ Coder

Ok hello,

I have found a way to make an auto-walk function using the World Character coordinates. I found the GoTo Coords that get set everytime you click a new spot to walk to, and I found the function that actually makes the character walk. So now I can manually set the coords that I want to walk to, and then make the character walk.

Now I am trying to figure a way to "record" a set of waypoints into an Array or Vector. Such as turn a Bool on called "Record", when the Record Bool is on it will record a new WP into the Array/Vector every time I left click until I turn the Record Bool off. So if I walk to 5 places while the Record bool is turned off, have it say each of the 5 waypoints into the Array.

I am just not sure how to save each new waypoint into the array, so that it adds each new one in.
iktov2 is offline  
Old 05/03/2012, 12:23   #2
 
elite*gold: 0
Join Date: Dec 2009
Posts: 235
Received Thanks: 68
Define: (kinda obvious, but meh)
Code:
std::vector<TS2VECTOR> v_Waypoints;
This is what you wanted:
Code:
v_Waypoints.push_back( NEWWAYPOINT );
To clear the vector:
Code:
v_Waypoints.clear( );
Use a certain waypoint FROM the vector:
Code:
v_Waypoints[i]
i being the #th waypoint minus 1 (1 = 0, 2 = 1, etc. (array alike))

I never use arrays, so I don't know how it works for arrays.

this page is very useful :

You'll also have to hook the walking function, which shouldn't be hard.
Mr_Troy22 is offline  
Old 05/07/2012, 07:27   #3
 
elite*gold: 0
Join Date: Jul 2010
Posts: 623
Received Thanks: 175
Ok nevermind I think I got it working. I found an example on the site you posted showing something like this:

Code:
struct Coordinate
{
    double x, y;

    Coordiate(double paramx, double paramy) : x(paramx), y(paramy) {}
};

std::vector<Coordinate> coords;

Went ahead and set it up like this:

Code:
struct Coordinate
{
    float x, y;
	Coordinate(float paramx, float paramy) : x(paramx), y(paramy) {}
};
vector<Coordinate> coords;

if(record)
	  {
		  if(GetAsyncKeyState(VK_LBUTTON) &1)
		  {
		       coords.push_back(Coordinate(Player->GoX, Player->GoY));
		  }
	  }
for(int i = 0; i < coords.size(); i++)
		  {
			  Player->GoX = coords[i].x;
			  Player->GoY = coords[i].y;
		  }
Seems to work ok so far, but I only tested it quickly with a keybind.
iktov2 is offline  
Old 05/07/2012, 19:46   #4
 
elite*gold: 0
Join Date: Dec 2009
Posts: 235
Received Thanks: 68
Quote:
Originally Posted by iktov2 View Post
Ok nevermind I think I got it working. I found an example on the site you posted showing something like this:

Code:
struct Coordinate
{
    double x, y;

    Coordiate(double paramx, double paramy) : x(paramx), y(paramy) {}
};

std::vector<Coordinate> coords;

Went ahead and set it up like this:

Code:
struct Coordinate
{
    float x, y;
	Coordinate(float paramx, float paramy) : x(paramx), y(paramy) {}
};
vector<Coordinate> coords;

if(record)
	  {
		  if(GetAsyncKeyState(VK_LBUTTON) &1)
		  {
		       coords.push_back(Coordinate(Player->GoX, Player->GoY));
		  }
	  }
for(int i = 0; i < coords.size(); i++)
		  {
			  Player->GoX = coords[i].x;
			  Player->GoY = coords[i].y;
		  }
Seems to work ok so far, but I only tested it quickly with a keybind.
Does that walking function work with screen coordinates?
Mr_Troy22 is offline  
Old 05/07/2012, 21:12   #5
 
elite*gold: 0
Join Date: Jul 2010
Posts: 623
Received Thanks: 175
No 3d world coords.

If you look at the player struct(11E1B18) +B3(xcoord), there are 6 coord addresses. X,Z,Y, and then Goto X,Z,Y. The GoTo Coords get filled when you click on the ground somewhere with the coordinates that your character is currently walking to. So if you overwrite those Coordiantes manually and then trigger the walk function somehow, your character will automatically walk to the coords that are held in the GoTo addresses.

So basically you can just overwrite those addresses with any coords you want to walk to and then click somewhere on the ground and it will walk to the coords that you set instead of where you clicked.

Having troubles setting up my walk function to work the way I want it to. I wonder if you have any idea how to make it work efficiently.

The below code will just constantly reset the GoTo coords before the character has a chance to walk to the last ones. I need to make it only call the Player->Gox = coords[x].x one time, wait until the character has reached its destination, run my mob check+attack, then go back and set the next coord in the vector.
Code:
for(int x = 0; x < coords.size(); x++)
{	  	
	Player->GoX = coords[x].x;
        Player->GoY = coords[x].y;
	Walk();
	Sleep(250);
}

I have tried something like this:

Code:
for(int x = 0; x < coords.size(); x++)
{	
      if(Player->Action = Standing && moncount < 2)
      {  	
	Player->GoX = coords[x].x;
        Player->GoY = coords[x].y;
	Walk();
	Sleep(250);
       }
      else if(moncount >= 2)
       {
           attack();
       }
}
}
So the above is supposed to check weather the player is standing still(not already walking) and if there is less than 2 mobs in attack range. If both of those conditions are true, then set the next waypoint to walk to. This way once it sets the next coordinate the character will now be walking and it won't set a new coordinate until the player is standing still again(reached the current waypoint). It works however, for some strange reason when I use this method, it will only use the last 2 waypoints in the vector.

There must be some more efficient way to make it check if the character reached its current destination before setting a new one. Any thoughts?
iktov2 is offline  
Old 05/08/2012, 14:22   #6
 
Wazapoo's Avatar
 
elite*gold: 0
Join Date: Jan 2010
Posts: 236
Received Thanks: 286
You could check the distance between you and the point where you are walking to like this:

Code:
for(int x = 0; x < coords.size(); x++)
{    
      float difX = Player->X - Player->GoX;
      float difY = Player->Y - Player->GoY;
      //no need to check vertically so no Z
      float dist = sqrtf(difX * difX + difY * difY);
      if(dist <= CLOSE_ENOUGH_DISTANCE && moncount < 2)
      {  	
	Player->GoX = coords[x].x;
        Player->GoY = coords[x].y;
	Walk();
	Sleep(250);
       }
      else if(moncount >= 2)
       {
           attack();
       }
}
}
Like this the char doesnt have to stop always before walking to the next target spot so it walks much smoother.
Wazapoo is offline  
Old 05/08/2012, 18:18   #7
 
elite*gold: 0
Join Date: Jul 2010
Posts: 623
Received Thanks: 175
Aha, yea I tried that one already.

For some strange reason it when I do that it decides to ignore the all waypoints stored in my vector other than the First and Last(or the last 2, or the first and 3rd?)I dont know, its weird..

So if I save 8 waypoints in my vector for it to walk to, it will only walk between the last 2 stored in the vector. I am completely stumped as to why.

Code:
         float wpx, wpy;
                  for(int x = 0; x < coords.size(); x++)
                  {    
                      wpx = Player->X - Player->GoX; //Player coord & coord being moved to
                      wpy = Player->Y - Player->GoY;
                     
                      float dist = sqrt((wpx * wpx) + (wpy * wpy));

                      if(dist <= 1)
                      {
                          Player->GoX = coords[x].x;
                          Player->GoY = coords[x].y;
                          Walk(); 
                      } 
                  }
iktov2 is offline  
Old 05/09/2012, 15:41   #8
 
Wazapoo's Avatar
 
elite*gold: 0
Join Date: Jan 2010
Posts: 236
Received Thanks: 286
I dont really see the logic inside the for loop, it counts the x from 0 to the last stored point, thats okay, but inside the loop it checks the distance between you and the point. If its smaller or equal to 1 it will walk to the next point, but if the distance was larger than 1, it will still increment x by 1 and that way skipping 1 point totally.

Code:
float wpx, wpy, dist;
for(int x = 0; x < coords.size(); x++)
{       
    do
    {
        wpx = Player->X - Player->GoX;
        wpy = Player->Y - Player->GoY;
                     
        dist = sqrt((wpx * wpx) + (wpy * wpy));

        Sleep(25);
    } while(dist > 1.0f); //so long that the dist is larger than 1 it sleeps 25ms and checks then again

    Player->GoX = coords[x].x;
    Player->GoY = coords[x].y;
    Walk(); 
}
Wazapoo is offline  
Old 05/12/2012, 09:16   #9
 
elite*gold: 0
Join Date: Apr 2011
Posts: 244
Received Thanks: 63
nice codes...
I made on my program like this. already my bot using this and make money in cave.
1. set Source X and Y
2. Set target X and Y
3. Command walk to target XY

this is enough...
ts2dropper is offline  
Reply


Similar Threads Similar Threads
Cabal Rider ab PF kein Autowalk mehr?
06/06/2011 - Cabal Online - 1 Replies
Habt ihr auch das Problem, dass der Bot ab Pontus ferrum nicht emhr in der lage ist alleien über die Karte zu laufen? Wenn ich einen Doppelklick auf die Minimap mache, erscheitn kein Kreuz und er läuft nicht los, auch wenn der Bot zwischendurch mal stirbt, kann er nicht alleine zurück zum Botplatz laufen. Auf den niedrigen Maps kann er das, aber in PF nicht mehr. Ist das bei euch auch ein Problem?
New Hack New Coding New Hackser C*++Coder 5.1
12/19/2010 - WarRock Hacks, Bots, Cheats & Exploits - 9 Replies
Hallo, ich möchte gerne wissen wie man einen futza anzündet und was passieren kan beim anzünden also ich bin sehr beharrt könnten meine arschhaare darunter leiden? und wenn ich richtig doll futze ob die wohnung in brannt gesezt werden kann danke für alle antworten im vorraus blacklegend packt viruse in seine hacks hat mir der spezialist real-life gesagt der beste coder auf dem planeten mars
[Help] from coder i coding some thing but dosn't work
06/04/2009 - CO2 Private Server - 0 Replies
i code GuildController but dosn't work what elese i can do to let it work here the code :-
Good C# Coder Needed, Very Good Indeed
12/09/2008 - CO2 Programming - 1 Replies
Hey, Like the title says, I need a very good C# coder, I will get the version they have if needed. Other then that, I need someone to teach me to code. I used to try but have failed so i am wondering if anyone is willing to add me on msn sometime and just teach me when ever we both have time. If You Will, Just PM me and i will give u my email address, as this is a friends acc and not my email assigned. As you can see. I am not a leecher. Just wanting to learn to code. I have tried to...



All times are GMT +1. The time now is 09:11.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.