I have always used MQ2Moveutils for Bard kiting. I decided to try and use it for my Ranger, but found that there was no way to use the /circle command to walk backwards. I did some research on the MQ2 site and there did not seem to be a solution there either. I decided to try and edit the existing plugin to handle a reverse option. Hope this helps someone whe was trying to accomplish the same thing I was. Here is what came up with.
Disclaimer: I am not much of a C++ programmer so please keep flames to a minimum.
I included surrounding code from the MQ2Moveutils.cpp file so you could do this yourself you wanted, or improve on what I hacked together. Accept for 1., all the changes were made to the HandleCircle() fuction so be carefull of just doing a full seach and replace so that you dont mess up /stick or /moveto.
1. I created a variable called circlereverse that I would use to toggle the reverse option.
After compiling I was able to now use the /circle command as follows:
Instead of
/circle on 50
I can replace the on parameter with reverse
/circle reverse 50
This allows my ranger to walk backwards instead of forwards in a circle keeping targets in view for using bow. Combine that with a simple targeting mac and you can now use the /circle command for kiting with your Ranger.
I am sure there needs to be a bit more work done with this to make it better integraded with all the functions of the plugin, but the changes were easy to make and worked pretty well. I included a compile of the plugin with these changes made.
Disclaimer: I am not much of a C++ programmer so please keep flames to a minimum.
I included surrounding code from the MQ2Moveutils.cpp file so you could do this yourself you wanted, or improve on what I hacked together. Accept for 1., all the changes were made to the HandleCircle() fuction so be carefull of just doing a full seach and replace so that you dont mess up /stick or /moveto.
1. I created a variable called circlereverse that I would use to toggle the reverse option.
Rich (BB code):
bool bDebug=false;
bool bCircling=false;
bool bCirclingWasOn=false;
bool bDrunken=false;
float CircleX=0.0f;
float CircleY=0.0f;
float CircleRadius=0.0f;
int circlereverse=0;
SYSTEMTIME stPrevCirc;
2. I replace the following code that identifies switches used in the /circle command so that the plugin would recoginze the reverse option.
Replaced:
} else if( !strncmp(currentArg,"on",3) ) {
GetArg(currentArg,szLine,argn);
if( isdigit(currentArg[0]) ) {
CircleRadius = (float)atof(currentArg);
argn++;
}
if(!bCircling) {
CircleY = pChSpawn->Y + CircleRadius * (float)sin(pChSpawn->Heading * (float)PI / 256.0);
CircleX = pChSpawn->X - CircleRadius * (float)cos(pChSpawn->Heading * (float)PI / 256.0);
}
bCircling=true;
With:
} else if( !strncmp(currentArg,"reverse",8) ) {
circlereverse = 1;
GetArg(currentArg,szLine,argn);
if( isdigit(currentArg[0]) ) {
CircleRadius = (float)atof(currentArg);
argn++;
}
if(!bCircling) {
CircleY = pChSpawn->Y + CircleRadius * (float)sin(pChSpawn->Heading * (float)PI / 256.0);
CircleX = pChSpawn->X - CircleRadius * (float)cos(pChSpawn->Heading * (float)PI / 256.0);
}
bCircling=true;
} else if( !strncmp(currentArg,"on",3) ) {
circlereverse = 0;
GetArg(currentArg,szLine,argn);
if( isdigit(currentArg[0]) ) {
CircleRadius = (float)atof(currentArg);
argn++;
}
if(!bCircling) {
CircleY = pChSpawn->Y + CircleRadius * (float)sin(pChSpawn->Heading * (float)PI / 256.0);
CircleX = pChSpawn->X - CircleRadius * (float)cos(pChSpawn->Heading * (float)PI / 256.0);
}
bCircling=true;
3. Added If statements to correctly calculate the heading changes based on if you are kiting normal or reverse.
Replaced:
newHeading=(float) atan2(pChSpawn->Y - CircleY, CircleX - pChSpawn->X) * 180.0f / (float)PI + 90.0f;
With:
if (circlereverse == 1) {
newHeading=(float) atan2(CircleY -pChSpawn->Y, pChSpawn->X - CircleX) * 180.0f / (float)PI + 90.0f;
} else {
newHeading=(float) atan2(pChSpawn->Y - CircleY, CircleX - pChSpawn->X) * 180.0f / (float)PI + 90.0f;
}
AND
Replaced:
heading=(float) atan2(pChSpawn->Y - CircleY, CircleX - pChSpawn->X) * 180.0f / (float)PI + 90.0f;
With:
if (circlereverse == 1) {
heading=(float) atan2(CircleY -pChSpawn->Y, pChSpawn->X - CircleX) * 180.0f / (float)PI + 90.0f;
} else {
heading=(float) atan2(pChSpawn->Y - CircleY, CircleX - pChSpawn->X) * 180.0f / (float)PI + 90.0f;
}
4. Finally replace the actual command that would move you forward with a if statement to move your forward or in reverse.
Replace:
DoFwd(true);
With:
if (circlereverse == 1)
DoBck(true);
} else {
DoFwd(true);
}
After compiling I was able to now use the /circle command as follows:
Instead of
/circle on 50
I can replace the on parameter with reverse
/circle reverse 50
This allows my ranger to walk backwards instead of forwards in a circle keeping targets in view for using bow. Combine that with a simple targeting mac and you can now use the /circle command for kiting with your Ranger.
I am sure there needs to be a bit more work done with this to make it better integraded with all the functions of the plugin, but the changes were easy to make and worked pretty well. I included a compile of the plugin with these changes made.
Last edited by a moderator:

