Randomly selecting mobs and moving to them.

Macro depository for macros written before the user variable changes that broke all of them.

Moderator: MacroQuest Developers

User avatar
grimjack
Macro Author
Macro Author
Posts: 525
Joined: Thu Nov 07, 2002 6:51 am
Contact:

Randomly selecting mobs and moving to them.

Post by grimjack » Tue May 20, 2003 11:22 am

This one I created for a reason I can't remember. I can't think of any good uses for it at the moment but maybe someone can find one in one of their scripts. Keep in mind this was writen a LONG time ago. Also as always many parts could have been taken from macroquest2.com macro depot. Thank you to eveyrone who put code out there for people like me to learn the macro language. Also a big thanks to those who supplied information on the forums and the great documentation. Last but definatly not least, thank you to all the macroquest developers for creating and maintaining such a fine product.


I have not used this in a long long time so it may have errors. This is more concept than anything and is not ment for production use without modifications. If anyone has a need for this and can't figure out an error or how to use it let me know in a pm or post here and I'll update it.

Code: Select all

|go to random mob
|Proof of concept.  Pick a mob by name, move to it,
|then pick another one that is not within a random radius.
|useage randomly hunting for mobs.


#define MyXLoc v52 
#define MyYLoc v53 
#define alertradius v59
Sub Main 
   :begining 
   /call Getmob
   /goto :begining   
/return 

Sub Movetomob 
   /varset MyXLoc $char(x) 
   /varset MyYLoc $char(y)  
   :gotopointloop
   /if $target()==FALSE { 
      /sendkey up up
      /return
   } 
      /face fast
      /if n $target(distance)>20 /sendkey down up
      /if n $target(distance)<10 {
         /sendkey up up
         /return
      }
      /face fast
         /call Detectobst 
        /goto :gotopointloop     
   }
   /sendkey up up 
   /face
/varset v54 0 
/return 



Sub Getmob
   :startgetmob
   /alert clear 1
   /varset v59 $rand(220)
   /varadd v59 30
   /alert add 1 radius $v59 large_widow
   /target noalert 1 npc "large widow" 
   /if "$target()"!="TRUE" { 
      /delay 15s 
      /goto :startgetmob 
   } 
  /call movetomob
/return 


Sub Detectobst 
   /if n $MyXLoc==$char(x) /if $MyYLoc==$char(y) /call Hitobst 5 
   /varset MyXLoc $char(x) 
   /varset MyYLoc $char(y) 
/return 


sub Hitobst 
   /sendkey up up 
   /sendkey down down  
   /if n $rand(99)>50 { 

      /delay 3s
      /sendkey up down
      /sendkey down Right 
      /delay $p0  
      /sendkey up Right 
      /sendkey down up 
      /delay 3s 
      /sendkey up up 
   } else { 
      /delay 3s
      /sendkey up down
      /sendkey down left 
      /delay $p0  
      /sendkey up left 
      /sendkey down up 
      /delay 3s 
      /sendkey up up       
   } 
   /sendkey up down 
   /sendkey up Right 
   /sendkey up Left 
   /sendkey down up 
/return