hunter.mac simple hunt macro with loot capability.

A forum for you to dump all the macros you create, allowing users to use, modify, and comment on your work.

Moderator: MacroQuest Developers

gn0m3
a lesser mummy
a lesser mummy
Posts: 39
Joined: Sat Dec 13, 2003 10:43 am

Post by gn0m3 » Tue Jan 06, 2004 10:23 am

> Im farming silks in EK..it targets a spider across the zone..I run over to
> spider and someone is killing it..the macro starts attacking the spider
> anyway..

Add the following code...

In GetTarget, when setting "HasTarget":

Code: Select all

/varset CurTarID $target(id)
Then, in MoveToMob or FastMove (I forget which):

Code: Select all

/if n $target(distance)<100 {
    /press ESC
    /target  nopcnear @NoKSRange id @CurTarID
    /if n $target(id)==0 {
            /call ResetSub
            /return
    }
}
This will basically repeatedly try to retarget the mob, specifying that there be no PC near it.

> 2) how the heck do you stop this macro when you target something
> across the zone and it starts running..the keyboard doesnt work..so I
> cant tyep /end..or even hit a /end hotkey.

Yeah, this is a problem. You can add delays in the code which wouldn't affect things much, except that the hunter wouldn't make a beeline to the target. What I tend to do right now is target my pet (wth my mouse) and get into attack range, at which point I have keyboard control again.

KhaosWolf
a lesser mummy
a lesser mummy
Posts: 41
Joined: Wed Sep 10, 2003 11:34 pm

Same problem

Post by KhaosWolf » Tue Jan 06, 2004 3:07 pm

I have the same problem.
The only fix I found :
Make a hotkey doing /endmacro, and when you run your macro be sure to have mouse control, so you can click on the end button you made to end your current mac. Only thing i figured out that works :(

User avatar
Bad Karma
a snow griffon
a snow griffon
Posts: 346
Joined: Sat Nov 22, 2003 9:34 pm
Contact:

Post by Bad Karma » Tue Jan 06, 2004 7:49 pm

This issue (both, actually) has been repeatidly discussed, and suggestions for solutions have been repeatidly given.

KS: Look for stuff about checking to see if a mob has a target, or HP are lower than a certain %.

Keyboard Locked: What is the mac using for movement? How could that lock up your keyboard? What other keys facilitate movement? Can you autorun and still type/steer/etc. without MQ running? How?

If THAT doesn't ring any bells, then...well...I don't know what to say.
[b]- Bad Karma
________________________________________[/b]

In our own quest for excellence, we should strive to take the time to help those who help themselves.

All others should [b]RTFM[/b]!!!!!!!!!

do_know_a_little
RTFM, then ask again
Posts: 19
Joined: Thu Jun 26, 2003 1:26 pm

Post by do_know_a_little » Fri Jan 16, 2004 2:17 am

How would one change it to follow the mob more closely when its walking seems like sometimes it follows large spiders out of attack range and follows them for minutes! Also I notice my system performance slowly degrades while running this mac. Ending in a choppy mess further exacerbating the following issue. Is it just the current make of mq or?
Great macro here !
I love you guys.

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

Post by MrSmallie » Fri Jan 16, 2004 11:43 am

do_know_a_little wrote:How would one change it to follow the mob more closely..."
I don't have that problem...but you could change these 3 lines...
/varset RangeMax 12
/varset RangeMin 10
/varset FastRange 14

I would decrease each value by 2 and see how that works.

[quote=" ! Also I notice my system performance slowly degrades while running this mac. [/quote]
If you end the macro and restart it, does the perfomance get better?
Me
[img]http://home.comcast.net/~mrsmallie/ches.JPG[/img]

Joeur
decaying skeleton
decaying skeleton
Posts: 3
Joined: Mon Jan 05, 2004 1:00 am

Post by Joeur » Sat Jan 17, 2004 10:28 am

I'm not sure how to write this part yet, but I had a couple of ideas for improvements.

Instead of doign a random search of the array, why not to a /for to search in priority? That way you could (say for example EK for spiders) set the first one to spiders, and if you get a target, it moves on. if no spiders, then currently this would loop ad infinium. with a For statement I think, it could be set to search for each entry until it gets a target and then proceed to hunt that one? Currently if you run out of mobs this will continueto lag the system I think. I have put a delay in, however this only works if the mob array is only 1 mob deep. Since it'll be delaying anytime it finds a specific mob type not up.

I also do my farming as a ranger, here are lines I addedto the macro to do self heals and keep buffs up. Add the following lines to the appropriate places in the file.

Code: Select all

#event SkinBuffs "Your skin returns to normal"
#event Ring "The blessing Leaves"
#event SoE "The avian spirit departs"
#event haste "your speed returns to normal"

Code: Select all

 /declare NeedBuff global
   /varset NeedBuff FALSE

Code: Select all

  :Start 
   /call GetTarget 
  [b] /doevents
   /if @NeedBuff=="TRUE" /call BuffMe[/b]
   /if @HasTarget=="1" /call MoveToMob 
   /if @HasTarget=="1" /call CombatSub 
   /if @HasTarget=="1" /call MoveToMob 
   /if @HasTarget=="1" /call LootMob 
[b]   /if $char(hp,cur)<=3500 /call HealMe[/b]
     /call ResetSub 
   /goto :Start 

Code: Select all

Sub Event_SkinBuffs
	/varset NeedBuff TRUE
/return

Sub Event_SoE
	/press f1 
                /delay 1s
                /cast 4
                /delay 
/return

Sub Event_Ring
	/press 4
/return

Sub BuffMe
	/if $char(ismoving)==TRUE /press up
                /press 4
	/delay 5	
	/cast 1
	/delay 75
	/cast 6
	/delay 50
	/cast 2
	/delay 75
	/varset NeedBuff FALSE
/return

Code: Select all

Sub HealMe
   /press F1
:healme
   /if n $char(hp,cur)<=4500  {
	/cast 3
	/delay 6s
	/goto :healme 
	}
/return
Currently I can't get the buffs wearing off events to work, I'm not sure why.
Obviously you'll need to edit the buff & events to your particular spell gems, delays, etc. Feedback welcome & hope this helps others.

gn0m3
a lesser mummy
a lesser mummy
Posts: 39
Joined: Sat Dec 13, 2003 10:43 am

Post by gn0m3 » Sun Jan 18, 2004 5:00 pm

Joeur,

I never even thought about the buff wearing off event. I just have a "CheckBuffs" subroutine that I call whenever I want my buffs checked.

$char(buff, x) checks for a buff (and returns a non-negative buff slot if it exists, -1 if it doesn't ).

User avatar
Bad Karma
a snow griffon
a snow griffon
Posts: 346
Joined: Sat Nov 22, 2003 9:34 pm
Contact:

Post by Bad Karma » Sun Jan 18, 2004 9:00 pm

Code: Select all

/if $char(hp,cur)<=3500 /call HealMe
Why not use a % check in stead?

Code: Select all

/if n $char(hp,pct)<=70 /call HealMe
(Don't forget the n when doing a numerical compairison!)

and…
Sub HealMe

Code: Select all

/if n $char(hp,cur)<=4500  {
   /cast 3 
Becomes:

Code: Select all

/if n $char(hp,pct)<=90  {
   /cast "Name of Healing Spell"
[b]- Bad Karma
________________________________________[/b]

In our own quest for excellence, we should strive to take the time to help those who help themselves.

All others should [b]RTFM[/b]!!!!!!!!!

Joeur
decaying skeleton
decaying skeleton
Posts: 3
Joined: Mon Jan 05, 2004 1:00 am

Post by Joeur » Mon Jan 19, 2004 4:26 pm

thanks for the input, I'm still new at working on these, so I'm not seeing all the best options yet.

When I first thought of checking for buffs, and checked the options, it looked like it could only check specific buff slots by number. now I see that I can do the specific spells.

Hadn't realized I could put the spell name and check that. Thanks!

Still trying to think out how to prioritize the list of mobs with a /for loop. Any ideas?

gn0m3
a lesser mummy
a lesser mummy
Posts: 39
Joined: Sat Dec 13, 2003 10:43 am

...

Post by gn0m3 » Tue Jan 20, 2004 9:42 pm

I don't quite understand what the for loop is supposed to do.

How do you want prioritization to work?

Let's say you have mobs of type X,Y,Z, in priority order. Do you want it to find X if ANY exist in zone, then Y if any exist, then Z?

The issue there is that if there is that if X exists zonewide, as you thin it out, you're going to be running all over the place to find the remaining Xs, while there are plenty of Ys and Zs around.

Maybe you want distance used in the prioritization with weights given to distance? I.e. attack X first if it's within this much, but for every foot farther it is, deprioritize it by a certain # of points...

Anyway, I didn't really see what the point of a for loop is. If all you want to do is my first example of how prioritization could work, then you'd do:

Code: Select all

/target <whatever parameters you want, like nopcnear, etc> @MobOfPriority1
/if n $target(id)>0 /goto :acquired

/target @MobOfPriority2
/if n $target(id)>0 /goto :acquired
.
.
.
:acquired
<do stuff>
No need for a for loop. In fact, I may be wrong, but I think there might be code for a prioritization of this type posted somewhere in this thread.

User avatar
Undies
a ghoul
a ghoul
Posts: 94
Joined: Mon Oct 20, 2003 9:12 pm

Post by Undies » Fri Jan 23, 2004 3:00 am

This addition prevents running behind a mob trying to hit it, but not quite able to... instead it checks whether you are on the same heading as mob and runs forward and hits it from the front instead... you might need to play with FastRange, RangeMax and RangeMin to get it to work. I have changed my whole hunter routine extensively so this is not tested in this code but the relevant bits are colored. If you are clever you can probably do the heading calculations in one line rather than two as well...

Code: Select all

Sub MoveToMob 
   /face fast 
   /if n $target(distance)>=@FastRange /call Fastmove 
   [color=cyan]/if n @TargetDead==0 {
      /if n $calc($abs($char(heading)-$target(heading)))<10 /goto :parallel_paths
      /if n $calc($abs($calc($char(heading)-$target(heading)-360)))<10 /goto :parallel_paths
      }
   /goto :not_parallel
   :parallel_paths
        /sendkey down up
        /delay 2s
        /sendkey up up
        /return
   :not_parallel    [/color]

   /if n $target(distance)>@RangeMax { 
      /press up 
   } 
   /if n $target(distance)<@RangeMin { 
      /press down 
   } 
/return 

gn0m3
a lesser mummy
a lesser mummy
Posts: 39
Joined: Sat Dec 13, 2003 10:43 am

...

Post by gn0m3 » Fri Jan 23, 2004 5:56 pm

I just root everything =).

JimJohnson
a grimling bloodguard
a grimling bloodguard
Posts: 1299
Joined: Sat Oct 11, 2003 6:00 am

Post by JimJohnson » Sat Jan 31, 2004 8:38 am

How much work would be needed to add the new movement code by ml2517 ?

draco
a ghoul
a ghoul
Posts: 145
Joined: Thu Jan 29, 2004 7:06 pm
Contact:

OK, keyinput during the mac

Post by draco » Sun Feb 01, 2004 11:42 pm

/doevents in several places fixed this.


I put it here in fastmovetomob

Code: Select all

    /doevents
   /goto :fastmoveloop 
I changed GetTarget to this

Code: Select all

sub GetTarget 
   /declare noTargCount local
   /declare MobID local 
   /declare SRadius local 
   /declare primaryLen local

   /echo "GetTarget "
   
   :RestartGetTarget
   
   /for SRadius 0 to @HuntRadius step 100
   :CheckPrimary
    	/target nopcnear @KSRadius npc radius @SRadius "@PrimaryArray(2,$rand(@PrimaryArraySize))"
 	/if n $target(id)!=0 /goto :TargetAquired
   :Aquire 
   /target nopcnear @KSRadius npc radius @SRadius "@MainArray(2,$rand(@MobArraySize))"
   
   
   |/varadd noTargCount 1
   /if n $target(id)!=0 /goto :TargetAquired
   /if $target()=="True" /goto :TargetAquired
   /doevents
   /next SRadius
   /call MoveToAnchor
   /goto RestartGetTarget
   
   :TargetAquired
   
   /varset MyTarget $target(id)
   /varset TargetDead 0 
   /varset HasTarget 1 
   /varset MobToHunt $target(name) 
/return 
This does two things new one it searches close then far I stole this loop from another macro but it works great. Secondly I added a priority target array. This allows me to add place holders into the regular mod array but, the Macro first checks to see if any priority Mobs are there.

Next thing I am going to do is switch the targeting to use the $searchspawn

and the following sub that tracks via the id return rather than targetting from accros the zone.

BTW, my changes have been running for 4 hours now.

Code: Select all

Sub MoveToSpawn
	  | /mqlog "move to spawn"
	   /face fast 
	   /if n $spawn(@MyTarget,distance)>=@FastRange /call FastMoveToSpawn
	   /if n $target(@MyTarget,distance)>@RangeMax { 
	      /press up 
	   } 
	   /if n $target(distance)<@RangeMin { 
	      /press down 
	   } 
/return 

Sub FastMoveToSpawn
	
   /mqlog "Fast move to spawn"
   /varset MyXLOC $char(x) 
   /varset MyYLOC $char(y) 
   /varset ObstCount 0 
   :fastmoveloop 
   /if $target()=="FALSE" { 
      /sendkey up up 
      /if $combat=="TRUE" { 
         /attack off 
         /return 
      } 
   } 
   /face fast 
   /if n $spawn(@MyTarget,distance)>@FastRange { 
      /sendkey down up 
   } 
   /if n $spawn(@MyTarget,distance)<=@FastRange { 
      /sendkey up up 
      /target nopcnear @KSRadius npc id @MyTarget 
      /return 
   } 
   /varadd ObstCount 1 
   /if n @ObstCount>=3 { 
      /call CheckObst 
   } 
   /doevents
   |Anti KS code
   /if n $target(distance)<100 { 
       /press ESC 
       /target  nopcnear @NoKSRange id @CurTarID 
       /if n $target(id)==0 { 
               /call ResetSub 
               /return 
       } 
   } 
   /goto :fastmoveloop 
/return 
I saw some anti-KS code but targetting when in range with the nopcnear flag should do that. Though, I still need to check for failure and reset. before this routine will work.

Frankiebone
orc pawn
orc pawn
Posts: 12
Joined: Sat Nov 22, 2003 10:44 pm
Location: Daytona Beach, Fl
Contact:

Post by Frankiebone » Mon Feb 02, 2004 10:18 am

Could anyone help me get a bard chantkite macro combined with hunter.mac? I'm trying to get it working basically like the chantkite macro, but as far as targeting mobs i'd like to use the hunter.mac. Is there any way to just sort of combine them? Thanks!
-Frankie (bone)