Help Needed in Trigonometry ...

Need help with a macro you are writing? Ask here!

Moderator: MacroQuest Developers

s0rcier
a grimling bloodguard
a grimling bloodguard
Posts: 876
Joined: Mon Aug 02, 2004 10:49 pm

Help Needed in Trigonometry ...

Post by s0rcier » Thu Feb 10, 2005 1:18 am

Well codes below is raped from mq2move utils circle command, it's work great while your circling clockwise foward, good for bard kiting, but for my zerker i want to be able to circle backward, facing mobs all the time going anti-clockwise around the circle, and well this functions doesnt do the jobs ... work partially for a while ...

Code: Select all

   double heading; 
   double CircleRadius = 25.0f;
   double X =PcX-CircleX; 
   double Y =PcY-CircleY; 
   double distance=sqrt(X*X + Y*Y); 
   if (distance>(CircleRadius*(2.0/3.0))) { 
      heading=atan2(PcY - CircleY, CircleX - PcX) * 180.0f / PI + 90.0f; 
      heading += 90.0f * (CircleRadius/distance); 
      heading *= 512.0f/360.0f; 
      if( heading >= 512.0f ) heading -= 512.0f; 
      if( heading < 0.0f ) heading += 512.0f; 
   } 
dont know if someone could help or have some solutions, i presume that this circle routine heading was not design at all for what i need at all ... i really wish if someone could help on this finding problems and giving a solutions ... or could at least better explains the problems ... if you want to simulate problems fast use mq2moveutils, /circle on 25 and press down the back keys .... you will find what i means ..

s0rCieR

JJ
a hill giant
a hill giant
Posts: 227
Joined: Thu Nov 11, 2004 5:50 am

Original code?

Post by JJ » Thu Feb 10, 2005 1:37 am

Is that the original code or your modified code?

s0rcier
a grimling bloodguard
a grimling bloodguard
Posts: 876
Joined: Mon Aug 02, 2004 10:49 pm

Post by s0rcier » Thu Feb 10, 2005 1:49 am

Well modified or mines ... 99% identical to mq2moveutils codes ... if you find flaw in mq2move utils you will find flaw in this one too :P

here is the moveutils code :P

Code: Select all

   double X = pChSpawn->X - CircleX; 
   double Y = pChSpawn->Y - CircleY; 
   distance = sqrt(X*X + Y*Y); 

   if (distance>(CircleRadius*(2.0/3.0))) { 
      heading=atan2(pChSpawn->Y - CircleY, CircleX - pChSpawn->X) * 180.0f / PI + 90.0f; 
      heading += 90.0f * (CircleRadius/distance); 
      heading *= 512.0f/360.0f; 
      if( heading >= 512.0f ) heading -= 512.0f; 
      if( heading < 0.0f ) heading += 512.0f; 
      if( bDrunken ) { 
         gFaceAngle = (float)heading; 
      } else { 
         pChSpawn->Heading = (float)heading; 
      } 
   } 
Like i said this works nice if you try to circle clockwise with foward key press ... but dont break when pressing down the back key (and moving backward istead) ...

InDShadows
decaying skeleton
decaying skeleton
Posts: 7
Joined: Sat Jan 29, 2005 12:43 pm

Post by InDShadows » Thu Feb 10, 2005 4:18 pm

If you are looking to basically kite behind a mob meleing then trying to get your timers rights between the two comps will be a huge pain, may i suggest that you just modify follow.mac to suit your needs, distance paramateres is pretty obvious. Its a very simple loop, so adding /doabilities and /attack on is extreemely simple.

User avatar
dont_know_at_all
Developer
Developer
Posts: 5450
Joined: Sun Dec 01, 2002 4:15 am
Location: Florida, USA
Contact:

Post by dont_know_at_all » Thu Feb 10, 2005 5:33 pm

I'm not sure what you are asking. You can't face the mob, run backwards, and circle at the same time.

User avatar
Night Hawk
a grimling bloodguard
a grimling bloodguard
Posts: 590
Joined: Fri Aug 13, 2004 4:56 pm

Post by Night Hawk » Fri Feb 11, 2005 12:54 am

Well if your running backwards, in a circle motion, your kind of already facing the mob.... right?

"Anti-clockwise" that made me laugh ;)

User avatar
dont_know_at_all
Developer
Developer
Posts: 5450
Joined: Sun Dec 01, 2002 4:15 am
Location: Florida, USA
Contact:

Post by dont_know_at_all » Fri Feb 11, 2005 3:33 am

"kind of" is not really very trigonometrical.

User avatar
TheUnholy
a hill giant
a hill giant
Posts: 269
Joined: Wed Mar 03, 2004 11:59 pm

Post by TheUnholy » Fri Feb 11, 2005 6:27 am

Can you say "Anti-clockwise" and "Trigonometry" in the same post? I think that defies certain laws.

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Fri Feb 11, 2005 6:51 am

Only if you apply the Cowbell to it properly. :P
Fuck writing MQ2 macros. Go with IS scripts; IS Rules!

s0rcier
a grimling bloodguard
a grimling bloodguard
Posts: 876
Joined: Mon Aug 02, 2004 10:49 pm

Post by s0rcier » Sat Feb 12, 2005 1:51 am

Well just try with mq2move utils, start a 50 radius circle and hold down the foward key ... you will circle foward ... stop and hit down the back key and you will see that you actually circling for a while but at a point it break up ... pretty sure it's just something easy ... just that i can't point it out atm ...

Well thx for your cooperation, and sorry i didnt spill it right correctly ;P

s0rCieR

User avatar
dont_know_at_all
Developer
Developer
Posts: 5450
Joined: Sun Dec 01, 2002 4:15 am
Location: Florida, USA
Contact:

Post by dont_know_at_all » Sat Feb 12, 2005 4:00 am

change

Code: Select all

 heading += 90.0f * (CircleRadius/distance);
to

Code: Select all

 heading += 90.0f * (distance/CircleRadius);

s0rcier
a grimling bloodguard
a grimling bloodguard
Posts: 876
Joined: Mon Aug 02, 2004 10:49 pm

Post by s0rcier » Tue Feb 15, 2005 3:28 am

Well i give up :P will just hard code my circle at my prefered kyte spot :P rofl ... thx guys

s0rCieR

MrSmallie
a hill giant
a hill giant
Posts: 167
Joined: Fri Oct 11, 2002 11:18 am

Post by MrSmallie » Tue Feb 15, 2005 1:14 pm

If you're trying to circle kite a mob to throw ranged attacks at him...good luck...whether clockwise, or counter, forward or back.

If you're going to hardcode something for your prefered location, I suggest a double parallelogram pattern if yuo're the one with agro. If you don't have agro, just use the follow.mac.
Me
[img]http://home.comcast.net/~mrsmallie/ches.JPG[/img]

xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: Help Needed in Trigonometry ...

Post by xyilla » Wed Apr 09, 2025 11:35 am


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: Help Needed in Trigonometry ...

Post by xyilla » Wed Apr 09, 2025 11:37 am