Page 1 of 1
behind
Posted: Mon Sep 27, 2004 9:00 pm
by honduras
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
Posted: Mon Sep 27, 2004 9:12 pm
by SlimFastForYou
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.
Posted: Tue Sep 28, 2004 1:20 am
by bushdaka
Very nice code. Thanks for extracting and posting it. I've got a need and this will help a lot!
Posted: Tue Sep 28, 2004 12:38 pm
by honduras
thank you , its an excellent program
now anyone know how to face and travel to a loc behind the mob?
Posted: Tue Sep 28, 2004 12:42 pm
by A_Druid_00
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.