behind

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

Moderator: MacroQuest Developers

honduras
orc pawn
orc pawn
Posts: 14
Joined: Sat Aug 30, 2003 5:22 pm

behind

Post by honduras » Mon Sep 27, 2004 9:00 pm

Hi,
I know it is done before but what is the simplest code to , i tried my best to extract from current macro but cant seem to do it right.
1) run towards the target's back
2) stay behind the target's back

Thank you very much for your help in advance

SlimFastForYou
a hill giant
a hill giant
Posts: 174
Joined: Sat Jan 24, 2004 1:38 am

Post by SlimFastForYou » Mon Sep 27, 2004 9:12 pm

I do not remember how much I wrote and how much I ripped off from one macro or another :-). This is simply one of the things in the automatic beastlord macro I compiled for myself once upon a time.

Code: Select all

Sub Check_Behind 
	/declare strafedir string local
	/declare behindIt FALSE 
	/declare dir int local
	/declare delta int local
	|- Are we behind our target? 
	/declare i int local
	/if (${Target.Type.Compare["NPC"]}) {
		/echo Target (${Target.Name}) is NOT an NPC... abort!
		 /return
	}
	/for i -1 to 1 
		/if (${Target.Type.Compare["NPC"]}) /return
		/varcalc dir (${Target.Heading.Clock}+${i})%12 
		/if (${dir}<1) /varcalc dir ${dir}+12 
		/if (${dir}>12) /varcalc dir ${dir}-12 
		/if (${dir} == ${Me.Heading.Clock}) /varset behindIt TRUE 
	/next i 
	/if (!${behindIt}) { 
			|- Which way do we strafe? 
			/varcalc delta ${Me.Heading.Clock}-${Target.Heading.Clock} 
			/if (${delta}>6) /varcalc delta ${delta}-12 
			/if (${delta}<-6) /varcalc delta ${delta}+12 
			/if (${delta}<0) { 
			/varset strafedir STRAFE_LEFT 
			} else { 
				/varset strafedir STRAFE_RIGHT 
			} 
			/echo Getting Behind: Strafing ${strafedir} a half-second... 
			/keypress ${strafedir} hold 
			/delay 4
			/keypress ${strafedir}
	}
/return
Most likely your macro is going to loop until the target is dead. In that loop, do a /call Check_Behind. There isn't really a simple way to do this that I know, because you have to align your character to be facing a certain direction calculated based on the direction the npc is facing.

bushdaka
a hill giant
a hill giant
Posts: 185
Joined: Wed Jun 16, 2004 11:01 am

Post by bushdaka » Tue Sep 28, 2004 1:20 am

Very nice code. Thanks for extracting and posting it. I've got a need and this will help a lot!

honduras
orc pawn
orc pawn
Posts: 14
Joined: Sat Aug 30, 2003 5:22 pm

Post by honduras » Tue Sep 28, 2004 12:38 pm

thank you , its an excellent program
now anyone know how to face and travel to a loc behind the mob?

A_Druid_00
Macro Maker Extraordinaire
Posts: 2378
Joined: Tue Jul 13, 2004 12:45 pm
Location: Rolling on the Lawn Farting

Post by A_Druid_00 » Tue Sep 28, 2004 12:42 pm

honduras wrote:thank you , its an excellent program
now anyone know how to face and travel to a loc behind the mob?
There's at least 5 macros that do this (among other things), and a plugin too. I'd suggest searching through some of them and see how they do it.
[quote]<DigitalMocking> man, A_Druid_00 really does love those long ass if statements
<dont_know_at_all> i don't use his macro because i'm frightened of it[/quote]
[quote][12:45] <dont_know_at_all> never use a macro when you can really fuck up things with a plugin[/quote]