TargetlessFollow.mac

Post your completed (working) macros here. Only for macros using MQ2Data syntax!

Moderator: MacroQuest Developers

Dregs
orc pawn
orc pawn
Posts: 20
Joined: Tue Dec 29, 2009 9:57 am

TargetlessFollow.mac

Post by Dregs » Wed Jan 13, 2010 11:01 pm

Here is a macro I made actually a while back, but it turned into a mage macro I'm working on, and I forgot to save the original. So, here is what I remade from that code.

This is a follow macro, but it doesn't require you to have the person you are following targeted. I didn't put in any condition for stopping this macro, other than if the toon you should be following is not in the zone (they zoned, died, etc.) so, if you want to stop the macro, do it the good old fashioned way with /endm

I thought of making it into a snippet, and I may still do something to that effect later, but I thought it was a decent macro for now, as is, as a very simple follow macro. In theory, you could have it running and still cast on stuff, attack, and whatnot... although it wouldn't work incredibly well that way because it will just take off running if the character is out of range. Anyway, without further ado,

Code: Select all

|Written by Dregs
|------------------------------------------------------------------------------------------------------
|Usage:
|/macro TargetlessFollow Fearlessleader
| this will follow the toon named Fearlessleader at the default distance of 40
|
|/macro TargetlessFollow Fearlessleader 20
| this will follow the toon named Fearlessleader at a distance of 20
|-------------------------------------------------------------------------------------------------------

Sub Main
   /declare FollowWho string outer ${Param0}
   /if (!${Defined[Param0]}) {
      /echo You must give the name of the person to follow
      /endm
   }
   /if (${Defined[Param0]} && !${Spawn[PC ${Param0}].ID}) {
      /echo There seems to be no character in the zone matching the name you supplied.
      /endm
   }
   /declare FollowDistance int outer ${Param1}
   /if (!${Defined[Param1]}) {
      /varset FollowDistance 40
   }
   /echo Following ${FollowWho} at a distance of ${FollowDistance}
   /squelch /face ${FollowWho}
   /delay 5
   :MainLoop
   /if (!${Spawn[PC ${FollowWho}].ID}) {
      /if (${Me.Moving}) /keypress forward
      /endm
   }
   /squelch /face ${FollowWho}
   :Follow
   /if (${Math.Distance[${Me.Y},${Me.X}:${Spawn[PC ${FollowWho}].Y},${Spawn[PC ${FollowWho}].X}]}>${FollowDistance}) {
      /squelch /face fast ${FollowWho}
      /keypress forward hold
      /goto :Follow
   }
   /keypress forward
   /goto :MainLoop
/return