bsthunter.mac - hunter fitted out for a Beastlord's Use.

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

Moderator: MacroQuest Developers

ab2304
orc pawn
orc pawn
Posts: 20
Joined: Tue Jun 01, 2004 3:19 pm

bsthunter.mac - hunter fitted out for a Beastlord's Use.

Post by ab2304 » Thu Jun 10, 2004 9:16 pm

bsthunter.mac :

Code: Select all

| Beastlord Hunter Macro 
| bsthunter.mac 
| Author      : ab2304 
| Version     : v1.0 2004-06-10 9:30pm EST 
| Useage      : /macro bsthunter 
| Description : This macro will run your character around killing any mobs in your 
|      HunterMob.ini.  Then it will attempt to loot all items in your 
|      HunterLoot.ini.  Some of the upgrades made over Robdawg's hunter.mac :
|          *Use a spell to pull instead of running up to the mob.  This is 
|               great for tough areas with buildings and such.
|          *Added an HunterAvoidMob.ini - Note: this part hasnt been tested much yet.
|          *Keeps those buffs you have on.  If you want to add buffs, add the appropriate Events.
|          *Anchor code.  Returns you to your starting spot after each kill.
|          *Enhanced Looting.  Will search out corpses that you havent looted incase of adds that pet kills.
|     This is tested for the most part.  Use at your own risk!
|------------------------------------------------------------------------------------ 
#include spellcast.inc

#event GettingHit "#*#YOU for #*#"
#Event GettingHit "#*#tries to #*#"
#Event SLAINBY "#*#You have been slain by#*#"
#turbo 10 

Sub Main 

   |------------------------------------------------------------ 
   |How many times should aquire target fail before delaying? 
   |------------------------------------------------------------ 
   /declare AB_FailMax          int outer  3 
   |------------------------------------------------------------ 
   |How far would you like to target a mob? 
   |------------------------------------------------------------ 
   /declare AB_MaxRadius        int outer  3000 
   |------------------------------------------------------------ 
   |How far is the combat range? 
   |------------------------------------------------------------ 
   /declare AB_Range            int outer 10 
   |------------------------------------------------------------ 
   |What is the minimum Z Value of mobs I should target? 
   |------------------------------------------------------------ 
   /declare AB_MinZRange        int outer  -200
   |------------------------------------------------------------ 
   |What is the maximum Z Value of mobs I should target? 
   |------------------------------------------------------------ 
   /declare AB_MaxZRange        int outer  1000 
   |------------------------------------------------------------ 
   |Should I loot all items? 
   |------------------------------------------------------------ 
   /declare AB_LootAllItems     int outer  0 
   |------------------------------------------------------------ 
   |Should I display stats? 
   |------------------------------------------------------------ 
   /declare AB_DisplayStats     int outer  1 

   |------------------------------------------------------------ 
   |How far away should I stop and cast spells? 
   |------------------------------------------------------------ 
   /declare AB_SpellDistance     int outer  140 

   |------------------------------------------------------------ 
   |Loot Array Information. 
   |------------------------------------------------------------ 
   /call ReadINI HunterMob.ini "${Zone.Name}" 
   /if (!${Defined[AB_MobArray]}) { 
      /echo Mob Array Creation Error, ending macro... 
      /endmacro 
   } 

   |------------------------------------------------------------ 
   |Mob Array Information. 
   |------------------------------------------------------------ 
   /call ReadINI HunterLoot.ini "${Zone.Name}" 
   /if (!${Defined[AB_LootArray]}) { 
      /echo No Loot Array Created... 
   }

   |------------------------------------------------------------ 
   |Avoid Mob Array Information. 
   |------------------------------------------------------------ 
   /call ReadINI HunterAvoidMob.ini "${Zone.Name}" 
   /if (!${Defined[AB_AvoidList]}) { 
      /echo No Avoid List Array Created... 
   } 



   |------------------------------------------------------------ 
   |Variables that you don't need to worry about. 
   |------------------------------------------------------------ 
   /declare AB_FailCounter      int outer  0 
   /declare AB_MyTargetID       int outer  0 
   /declare AB_MyTargetName     string outer 
   /declare AB_MyTargetDead     int outer  0 
   /declare AB_InvalidTargetID  int outer  0 
   /declare AB_HasTarget        int outer  0 
   /declare AB_RandomWait       int outer  0 
   /declare AB_LootSlot         int outer  0 
   /declare AB_CheckLook        int outer  0 
   /declare AB_Fighting         int outer  0 
   /declare AB_TargetDead       int outer  0 
   /declare AB_MyXLOC           int outer  0 
   /declare AB_MyYLOC           int outer  0 
   /declare AB_AnchorXLOC       int outer  0 
   /declare AB_AnchorYLOC       int outer  0 
   /declare AB_FastRange        int outer 
   /declare AB_RangeMax         int outer 
   /declare AB_RangeMin         int outer 
   /declare AB_AcquireMobID     int outer  0
   /declare AB_SummonPetRange   int outer  150
   /declare AB_CastNow          int outer  1
   /declare AB_GettingHit       int outer  0 
   /declare AB_AggroList[100]   int outer  NULL
   /declare AB_AggroListTotal   int outer  0
   /declare AB_PetSpellName string outer "Spirit of Sorsha"
   /declare AB_Slow string outer "Sha's Advantage"
   /declare AB_NumberOfBuffs int outer 9
   /declare AB_MyBuffs[${AB_NumberOfBuffs}] string outer
   /declare AB_NumberOfPetBuffs int outer 8 
   /declare AB_PetBuffs[${AB_NumberOfPetBuffs}] string outer 
   /varcalc AB_FastRange ${AB_Range}+3 
   /varcalc AB_RangeMax ${AB_Range}+1 
   /varcalc AB_RangeMin ${AB_Range}-1
   /varset AB_AnchorXLOC ${Int[${Me.X}]} 
   /varset AB_AnchorYLOC ${Int[${Me.Y}]}

|Buffs to be kept up on self
/varset AB_MyBuffs[1] "Spiritual Dominion" 
/varset AB_MyBuffs[2] "Spirit of Wolf"
/varset AB_MyBuffs[3] "Infusion of Spirit"
/varset AB_MyBuffs[4] "Spiritual Vigor"
/varset AB_MyBuffs[5] "Frenzy"
/varset AB_MyBuffs[6] "Dexterity"
/varset AB_MyBuffs[7] "Furious Strength"
/varset AB_MyBuffs[8] "Regrowth"
/varset AB_MyBuffs[9] "Celerity"

|Buffs to be kept up on pet    
/varset AB_PetBuffs[1] "Spirit of Wolf" 
/varset AB_PetBuffs[2] "Infusion of Spirit" 
/varset AB_PetBuffs[3] "Spiritual Strength"
/varset AB_PetBuffs[4] "Spirit of Rellic"
/varset AB_PetBuffs[5] "Dexterity" 
/varset AB_PetBuffs[6] "Furious Strength"
/varset AB_PetBuffs[7] "Regrowth" 
/varset AB_PetBuffs[8] "Arag`s Celerity"
 

   /pet hold
   /keypress esc
   /lootn never
   /fastdrop on
   /echo Anchor dropped at ${AB_AnchorXLOC},${AB_AnchorYLOC}
   /call MaintainBuffs

   :Start 

   /call GMCheck 
   /call GetTarget
   /if (${AB_HasTarget}) /call MoveToMob 
   /if (${AB_HasTarget}) /call CombatSub  
   /if (${AB_HasTarget} && (${Defined[AB_LootArray]} || ${AB_LootAllItems})) /call LootMob 
   /if (${AB_DisplayStats}) /call DisplayStats
   /pet hold 
   /call ResetSub
   /varset AB_RandomWait ${Math.Rand[5]} 
   /varcalc AB_RandomWait ${AB_RandomWait}+1 
   /echo Paranoia - Waiting ${AB_RandomWait} seconds before resuming 
   /delay ${AB_RandomWait}s 

   /goto :Start 
    
/return 

|-------------------------------------------------------------------------------- 
|SUB: Aquire Target 
|-------------------------------------------------------------------------------- 
Sub GetTarget 
   /pet hold
   /declare AB_CurrentRadius   int local 
   /declare AB_TargetSub   int local 
   /declare TempMobID int local
   /declare i int local 1
   /echo Looking for mobs.
   :Acquire 
   /for AB_CurrentRadius 100 to ${AB_MaxRadius} step 100 
      /for AB_TargetSub 1 to ${AB_MobArray.Size} 
         /varset TempMobID ${NearestSpawn[${i}, radius ${AB_CurrentRadius} nopcnear notid ${AB_InvalidTargetID} npc ${AB_MobArray[${AB_TargetSub}]}].ID} 
         /varset AB_MyTargetID ${TempMobID} 
         /varset AB_MyTargetDead 0 
         /if (${AB_FailCounter}==6) /goto :Fail
         /if (${TempMobID}) { 
            /if (${Int[${Spawn[${TempMobID}].PctHPs}]}<100) { 
               /echo Mob is at ${Spawn[${TempMobID}.PctHPs} Health, picking another... 
               /varcalc AB_FailCounter ${AB_FailCounter}+1
               /varcalc AB_FailCounter ${AB_FailCounter}+1
               /varset i ${i}+1
               /varset TempMobID 0
                 
               /goto :Acquire 
            }
            /if (${Int[${Math.Distance[${Spawn[${TempMobID}].Y},${Spawn[${TempMobID}].X}:${AB_AnchorYLOC},${AB_AnchorXLOC}]}]}>${AB_MaxRadius}) { 
               /echo Mob is to far away from Anchor Point 
               /varset i ${i}+1
               /varset TempMobID 0  
               /varcalc AB_FailCounter ${AB_FailCounter}+1
               /goto :Acquire 
            }
            /if (${Int[${Spawn[${TempMobID}].Z}]}<${AB_MinZRange}) { 
               /echo Mob is BELOW Min Z Range, picking another... 
               /varset AB_InvalidTargetID ${TempMobID}} 
               /varcalc AB_FailCounter ${AB_FailCounter}+1
               /varset i ${i}+1
               /varset TempMobID 0 
               /goto :Acquire 
            } 
            /if (${Int[${Spawn[${TempMobID}].Z}]}>${AB_MaxZRange}) { 
               /echo Mob is ABOVE Max Z Range, picking another... 
               /varset AB_InvalidTargetID ${TempMobID} 
               /varcalc AB_FailCounter ${AB_FailCounter}+1
               /varset i ${i}+1
               /varset TempMobID 0 
               /goto :Acquire 
            } 
            /varset AB_HasTarget 1 
            /varset AB_AcquireMobID ${TempMobID}
            /varset AB_MyTargetName ${Spawn[${TempMobID}].Name} 
            /echo Acquired ${Spawn[${TempMobID}].Name} at range ${Int[${Spawn[${TempMobID}].Distance}]} from us, and ${Int[${Math.Distance[${Spawn[${TempMobID}].Y},${Spawn[${TempMobID}].X}:${AB_AnchorYLOC},${AB_AnchorXLOC}]}]} from Anchor
            /return 
         } 
      /next AB_TargetSub 
      /delay 2 
   /next AB_CurrentRadius 

   /if (!${TempMobID}) { 
      /delay 2s 
      /varcalc AB_FailCounter ${AB_FailCounter}+1
      :Fail 
      |/echo Failed to Acquire Target in Range ${AB_MaxRadius} ${AB_FailCounter} Time(s) 
      /if (${AB_FailCounter}>=${AB_FailMax}) { 
         /echo Waiting for Respawns, So Heading to Anchor and Resetting Failure Counter... 
         /call MoveToAnchor
         /echo Looking for Mobs again. 
         /varset AB_FailCounter 0 
      } 
      /goto :Acquire 
   } 
/return 

|-------------------------------------------------------------------------------- 
|SUB: Moving 
|-------------------------------------------------------------------------------- 
Sub MoveToMob 

   /varset AB_MyXLOC ${Int[${Me.X}]} 
   /varset AB_MyYLOC ${Int[${Me.Y}]} 
   /declare AB_DistanceTimer timer 15 
   /declare Element int local 1 
   /declare TempMobID int local 
   /declare TempSingle int local 1 
   /declare AB_TargetSub   int local
   :MovementLoop 
   /doevents
   /varset TempMobID ${NearestSpawn[1, radius ${AB_CurrentRadius} nopcnear notid ${AB_InvalidTargetID} npc ${AB_MobArray[${AB_TargetSub}]}].ID}
   /if (${TempMobID}) {
      /if (${TempMobID}!=${AB_AcquireMobID}) {
         /if (${Spawn[${TempMobID}].Distance}<${Spawn[${AB_AcquireMobID}].Distance}) {
            /echo Found a closer mob, ${Spawn[${TempMobID}].Cleanname}, which is only ${Spawn[${TempMobID}].Distance}, vs ${Spawn[${AB_AcquireMobID}].CleanName} which is ${Spawn[${AB_AcquireMobID}].Distance} Away! re-acquiring!
            /call GetTarget
         }
      }
   }
   /varset TempMobID NULL
   /if ((!${AB_Fighting})&&(!${AB_TargetDead})&&(${Spawn[${AB_AcquireMobID}].PctHPs}<100)) {  
      /echo ${Spawn[${AB_AcquireMobID}].CleanName} is at ${Spawn[${AB_AcquireMobID}].PctHPs} health, picking another... 
      /varset AB_InvalidTargetID ${Spawn[${AcquireMobID}]} 
      /varset AB_HasTarget 0 
      /call ResetSub 
      /return 
   } 
 
   :AvoidCheckLoop 
   /squelch /varset TempMobID ${NearestSpawn[${AB_AvoidList[${Element}]}].ID}
   /if (${Int[${Spawn[${TempMobID}].Distance}]}<400) { 
             /echo ${Spawn[${TempMobID}].CleanName} is at ${Spawn[${TempMobID}].Distance}
             /echo AVOIDING ${Spawn[$TempMobID}].CleanName}
             /pet back off
             /pet hold
             /pet follow
             /call MoveToAnchor
             /return
         } 
   } 
   /varcalc Element ${Element}+1
   /if (${AvoidList[${Element}].NotEqual[UNDEFINED-ARRAY-ELEMENT]}) { 
        /goto :AvoidCheckLoop
   } 
    
   /if (${AB_AcquireMobID}) { 
      /squelch /face ID ${AB_AcquireMobID}
   } 
   /if (${Int[${Spawn[${AB_AcquireMobID}].Distance}]}>${AB_FastRange}) { 
      /keypress forward hold 
   } else /keypress forward 

   /if (${Int[${Spawn[${AB_AcquireMobID}].Distance}]}<${AB_SpellDistance}) {
      /if (${AB_Fighting}==0) {
         /target ${Spawn[${AB_AcquireMobID}]}
      }
      /if (${AB_CastNow}==1) { 
         /keypress forward
         /delay 10
         /call Cast ${AB_Slow}
         /varset AB_CastNow 2
         /return
      }
   }
 
   /if ((${Int[${Spawn[${AB_AcquireMobID}].Distance}]}<${AB_FastRange})&&(${Int[${Spawn[${AB_AcquireMobID}].Distance}]}>${AB_RangeMax})) { 
      /keypress forward 
   } 
   /if (${Int[${Spawn[${AB_AcquireMobID}].Distance}]}<${AB_RangeMin}) { 
      /keypress back 
   } 
   /if (!${AB_DistanceTimer}) { 
      /if ((${AB_MyXLOC}==${Int[${Me.X}]})&&(${AB_MyYLOC}==${Int[${Me.Y}]})) /call HitObstacle 
      /varset AB_MyXLOC ${Int[${Me.X}]} 
      /varset AB_MyYLOC ${Int[${Me.Y}]} 
      /varset AB_DistanceTimer 15 
      /goto :Movementloop 
   } 
   /if (${Int[${Spawn[${AB_AcquireMobID}].Distance}]}>${AB_FastRange}) /goto :MovementLoop 

/return 

|-------------------------------------------------------------------------------- 
|SUB: Combat 
|-------------------------------------------------------------------------------- 
Sub CombatSub 
   /declare AggroLoop   int inner  0
   /declare i int local 1
   /echo Attacking Mob NOW! 
   /varset AB_Fighting 1 
   /varset AB_TargetDead 0 
    
   :CombatLoop 
   /doevents 
   /attack on 
   /if (${AB_CastNow}==3) { 
      /call MoveToMob 
      /varset AB_GettingHit 0
   } else {
          /if (${AB_GettingHit}==1) {
             /varset AB_CastNow 3
             /pet attack
          }
   } 
   /call SpecialIT 
   

   /if (${Target.ID}) {
      /face ${Target}
   } else {
      /for AggroLoop 1 to ${AB_AggroListTotal}
         |/echo ${Spawn[${AB_AggroList[${i}-1]}].CleanName} SHOULD be on the list, exact copy except -1 removed from i
         |/echo ${AB_AggroList[${i}]} is the mob we are checking to be existing! ${AB_AggroList[1]} exists?! i is ${i}
         /if (${AB_AggroList[${i}]}) {
            /if (${Spawn[${AB_AggroList[${i}]} corpse]}) {
               |/echo ${Spawn[${AB_AggroList[${i}]} corpse]}
               |/echo We have Another Aggroed Mob, ${Spawn[${AB_AggroList[${i}]}].CleanName} with ${Spawn[${AB_AggroList[${i}]}].PctHPs} % hps.
               /target ${Spawn[${AB_AggroList[${i}]}]}
               /varset AB_AcquireMobID ${Target.ID}
               /delay 1s
               /call Cast ${AB_Slow}
               /call CombatSub
            } else {
            /varcalc i ${i}+1
            /attack off  
            /varset AB_TargetDead 1 
            /varset AB_Fighting 0
            /varset AB_CastNow 0
            |/echo One of the mobs in our aggro list Is now Dead! YEAH!
            /next AggroLoop
            |/echo No more mobs on the Aggro List!
             /return 
            }
         }
      
      } 
   }
   /if (!${AB_TargetDead}) { 
      /goto :CombatLoop 
   } 
   /varset AB_CastNow 0
/return 

|-------------------------------------------------------------------------------- 
|SUB: Special Combat 
|-------------------------------------------------------------------------------- 
Sub SpecialIt 

   /declare TempID    int inner  0 
   /doevents
   /if ((${Target.Distance}<11)&&(${Me.AbilityReady["Kick"]})) /doability "Kick" 
    
   /if ((${Int[${Me.PctHPs}]}<50)) {
      /call Cast "Chloroblast" 
   }
   
    
/return 

|-------------------------------------------------------------------------------- 
|SUB: Looting 
|-------------------------------------------------------------------------------- 
Sub LootMob 

   /declare LootSlot    int inner  0 
   /declare LootCheck   int inner  0 
   /declare LootTotal   int inner  0
   /declare AggroLoop   int inner  0
   /declare i int local 1
   /declare iCount int local 1 
   /doevents
   /for AggroLoop 1 to ${AB_AggroListTotal}
         /if (${AB_AggroList[${i}]}) {
            /squelch /target ${Spawn[${AB_AggroList[${i}]}]}
            |/echo Targeted a ${Spawn[${AB_AggroList[${i}]}].CleanName}
            /varset AB_AcquireMobID ${Target.ID}
         }
         /varcalc i ${i}+1
      /call RemoveAggroMob
   /if (${Target.Distance}>25) {
       /keypress forward hold
       /face fast nolook
   }else /keypress forward

   /face fast nolook 
    
   /keypress forward 
   /keypress back 
    
 
    
   /delay 1s 
   /loot 
   /varset AB_AcquireMobID 0
   /delay 1s 
   /if (!${Corpse.Items}) { 
      /echo NO LOOT! Cheap Bastard!
      /keypress esc 
      /return 
   } 

   /varset LootTotal ${Corpse.Items} 
   /for LootSlot 1 to ${LootTotal} 
      /itemnotify loot${LootSlot} leftmouseup 
      /delay 1s 
      /if (${AB_LootAllItems}) { 
         /echo Keeping a ${Cursor.Name}... WOOT! 
         /autoinventory 
         /delay 1s 
      } else { 
         /for LootCheck 1 to ${AB_LootArray.Size}
           /if (!${Me.FreeInventory}) { 
               /beep 
               /beep
               /beep
               /beep
               /echo ** INVENTORY FULL !
               /call MoveToAnchor
               /endmacro
               }
            /if (${Cursor.Name.Find[${AB_LootArray[${LootCheck}]}]}) { 
               /echo Keeping a ${Cursor.Name}... WOOT! 
               /varcalc AB_LootStats[${LootCheck}] ${AB_LootStats[${LootCheck}]}+1 
               /autoinventory 
               /delay 1s 
            } 
         /next LootCheck 
      } 
      /if (${Cursor.ID}) { 
         /echo Destroying a ${Cursor.Name}... 
         /destroy 
         /delay 1s 
      }
   
   /next LootSlot
 
   /keypress esc 
   /next AggroLoop
   :LootOther
               /keypress esc
               /delay 15 
               /squelch /target ${NearestSpawn[corpse radius 200 nopcnear "${AB_MobArray[${iCount}]}"]}
               /if (${Target.ID}) {
                  /varset AB_AcquireMobID ${Target.ID}
                  /call MoveToMob 
                  /echo We have another corpse in the area, going to get it.
                  /call LootMob 
               }
    /varcalc iCount ${iCount}+1
    /if ((${Int[${iCount}]}<${Int[${AB_MobArray.Size}]})) /goto :LootOther
    /keypress esc
/return 

|-------------------------------------------------------------------------------- 
|SUB: Remove Mob From the Aggro List, dead and looted 
|-------------------------------------------------------------------------------- 
Sub RemoveAggroMob
/declare i int local 1
/declare iCount int local 1 
/declare AggroLoop   int inner  0
/declare InnerAggroLoop int inner 0
/declare temp int local 0
/for AggroLoop 1 to ${AB_AggroListTotal}
   /if (${Target.ID}==${AB_AggroList[${iCount}]}) {
       /varset AB_AggroList[${iCount}] UNDEFINED-ARRAY-ELEMENT
       /varcalc i ${iCalc}+1
        /for InnerAggroLoop 1 to ${AB_AggroList[${i}]!=NULL
           /varcalc i ${i}+1
        /next InnerAggroLoop
   /varset AB_AggroList[${iCount}] ${AB_AggroList[${i}]}
   /varset AB_AggroList[${i}] UNDEFINED-ARRAY-ELEMENT
   /varcalc iCount ${iCount}+1
   }
/next AggroLoop
/varcalc AB_AggroListTotal ${AggroListTotal}-1
/doevents
/return


|-------------------------------------------------------------------------------- 
|SUB: Reset 
|-------------------------------------------------------------------------------- 
Sub ResetSub 
   |/call MoveToAnchor
   /keypress esc
   /doevents
   /call MaintainBuffs
   /if (${Me.AltAbilityReady[Paragon of Spirit]}) {
      /call Cast "Paragon of Spirit" activate
      /delay 6s
   }
   /keypress esc   
   /varset AB_HasTarget 0 
   /varset AB_TargetDead 0 
   /varset AB_Fighting 0 
   /varset AB_CastNow 1
   /doevents 
/return

|-------------------------------------------------------------------------------- 
|SUB: MaintainBuffs 
|-------------------------------------------------------------------------------- 
Sub MaintainBuffs 
/declare PetBuffLoop    int inner  0 
/declare MyBuffLoop    int inner  0 
/declare iCount int 1 
/declare tmp
/doevents
   /for MyBuffLoop 1 to ${AB_NumberOfBuffs} 
      /if (!${Me.Buff[${AB_MyBuffs[${iCount}]}].ID}) { 
         /target ${Me}
         /call Cast ${AB_MyBuffs[${iCount}]} 
         /delay 1s
         /if (${iCount}==5) /delay 20s 
         /doevents
      } 
      /varcalc iCount ${iCount}+1 
   /next MyBuffLoop 

   /varset iCount 1 

   |If we have pet, make one      
   /if ( !${Me.Pet.ID} ) { 
         /echo Creating new pet 
         /call Cast ${AB_PetSpellName}
         /delay 1s
         /target ${Me.Pet.Name}
         /call Cast "Shrink"  
   } 
    
      
   /if ( ${Me.Pet.Distance}>${AB_SummonPetRange}) { 
        /echo Summoning pet. Its range is ${Me.Pet.Distance} 
        /call Cast "Summon Companion" 
        /delay 1s    
   } 
   /for PetBuffLoop 1 to ${AB_NumberOfPetBuffs} 
      /if (!${Me.PetBuff[${AB_PetBuffs[${iCount}]}]}) { 
         /target ${Me.Pet.Name} 
         /call Cast ${AB_PetBuffs[${iCount}]} 
         /delay 1s 
         /doevents
      } 
      /varcalc iCount ${iCount}+1 
   /next PetBuffLoop 
/keypress esc
/return 

|-------------------------------------------------------------------------------
|Return to Anchor
|-------------------------------------------------------------------------------
Sub MoveToAnchor 
    /declare iCount int local 
    /declare TempMobID int local
    /declare Element int local 1
    /declare AB_DistanceTimer int local 30
    /varset AB_MyXLOC ${Me.X} 
    /varset AB_MyYLOC ${Me.Y} 
    /varset iCount 0 
    /doevents	  
    /echo Moving to Anchor at Loc: ${AB_AnchorXLOC}, ${AB_AnchorYLOC}. 

   :AnchorMoveLoop  
    /delay 1 

   :AvoidCheckLoopAnchor 
   /varset TempMobID ${NearestSpawn[npc radius 400 ${AB_AvoidList[${i}]}]}
   /if (${TempMobID}!=NULL) {
         /echo OOOPS, avoiding Mob
         /if (${TempMobID}) { 
      		/face nolook ${TempMobID}
                /if (${Math.Rand[2]}) { 
                   /echo ack 1
                   /keypress strafe_right hold
                   /keypress back hold 
                } else { 
                    /echo ack 2
                    /keypress strafe_left hold
                    /keypress back hold 
                } 
         /delay ${Math.Calc[${Math.Rand[15]}+30]} 
         /echo ack 3
         /keypress strafe_right
         /keypress forward 
         /keypress strafe_left 
         } 
   } 
   /varcalc Element ${Element}+1 
   /if (${AvoidList[${Element}].NotEqual[UNDEFINED-ARRAY-ELEMENT]}) { 
       /goto :AvoidCheckLoopAnchor
   }
    |/face nolook loc $(+{AB_AnchorXLoc}),$(+{AB_AnchorYLoc}) 
    /face nolook loc ${AB_AnchorYLOC},${AB_AnchorXLOC}
    /if (${Math.Distance[${AB_AnchorYLOC},${AB_AnchorXLOC}]}>10) { 
       /keypress forward hold 
   } else { 
       /keypress forward
       /echo Moved to Anchor at Loc: ${Me.X}, ${Me.Y}. 
        /return 
    } 

    
        
     /if (${AB_DistanceTimer}==1) { 

          /if ((${AB_MyXLOC}==${Int[${Me.X}]})&&(${AB_MyYLOC}==${Int[${Me.Y}]})) {
               /call HitObstacle
               /echo hit obstacle? ${AB_MyXLOC},${AB_MyYLOC} = ${Me.X},${Me.Y} ?
          } 
          /varset AB_MyXLOC ${Int[${Me.X}]} 
          /varset AB_MyYLOC ${Int[${Me.Y}]}
          /varset AB_DistanceTimer 30   
          |/face nolook loc ${AnchorYLOC},${AnchorXLOC} 
          
          /goto :AnchorMoveLoop 
      } 
    
    /varcalc AB_DistanceTimer ${AB_DistanceTimer}-1 
    /goto :AnchorMoveLoop
    }
/echo End Of Anchor Loop
    /goto :AnchorMoveLoop
/return
|-------------------------------------------------------------------------------- 
|SUB: Obstacle Avoidance 
|-------------------------------------------------------------------------------- 
Sub HitObstacle 
   /echo Obstacle hit, moving around it... 
   /keypress forward 
   /keypress back hold 
   /delay ${Math.Calc[${Math.Rand[5]}+6]} 
   /keypress back 
   /if (${Math.Rand[2]}) { 
     /keypress strafe_right hold
     /keypress forward hold 
   } else { 
     /keypress strafe_left hold
     /keypress forward hold 
   } 
   /delay ${Math.Calc[${Math.Rand[15]}+12]} 
   /keypress strafe_right 
   /keypress strafe_left 
/return

|-------------------------------------------------------------------------------- 
|SUB: GM Check 
|-------------------------------------------------------------------------------- 
Sub GMCheck 

   /if (${Spawn[gm].ID}) { 
      /beep 
      /beep 
      /beep 
      
      /echo GM has entered the zone! 
      /echo FUCK HIM but ending the macro... 

      /keypress forward 
      /keypress back 

      /quit 
      /endmacro 
   } 
    
/return 

|-------------------------------------------------------------------------------- 
|SUB: Reading from an INI File 
|-------------------------------------------------------------------------------- 
Sub ReadINI(FileName,SectionName) 

   /echo Attempting to Read Section "${SectionName}" Zone Information from ${FileName}... 
   /delay 1s 
    
   /if (${Ini[${FileName},${SectionName},-1,NO].Equal[NO]}) { 
      /echo "${SectionName}" is not a Valid Section for FILE:${FileName}, ending macro... 
      /delay 1s 
      /return 
   } 
   /declare nValues     int local  1 
   /declare nArray      int local  0 
   /declare KeySet      string local  ${Ini[${FileName},${SectionName}]} 

   :CounterLoop 
   /if (!${KeySet.Arg[${nValues},|].Length}) { 
      /varcalc nValues ${nValues}-1 
      /goto :MakeArray 
   } 
   /varcalc nValues ${nValues}+1 
   /goto :CounterLoop  

   :MakeArray 
   /if (!${nValues}) /return 
   /if (${FileName.Equal["HunterMob.ini"]}&&${nValues}>0) { 
      /echo Declaring Mob Array... 
      /declare AB_MobArray[${nValues}]   string outer 
      /declare AB_MobStats[${nValues}]   string outer 
   } 
   /if (${FileName.Equal["HunterLoot.ini"]}&&${nValues}>0) { 
      /echo Declaring Loot Array... 
      /declare AB_LootArray[${nValues}]  string outer 
      /declare AB_LootStats[${nValues}]  string outer 
   }
   /if (${FileName.Equal["HunterAvoidMob.ini"]}&&${nValues}>0) { 
      /echo Declaring AvoidMob Array... 
      /declare AB_AvoidList[${nValues}]  string outer  
   } 
   /for nArray 1 to ${nValues} 
      /if (${FileName.Equal["HunterMob.ini"]}) { 
         /varset AB_MobArray[${nArray}] ${Ini[${FileName},${SectionName},${KeySet.Arg[${nArray},|]},NULL]} 
         /varset AB_MobStats[${nArray}] 0 
      } 
      /if (${FileName.Equal["HunterLoot.ini"]}) { 
         /varset AB_LootArray[${nArray}] ${Ini[${FileName},${SectionName},${KeySet.Arg[${nArray},|]},NULL]} 
         /varset AB_LootStats[${nArray}] 0 
      } 
      /if (${FileName.Equal["HunterAvoidMob.ini"]}) { 
         /varset AB_AvoidList[${nArray}] ${Ini[${FileName},${SectionName},${KeySet.Arg[${nArray},|]},NULL]} 
         /echo ${AB_AvoidList[${nArray}]}
      }
   /next nArray 
    
   /echo "${SectionName}" Zone Information Read Successfully from ${FileName}... 
   /delay 1s



    
/return 

|-------------------------------------------------------------------------------- 
|SUB: Display Stats 
|-------------------------------------------------------------------------------- 
Sub DisplayStats 

   /declare nArray  int local 
    
   /if (${Defined[AB_LootArray]}) { 
      /for nArray 1 to ${AB_LootArray.Size} 
         /echo ${Int[${AB_LootStats[${nArray}]}]} ${AB_LootArray[${nArray}]}'s 
      /next nArray 
   } 
    
/return

| ----- Events called by /DoEvents ----- 

Sub Event_GettingHit

/varset AB_GettingHit 1
/declare TempMobID int 0
/declare AggroLoop    int local  0
/declare OuterAggroLoop int local 0
/declare iCount int local 1
/declare i int local 1
/declare MobX int local 0
/declare MobY int local 0
/declare MobsHeading int local 0
/declare MyHeadingToMob int local 0
/declare NewAdd int local 0
/declare temp int local 0
/for OuterAggroLoop 1 to 20
   /varset TempMobID ${NearestSpawn[${iCount}, npc radius 40].ID}
   /if (${TempMobID}==NULL) /return
   /varset MobX ${NearestSpawn[${iCount}, npc radius 40].X}
   /varset MobY ${NearestSpawn[${iCount}, npc radius 40].Y}
   /varset MobsHeading ${NearestSpawn[${iCount}, npc radius 40].Heading.Clock}
   /varset MyHeadingToMob ${Heading[${MobY},${MobX}].Clock}
   /varcalc temp ${MyHeadingToMob}-${MobsHeading}
   /if (${temp}<0) {
      /varcalc temp ${temp}+12
   }
   /if ((${temp}>4)&&(${temp}<8)) {
      /for AggroLoop 1 to ${AB_AggroListTotal}
         /if (${TempMobID}==${AB_AggroList[${i}]}) {
            /varset NewAdd 1
            |/echo Mob already on list!
         }
         /varcalc i ${i}+1
      /next AggroLoop
   /if (${NewAdd}==0) {
      /varcalc i ${i}-1
      /varset AB_AggroList[${i}] ${TempMobID}
      /varcalc AB_AggroListTotal ${AggroListTotal}+1
      /echo ${Spawn[${AB_AggroList[${i}]}].CleanName} added to aggro list!
      |/call PrintAggroList
   }      
}
/varset i 1
/varcalc iCount ${iCount}+1
/next OuterAggroLoop
/varset AB_GettingHit 1
/return 

Sub PrintAggroList
/declare AggroLoop int local 0
/declare i int 1
   /echo AggroList now Contains :
   /for AggroLoop 1 to ${AB_AggroListTotal}
       /echo ${Spawn[${AB_AggroList[${i}]}].CleanName} at ${Spawn[${AB_AggroList[${i}]}].PctHPs} health, ${Spawn[${AB_AggroList[${i}]}].Distance} units away.
       /varcalc i ${i}+1
   /next AggroLoop
/return
HunterMob.ini

Code: Select all

[Eastern Plains of Karana] 
Mob1=Spider 
Mob2=Lion 
Mob3=Griffawn 

[East Commonlands] 
Mob1=Spiderling 

[The Feerrott] 
Mob1=Spider

[The Overthere]
Mob1=berzerker
Mob2=sarnak
HunterLoot.ini

Code: Select all

[Eastern Plains of Karana] 
Loot1=Silk 
Loot2=High Quality 
Loot3=Medium Quality 
Loot4=Feather 

[East Commonlands] 
Loot1=Spiderling Silk 

[The Feerrott] 
Loot1=Spiderling Silk

[The Overthere]
Loot1=A Sarnak War Braid
HunterAvoidMob.ini

Code: Select all

[The Overthere]
Mob1=Dragoon
Mob2=General
Last edited by ab2304 on Tue Jun 15, 2004 10:18 pm, edited 2 times in total.

ab2304
orc pawn
orc pawn
Posts: 20
Joined: Tue Jun 01, 2004 3:19 pm

Post by ab2304 » Thu Jun 10, 2004 9:23 pm

Well, its finially done. Please let me know what works/what doesnt.

kaatok
decaying skeleton
decaying skeleton
Posts: 3
Joined: Wed Jun 09, 2004 11:43 am

Post by kaatok » Fri Jun 11, 2004 8:32 am

strange, i dont know what im doing wrong, but. For some strange reason it just doesnt want to target any mobs. It says it has sucessfully read the huntermob.ini and ive copied the name in exactly how its said in game and howit looks above.

Lets say for instance PoN i have ......

[The plane of nightmare]
Mob1=a blood raven
Mob2=a gnarled treant


According to the program everything is read fine but when im standing on a blood raven it just wont target it.

Also set the find mob setting line

/declare AB_MaxRadius int outer 3000

changed to =

/declare AB_MaxRadius int outer 30000


...Still wont. I know its something dumb and i probably deserve every bit of flaming i get, but anyne have any ideas?

ab2304
orc pawn
orc pawn
Posts: 20
Joined: Tue Jun 01, 2004 3:19 pm

Post by ab2304 » Fri Jun 11, 2004 9:04 am

Using your instance, you have it slightly off. I believe the zone name needs to be caps sensitive. Do a /echo ${Zone.Name} and type that exactly. [The Plane of Nightmare]

I also had problems with mobs that have multiple words in their name. So I would change the Mob1=a blood raven for instance to Mob1=raven

also, BEFORE YOU RUN THAT!!! 30,000 is a HUGE area. If there is a raven across the ravine, you WILL run through all the hobgobbies to get to it!!! It will go for the closest mob on your list, and if that happens to be in the swarm of other mobs (or through), it will go on its merry way to go pull that mob.

***I dont suggest using this as a exp hunter, its not that beefy yet.*** I wouldnt use it anywhere that either my pet or I couldnt take down 3 mobs at once by ourselves. (without slow). For some reason, robs Add code doesnt work that great anylonger. And it doesnt play pet cleric yet. I will be working on this to move the buffs to a real buff check, so I can get back my events. I will also throw in some code to allow pet clericing. And maybe some better add detection. If anyone has any good code to pull smarter (not through other aggro mobs, or not when another mob is near our pull mob), id love to see it so I can throw it in here.

wolf5
a ghoul
a ghoul
Posts: 89
Joined: Wed Jun 02, 2004 12:58 pm

Post by wolf5 » Fri Jun 11, 2004 9:20 am

After what I see here, you have to cast the spells you want to be on you at all times during the macro, because unless you allready have them on you, no event will be thrown to refresh.

Check the way I do it here: http://macroquest2.com/phpBB2/viewtopic.php?t=7715 (Sub MaintainSelf)

It checks if the buff is missing. If it is, cast refresh.

A minus is if there is a better version on you than the spell you wish to keep up. Since the spell wont stick, it will be tried again and again (there is prob an easy way to work around this, ie tag the spell to not refresh untill some of the unknown spells on you drop off).

Your script will also suffer if someone casts a better spell on you. But only once. You cast, you fail and you move on...

Dont know if hunter has this, but if there is enough mobs throughout the zone, will you keeping hunting further and further as long as you aquire a target on your way, or will you force a return to homespot if you get outside a certain range of your homespot?

For Hill Giants farming I found out I had to do that, because I also kill the PHs (lizards) and they can bring me far off if I continue chain targeting them.

-Wolf5

ab2304
orc pawn
orc pawn
Posts: 20
Joined: Tue Jun 01, 2004 3:19 pm

Post by ab2304 » Fri Jun 11, 2004 9:24 am

Right now, it will return to the anchor spot each time you kill a mob. (Cause it was going WAY far away, and killing Sarnak Youths before I added the anchor stuff.) But I like the idea of returning only if you start to go outside a set range. (Or if you have an avoid mob in sight). I think I will implement that. And I will take a look at your buff code, thanks!

whathedoes
decaying skeleton
decaying skeleton
Posts: 4
Joined: Thu Jun 03, 2004 5:39 pm

Post by whathedoes » Fri Jun 11, 2004 6:54 pm

Tried to run it in East Karana today really quick. Here's what I got...

[MQ2]Attempting to Read Section "Eastern Plains of Karana" Zone Information from Huntermob.ini....
[MQ2]Mob Array Creation Error, ending macro....
The current macro has ended.

*shrug* I know jack about programing (on my list of things to do tho ;) ). Just posting my problem for other people that may have the same problem.

I make myself look stupid, for people that are afraid to.

Neoplex
a lesser mummy
a lesser mummy
Posts: 45
Joined: Wed Nov 06, 2002 12:27 pm

Post by Neoplex » Sat Jun 12, 2004 3:11 pm

I get the same issue too. Dont see why it would do it either.
Noobmonk01 says "Your kung fu is no match for me The tribunal!"
Autoattack on
The Tribunal begins to cast a spell
LOADING PLEASE WAIT ;)

wolf5
a ghoul
a ghoul
Posts: 89
Joined: Wed Jun 02, 2004 12:58 pm

Post by wolf5 » Mon Jun 14, 2004 3:54 am

Me and ab2304 are working on a new hunter script not ripped from hunter.mac, but built up from ground. It's 99% done (only need ini-file usage).

We will post it when we feel it works as we want it to.

Hill Giant farming will be a breeze :-) Earned close to 10Kpp so far just testing and adjusting the script at hill giants (trying to to kill steal). Next step is to try it hunting some xp mobs.

-Wolf5

ab2304
orc pawn
orc pawn
Posts: 20
Joined: Tue Jun 01, 2004 3:19 pm

Post by ab2304 » Tue Jun 15, 2004 10:25 pm

Well, here goes version 2!

Avoid Mob is tested a lil bit further. It is now running away from mobs it doesnt like, but I havent been able to test it all that much... still might have a few quirks left.

Targeting now doesnt target the mob till it is within casting range. No more targeting from 3000 units away!

AggroList It now keeps track of who has been hitting on you. Still may be a lil quirky, as I dont get adds all that often. YMMV

Should now loot all mobs you kill, but only start to loot after all mobs on your aggro list are dead.

Right now, it does no sorting of the aggro list, so first mob to hit you is the first it will kill, and last mob will be last. I may update it to do some sorting (such as place casters/healers 1st, then highest lvl, etc. But, will be moving over to Wolf5's version instead of Hunter.Mac, as I like that framework a lot better. If someone wants to maintian this version, let me know!

barice01
orc pawn
orc pawn
Posts: 11
Joined: Sun May 09, 2004 7:15 am

thx for this good macro for BST..

Post by barice01 » Wed Jun 16, 2004 9:35 am

thx for this good macro for BST..

if you fix the file head information , will be more good

like Version, Description ..

Keiichi
decaying skeleton
decaying skeleton
Posts: 3
Joined: Tue Jun 15, 2004 11:29 am
Location: Washington, USA

Changing

Post by Keiichi » Thu Jun 17, 2004 8:06 am

Alrighty I have been looking for a good fighting macro and I came apon the hunter macro robdawg made and read your post about changin yours so it could Set the anchor point. Look for the mob. Run to the mob. Attack the mob. Run to anchor. Kill mob. return to anchor. repeat. I have done no coding what so ever BUT I have spent about 1 hour 40 minutes looking over your awesome code and changin it so I could get rid of ALL spell casting and ALL pet areas. And adding it so it would return to anchor after attack turned on and mob hits you. All I am asking if you could is to make sure I havnt screwed up the code and or if I need to edit it even more. I would really appriciate the help. Thanks in advance.


CODE
______


Code: Select all

| Beastlord Hunter Macro 
| bsthunter.mac 
| Author      : ab2304 
| Version     : v1.0 2004-06-10 9:30pm EST 
| Useage      : /macro bsthunter 
| Description : This macro will run your character around killing any mobs in your 
|      HunterMob.ini.  Then it will attempt to loot all items in your 
|      HunterLoot.ini.  Some of the upgrades made over Robdawg's hunter.mac : 
|          *Use a spell to pull instead of running up to the mob.  This is 
|               great for tough areas with buildings and such. 
|          *Added an HunterAvoidMob.ini - Note: this part hasnt been tested much yet. 
|          *Keeps those buffs you have on.  If you want to add buffs, add the appropriate Events. 
|          *Anchor code.  Returns you to your starting spot after each kill. 
|          *Enhanced Looting.  Will search out corpses that you havent looted incase of adds that pet kills. 
|     This is tested for the most part.  Use at your own risk! 
|------------------------------------------------------------------------------------ 
#include spellcast.inc 

#event GettingHit "#*#YOU for #*#" 
#Event GettingHit "#*#tries to #*#" 
#Event SLAINBY "#*#You have been slain by#*#" 
#turbo 10 

Sub Main 

   |------------------------------------------------------------ 
   |How many times should aquire target fail before delaying? 
   |------------------------------------------------------------ 
   /declare AB_FailMax          int outer  3 
   |------------------------------------------------------------ 
   |How far would you like to target a mob? 
   |------------------------------------------------------------ 
   /declare AB_MaxRadius        int outer  5000
   |------------------------------------------------------------ 
   |How far is the combat range? 
   |------------------------------------------------------------ 
   /declare AB_Range            int outer 10 
   |------------------------------------------------------------ 
   |What is the minimum Z Value of mobs I should target? 
   |------------------------------------------------------------ 
   /declare AB_MinZRange        int outer  -200 
   |------------------------------------------------------------ 
   |What is the maximum Z Value of mobs I should target? 
   |------------------------------------------------------------ 
   /declare AB_MaxZRange        int outer  1000 
   |------------------------------------------------------------ 
   |Should I loot all items? 
   |------------------------------------------------------------ 
   /declare AB_LootAllItems     int outer  0 
   |------------------------------------------------------------ 
   |Should I display stats? 
   |------------------------------------------------------------ 
   /declare AB_DisplayStats     int outer  1 
   |------------------------------------------------------------ 
   |Loot Array Information. 
   |------------------------------------------------------------ 
   /call ReadINI HunterMob.ini "${Zone.Name}" 
   /if (!${Defined[AB_MobArray]}) { 
      /echo Mob Array Creation Error, ending macro... 
      /endmacro 
   } 

   |------------------------------------------------------------ 
   |Avoid Mob Array Information. 
   |------------------------------------------------------------ 
   /call ReadINI HunterAvoidMob.ini "${Zone.Name}" 
   /if (!${Defined[AB_AvoidList]}) { 
      /echo No Avoid List Array Created... 
   } 



   |------------------------------------------------------------ 
   |Variables that you don't need to worry about. 
   |------------------------------------------------------------ 
   /declare AB_FailCounter      int outer  0 
   /declare AB_MyTargetID       int outer  0 
   /declare AB_MyTargetName     string outer 
   /declare AB_MyTargetDead     int outer  0 
   /declare AB_InvalidTargetID  int outer  0 
   /declare AB_HasTarget        int outer  0 
   /declare AB_RandomWait       int outer  0 
   /declare AB_LootSlot         int outer  0 
   /declare AB_CheckLook        int outer  0 
   /declare AB_Fighting         int outer  0 
   /declare AB_TargetDead       int outer  0 
   /declare AB_MyXLOC           int outer  0 
   /declare AB_MyYLOC           int outer  0 
   /declare AB_AnchorXLOC       int outer  0 
   /declare AB_AnchorYLOC       int outer  0 
   /declare AB_FastRange        int outer 
   /declare AB_RangeMax         int outer 
   /declare AB_RangeMin         int outer 
   /declare AB_AcquireMobID     int outer  0 
   /declare AB_SummonPetRange   int outer  150 
   /declare AB_CastNow          int outer  1 
   /declare AB_GettingHit       int outer  0 
   /declare AB_AggroList[100]   int outer  NULL 
   /declare AB_AggroListTotal   int outer  0 
   /declare AB_PetSpellName string outer "Spirit of Sorsha" 
   /declare AB_Slow string outer "Sha's Advantage"   
   /varcalc AB_FastRange ${AB_Range}+3 
   /varcalc AB_RangeMax ${AB_Range}+1 
   /varcalc AB_RangeMin ${AB_Range}-1 
   /varset AB_AnchorXLOC ${Int[${Me.X}]} 
   /varset AB_AnchorYLOC ${Int[${Me.Y}]} 



   /keypress esc 
   /lootn never 
   /fastdrop on 
   /echo Anchor dropped at ${AB_AnchorXLOC},${AB_AnchorYLOC}

   :Start 

   /call GMCheck 
   /call GetTarget 
   /if (${AB_HasTarget}) /call MoveToMob 
   /if (${AB_HasTarget}) /call CombatSub  
   /if (${AB_DisplayStats}) /call DisplayStats 
   /call ResetSub 
   /varset AB_RandomWait ${Math.Rand[5]} 
   /varcalc AB_RandomWait ${AB_RandomWait}+1 
   /echo Paranoia - Waiting ${AB_RandomWait} seconds before resuming 
   /delay ${AB_RandomWait}s 

   /goto :Start 
    
/return 

|-------------------------------------------------------------------------------- 
|SUB: Aquire Target 
|-------------------------------------------------------------------------------- 
Sub GetTarget  
   /declare AB_CurrentRadius   int local 
   /declare AB_TargetSub   int local 
   /declare TempMobID int local 
   /declare i int local 1 
   /echo Looking for mobs. 
   :Acquire 
   /for AB_CurrentRadius 100 to ${AB_MaxRadius} step 100 
      /for AB_TargetSub 1 to ${AB_MobArray.Size} 
         /varset TempMobID ${NearestSpawn[${i}, radius ${AB_CurrentRadius} nopcnear notid ${AB_InvalidTargetID} npc ${AB_MobArray[${AB_TargetSub}]}].ID} 
         /varset AB_MyTargetID ${TempMobID} 
         /varset AB_MyTargetDead 0 
         /if (${AB_FailCounter}==6) /goto :Fail 
         /if (${TempMobID}) { 
            /if (${Int[${Spawn[${TempMobID}].PctHPs}]}<100) { 
               /echo Mob is at ${Spawn[${TempMobID}.PctHPs} Health, picking another... 
               /varcalc AB_FailCounter ${AB_FailCounter}+1 
               /varcalc AB_FailCounter ${AB_FailCounter}+1 
               /varset i ${i}+1 
               /varset TempMobID 0 
                  
               /goto :Acquire 
            } 
            /if (${Int[${Math.Distance[${Spawn[${TempMobID}].Y},${Spawn[${TempMobID}].X}:${AB_AnchorYLOC},${AB_AnchorXLOC}]}]}>${AB_MaxRadius}) { 
               /echo Mob is to far away from Anchor Point 
               /varset i ${i}+1 
               /varset TempMobID 0  
               /varcalc AB_FailCounter ${AB_FailCounter}+1 
               /goto :Acquire 
            } 
            /if (${Int[${Spawn[${TempMobID}].Z}]}<${AB_MinZRange}) { 
               /echo Mob is BELOW Min Z Range, picking another... 
               /varset AB_InvalidTargetID ${TempMobID}} 
               /varcalc AB_FailCounter ${AB_FailCounter}+1 
               /varset i ${i}+1 
               /varset TempMobID 0 
               /goto :Acquire 
            } 
            /if (${Int[${Spawn[${TempMobID}].Z}]}>${AB_MaxZRange}) { 
               /echo Mob is ABOVE Max Z Range, picking another... 
               /varset AB_InvalidTargetID ${TempMobID} 
               /varcalc AB_FailCounter ${AB_FailCounter}+1 
               /varset i ${i}+1 
               /varset TempMobID 0 
               /goto :Acquire 
            } 
            /varset AB_HasTarget 1 
            /varset AB_AcquireMobID ${TempMobID} 
            /varset AB_MyTargetName ${Spawn[${TempMobID}].Name} 
            /echo Acquired ${Spawn[${TempMobID}].Name} at range ${Int[${Spawn[${TempMobID}].Distance}]} from us, and 

${Int[${Math.Distance[${Spawn[${TempMobID}].Y},${Spawn[${TempMobID}].X}:${AB_AnchorYLOC},${AB_AnchorXLOC}]}]} from Anchor 
            /return 
         } 
      /next AB_TargetSub 
      /delay 2 
   /next AB_CurrentRadius 

   /if (!${TempMobID}) { 
      /delay 2s 
      /varcalc AB_FailCounter ${AB_FailCounter}+1 
      :Fail 
      |/echo Failed to Acquire Target in Range ${AB_MaxRadius} ${AB_FailCounter} Time(s) 
      /if (${AB_FailCounter}>=${AB_FailMax}) { 
         /echo Looking for Mobs again. 
         /varset AB_FailCounter 0 
      } 
      /goto :Acquire 
   } 
/return 

|-------------------------------------------------------------------------------- 
|SUB: Moving 
|-------------------------------------------------------------------------------- 
Sub MoveToMob 

   /varset AB_MyXLOC ${Int[${Me.X}]} 
   /varset AB_MyYLOC ${Int[${Me.Y}]} 
   /declare AB_DistanceTimer timer 15 
   /declare Element int local 1 
   /declare TempMobID int local 
   /declare TempSingle int local 1 
   /declare AB_TargetSub   int local 
   :MovementLoop 
   /doevents 
   /varset TempMobID ${NearestSpawn[1, radius ${AB_CurrentRadius} nopcnear notid ${AB_InvalidTargetID} npc ${AB_MobArray[${AB_TargetSub}]}].ID} 
   /if (${TempMobID}) { 
      /if (${TempMobID}!=${AB_AcquireMobID}) { 
         /if (${Spawn[${TempMobID}].Distance}<${Spawn[${AB_AcquireMobID}].Distance}) { 
            /echo Found a closer mob, ${Spawn[${TempMobID}].Cleanname}, which is only ${Spawn[${TempMobID}].Distance}, vs 

${Spawn[${AB_AcquireMobID}].CleanName} which is ${Spawn[${AB_AcquireMobID}].Distance} Away! re-acquiring! 
            /call GetTarget 
         } 
      } 
   } 
   /varset TempMobID NULL 
   /if ((!${AB_Fighting})&&(!${AB_TargetDead})&&(${Spawn[${AB_AcquireMobID}].PctHPs}<100)) {  
      /echo ${Spawn[${AB_AcquireMobID}].CleanName} is at ${Spawn[${AB_AcquireMobID}].PctHPs} health, picking another... 
      /varset AB_InvalidTargetID ${Spawn[${AcquireMobID}]} 
      /varset AB_HasTarget 0 
      /call ResetSub 
      /return 
   } 

   :AvoidCheckLoop 
   /squelch /varset TempMobID ${NearestSpawn[${AB_AvoidList[${Element}]}].ID} 
   /if (${Int[${Spawn[${TempMobID}].Distance}]}<400) { 
             /echo ${Spawn[${TempMobID}].CleanName} is at ${Spawn[${TempMobID}].Distance} 
             /echo AVOIDING ${Spawn[$TempMobID}].CleanName} 
             /return 
         } 
   } 
   /varcalc Element ${Element}+1 
   /if (${AvoidList[${Element}].NotEqual[UNDEFINED-ARRAY-ELEMENT]}) { 
        /goto :AvoidCheckLoop 
   } 
    
   /if (${AB_AcquireMobID}) { 
      /squelch /face ID ${AB_AcquireMobID} 
   } 
   /if (${Int[${Spawn[${AB_AcquireMobID}].Distance}]}>${AB_FastRange}) { 
      /keypress forward hold 
   } else /keypress forward 

   /if (${Int[${Spawn[${AB_AcquireMobID}].Distance}]}<${AB_SpellDistance}) { 
      /if (${AB_Fighting}==0) { 
         /target ${Spawn[${AB_AcquireMobID}]} 
      } 
      /if (${AB_CastNow}==1) { 
         /keypress forward 
         /delay 10 
         /call Cast ${AB_Slow} 
         /varset AB_CastNow 2 
         /return 
      } 
   } 

   /if ((${Int[${Spawn[${AB_AcquireMobID}].Distance}]}<${AB_FastRange})&&(${Int[${Spawn[${AB_AcquireMobID}].Distance}]}>${AB_RangeMax})) { 
      /keypress forward 
   } 
   /if (${Int[${Spawn[${AB_AcquireMobID}].Distance}]}<${AB_RangeMin}) { 
      /keypress back 
   } 
   /if (!${AB_DistanceTimer}) { 
      /if ((${AB_MyXLOC}==${Int[${Me.X}]})&&(${AB_MyYLOC}==${Int[${Me.Y}]})) /call HitObstacle 
      /varset AB_MyXLOC ${Int[${Me.X}]} 
      /varset AB_MyYLOC ${Int[${Me.Y}]} 
      /varset AB_DistanceTimer 15 
      /goto :Movementloop 
   } 
   /if (${Int[${Spawn[${AB_AcquireMobID}].Distance}]}>${AB_FastRange}) /goto :MovementLoop 

/return 

|-------------------------------------------------------------------------------- 
|SUB: Combat 
|-------------------------------------------------------------------------------- 
Sub CombatSub 
   /declare AggroLoop   int inner  0 
   /declare i int local 1 
   /echo Attacking Mob NOW! 
   /varset AB_Fighting 1 
   /varset AB_TargetDead 0 
    
   :CombatLoop 
   /doevents 
   /attack on 
   /if (${AB_CastNow}==3) { 
      /call MoveToMob 
      /varset AB_GettingHit 0 
   } else { 
          /if (${AB_GettingHit}==1) { 
             /varset AB_CastNow 3 
            
          } 
   } 
   /call SpecialIT 
    

   /if (${Target.ID}) { 
      /face ${Target} 
   } else { 
      /for AggroLoop 1 to ${AB_AggroListTotal} 
         |/echo ${Spawn[${AB_AggroList[${i}-1]}].CleanName} SHOULD be on the list, exact copy except -1 removed from i 
         |/echo ${AB_AggroList[${i}]} is the mob we are checking to be existing! ${AB_AggroList[1]} exists?! i is ${i} 
         /if (${AB_AggroList[${i}]}) { 
            /if (${Spawn[${AB_AggroList[${i}]} corpse]}) { 
               |/echo ${Spawn[${AB_AggroList[${i}]} corpse]} 
               |/echo We have Another Aggroed Mob, ${Spawn[${AB_AggroList[${i}]}].CleanName} with ${Spawn[${AB_AggroList[${i}]}].PctHPs} % hps. 
               /target ${Spawn[${AB_AggroList[${i}]}]} 
               /varset AB_AcquireMobID ${Target.ID} 
               /delay 1s 
               /call Cast ${AB_Slow} 
               /call CombatSub 
            } else { 
            /varcalc i ${i}+1 
            /attack off  
            /varset AB_TargetDead 1 
            /varset AB_Fighting 0 
            /varset AB_CastNow 0 
            |/echo One of the mobs in our aggro list Is now Dead! YEAH! 
            /next AggroLoop 
            |/echo No more mobs on the Aggro List! 
             /return 
            } 
         } 
      
      } 
   } 
   /if (!${AB_TargetDead}) { 
      /goto :CombatLoop 
   } 
   /varset AB_CastNow 0 
/return 

|-------------------------------------------------------------------------------- 
|SUB: Special Combat 
|-------------------------------------------------------------------------------- 
Sub SpecialIt 

   /declare TempID    int inner  0 
   /doevents 
   /if ((${Target.Distance}<11)&&(${Me.AbilityReady["Kick"]})) /doability "Kick" 
    
   /if ((${Int[${Me.PctHPs}]}<50)) { 
      /call Cast "Chloroblast" 
   } 
    
    
/return 


|-------------------------------------------------------------------------------- 
|SUB: Remove Mob From the Aggro List, dead and looted 
|-------------------------------------------------------------------------------- 
Sub RemoveAggroMob 
/declare i int local 1 
/declare iCount int local 1 
/declare AggroLoop   int inner  0 
/declare InnerAggroLoop int inner 0 
/declare temp int local 0 
/for AggroLoop 1 to ${AB_AggroListTotal} 
   /if (${Target.ID}==${AB_AggroList[${iCount}]}) { 
       /varset AB_AggroList[${iCount}] UNDEFINED-ARRAY-ELEMENT 
       /varcalc i ${iCalc}+1 
        /for InnerAggroLoop 1 to ${AB_AggroList[${i}]!=NULL 
           /varcalc i ${i}+1 
        /next InnerAggroLoop 
   /varset AB_AggroList[${iCount}] ${AB_AggroList[${i}]} 
   /varset AB_AggroList[${i}] UNDEFINED-ARRAY-ELEMENT 
   /varcalc iCount ${iCount}+1 
   } 
/next AggroLoop 
/varcalc AB_AggroListTotal ${AggroListTotal}-1 
/doevents 
/return 


|-------------------------------------------------------------------------------- 
|SUB: Reset 
|-------------------------------------------------------------------------------- 
Sub ResetSub 
   /call MoveToAnchor 
   /keypress esc 
   /doevents  
   /if (${Me.AltAbilityReady[Paragon of Spirit]}) { 
      /call Cast "Paragon of Spirit" activate 
      /delay 6s 
   } 
   /keypress esc    
   /varset AB_HasTarget 0 
   /varset AB_TargetDead 0 
   /varset AB_Fighting 0 
   /varset AB_CastNow 1 
   /doevents 
/return 
|------------------------------------------------------------------------------- 
|Return to Anchor 
|------------------------------------------------------------------------------- 
Sub MoveToAnchor 
    /declare iCount int local 
    /declare TempMobID int local 
    /declare Element int local 1 
    /declare AB_DistanceTimer int local 30 
    /varset AB_MyXLOC ${Me.X} 
    /varset AB_MyYLOC ${Me.Y} 
    /varset iCount 0 
    /doevents     
    /echo Moving to Anchor at Loc: ${AB_AnchorXLOC}, ${AB_AnchorYLOC}. 

   :AnchorMoveLoop  
    /delay 1 

   :AvoidCheckLoopAnchor 
   /varset TempMobID ${NearestSpawn[npc radius 400 ${AB_AvoidList[${i}]}]} 
   /if (${TempMobID}!=NULL) { 
         /echo OOOPS, avoiding Mob 
         /if (${TempMobID}) { 
            /face nolook ${TempMobID} 
                /if (${Math.Rand[2]}) { 
                   /echo ack 1 
                   /keypress strafe_right hold 
                   /keypress back hold 
                } else { 
                    /echo ack 2 
                    /keypress strafe_left hold 
                    /keypress back hold 
                } 
         /delay ${Math.Calc[${Math.Rand[15]}+30]} 
         /echo ack 3 
         /keypress strafe_right 
         /keypress forward 
         /keypress strafe_left 
         } 
   } 
   /varcalc Element ${Element}+1 
   /if (${AvoidList[${Element}].NotEqual[UNDEFINED-ARRAY-ELEMENT]}) { 
       /goto :AvoidCheckLoopAnchor 
   } 
    |/face nolook loc $(+{AB_AnchorXLoc}),$(+{AB_AnchorYLoc}) 
    /face nolook loc ${AB_AnchorYLOC},${AB_AnchorXLOC} 
    /if (${Math.Distance[${AB_AnchorYLOC},${AB_AnchorXLOC}]}>10) { 
       /keypress forward hold 
   } else { 
       /keypress forward 
       /echo Moved to Anchor at Loc: ${Me.X}, ${Me.Y}. 
        /return 
    } 

    
        
     /if (${AB_DistanceTimer}==1) { 

          /if ((${AB_MyXLOC}==${Int[${Me.X}]})&&(${AB_MyYLOC}==${Int[${Me.Y}]})) { 
               /call HitObstacle 
               /echo hit obstacle? ${AB_MyXLOC},${AB_MyYLOC} = ${Me.X},${Me.Y} ? 
          } 
          /varset AB_MyXLOC ${Int[${Me.X}]} 
          /varset AB_MyYLOC ${Int[${Me.Y}]} 
          /varset AB_DistanceTimer 30    
          |/face nolook loc ${AnchorYLOC},${AnchorXLOC} 
          
          /goto :AnchorMoveLoop 
      } 
    
    /varcalc AB_DistanceTimer ${AB_DistanceTimer}-1 
    /goto :AnchorMoveLoop 
    } 
/echo End Of Anchor Loop 
    /goto :AnchorMoveLoop 
/return 
|-------------------------------------------------------------------------------- 
|SUB: Obstacle Avoidance 
|-------------------------------------------------------------------------------- 
Sub HitObstacle 
   /echo Obstacle hit, moving around it... 
   /keypress forward 
   /keypress back hold 
   /delay ${Math.Calc[${Math.Rand[5]}+6]} 
   /keypress back 
   /if (${Math.Rand[2]}) { 
     /keypress strafe_right hold 
     /keypress forward hold 
   } else { 
     /keypress strafe_left hold 
     /keypress forward hold 
   } 
   /delay ${Math.Calc[${Math.Rand[15]}+12]} 
   /keypress strafe_right 
   /keypress strafe_left 
/return 

|-------------------------------------------------------------------------------- 
|SUB: GM Check 
|-------------------------------------------------------------------------------- 
Sub GMCheck 

   /if (${Spawn[gm].ID}) { 
      /beep 
      /beep 
      /beep 
      
      /echo GM has entered the zone! 
      /echo FUCK HIM but ending the macro... 

      /keypress forward 
      /keypress back 

      /quit 
      /endmacro 
   } 
    
/return 

|-------------------------------------------------------------------------------- 
|SUB: Reading from an INI File 
|-------------------------------------------------------------------------------- 
Sub ReadINI(FileName,SectionName) 

   /echo Attempting to Read Section "${SectionName}" Zone Information from ${FileName}... 
   /delay 1s 
    
   /if (${Ini[${FileName},${SectionName},-1,NO].Equal[NO]}) { 
      /echo "${SectionName}" is not a Valid Section for FILE:${FileName}, ending macro... 
      /delay 1s 
      /return 
   } 
   /declare nValues     int local  1 
   /declare nArray      int local  0 
   /declare KeySet      string local  ${Ini[${FileName},${SectionName}]} 

   :CounterLoop 
   /if (!${KeySet.Arg[${nValues},|].Length}) { 
      /varcalc nValues ${nValues}-1 
      /goto :MakeArray 
   } 
   /varcalc nValues ${nValues}+1 
   /goto :CounterLoop  

   :MakeArray 
   /if (!${nValues}) /return 
   /if (${FileName.Equal["HunterMob.ini"]}&&${nValues}>0) { 
      /echo Declaring Mob Array... 
      /declare AB_MobArray[${nValues}]   string outer 
      /declare AB_MobStats[${nValues}]   string outer 
   } 
   /if (${FileName.Equal["HunterAvoidMob.ini"]}&&${nValues}>0) { 
      /echo Declaring AvoidMob Array... 
      /declare AB_AvoidList[${nValues}]  string outer  
   } 
   /for nArray 1 to ${nValues} 
      /if (${FileName.Equal["HunterMob.ini"]}) { 
         /varset AB_MobArray[${nArray}] ${Ini[${FileName},${SectionName},${KeySet.Arg[${nArray},|]},NULL]} 
         /varset AB_MobStats[${nArray}] 0 
      }  
      /if (${FileName.Equal["HunterAvoidMob.ini"]}) { 
         /varset AB_AvoidList[${nArray}] ${Ini[${FileName},${SectionName},${KeySet.Arg[${nArray},|]},NULL]} 
         /echo ${AB_AvoidList[${nArray}]} 
      } 
   /next nArray 
    
   /echo "${SectionName}" Zone Information Read Successfully from ${FileName}... 
   /delay 1s 



    
/return 

|-------------------------------------------------------------------------------- 
|SUB: Display Stats 
|-------------------------------------------------------------------------------- 
Sub DisplayStats 

   /declare nArray  int local  
    
/return 

| ----- Events called by /DoEvents ----- 

Sub Event_GettingHit 

/varset AB_GettingHit 1 
/declare TempMobID int 0 
/declare AggroLoop    int local  0 
/declare OuterAggroLoop int local 0 
/declare iCount int local 1 
/declare i int local 1 
/declare MobX int local 0 
/declare MobY int local 0 
/declare MobsHeading int local 0 
/declare MyHeadingToMob int local 0 
/declare NewAdd int local 0 
/declare temp int local 0 
/for OuterAggroLoop 1 to 20 
   /varset TempMobID ${NearestSpawn[${iCount}, npc radius 40].ID} 
   /if (${TempMobID}==NULL) /return 
   /varset MobX ${NearestSpawn[${iCount}, npc radius 40].X} 
   /varset MobY ${NearestSpawn[${iCount}, npc radius 40].Y} 
   /varset MobsHeading ${NearestSpawn[${iCount}, npc radius 40].Heading.Clock} 
   /varset MyHeadingToMob ${Heading[${MobY},${MobX}].Clock} 
   /varcalc temp ${MyHeadingToMob}-${MobsHeading} 
   /if (${temp}<0) { 
      /varcalc temp ${temp}+12 
   } 
   /if ((${temp}>4)&&(${temp}<8)) { 
      /for AggroLoop 1 to ${AB_AggroListTotal} 
         /if (${TempMobID}==${AB_AggroList[${i}]}) { 
            /varset NewAdd 1 
            |/echo Mob already on list! 
         } 
         /varcalc i ${i}+1 
      /next AggroLoop 
   /if (${NewAdd}==0) { 
      /varcalc i ${i}-1 
      /varset AB_AggroList[${i}] ${TempMobID} 
      /varcalc AB_AggroListTotal ${AggroListTotal}+1 
      /echo ${Spawn[${AB_AggroList[${i}]}].CleanName} added to aggro list! 
      |/call PrintAggroList 
   }      
} 
/varset i 1 
/varcalc iCount ${iCount}+1 
/next OuterAggroLoop 
/varset AB_GettingHit 1 
/return 
____________
END OF CODE




Thanks again.

Edited..
Ok I just tested the code and changed a few things.. ERRORS HAPPEN.. What it does is reads all the stuff then gets my target.. starts running at the target and then has an error and keeps running straight.. Error is..
[MQ2]NULL is at NULL
Unmatched bracket or invalid character following bracket found in index: "
Hunter.mac@240 (MoveToMob): /echo AVOIDING
${Spawn[$TempMobID}].CleanName}
Hunter.mac@119 (Main): /if ($(AB_HasTarget}) /call MoveToMob
[MQ2] AVOIDING NULL].CleanName}
[MQ2] Attacking Mob Now!


I think what it means is theres a code error but I still havnt found it.. I am looking tho.
Last edited by Keiichi on Thu Jun 17, 2004 9:34 am, edited 3 times in total.

ab2304
orc pawn
orc pawn
Posts: 20
Joined: Tue Jun 01, 2004 3:19 pm

Post by ab2304 » Thu Jun 17, 2004 9:24 am

First of all, USE THE CODE function on the board! I will not attempt to read anything without it. If you have a specific question on your code, ask for it in the Macro Help forum. But the best way to to figure out if it runs well is to run it!

Now for your questions in specific. I have added the Anchor code from the bard macro I think? Not sure, but instead of editing down mine (which has many specific customizations), it would probably be easier to use Robdawg's, and just add the anchor code from mine. Just set up the anchor values before the main sub. Copy and Paste the entire Sub MoveToAnchor (except get rid of the avoid mob code). And put a call to it where-ever you want. Run it a few times, figure out whats going on, and what you did wrong, attempt to fix it, run it again, do the same. You will start to figure out whats going on with the code.

The whole process will take some time to figure out, but once you get it down, you can custimize any code you come across. If you dont want custom code anything, dont expect to have anything but these basic macros that are posted here.

kyle
a ghoul
a ghoul
Posts: 149
Joined: Thu Aug 26, 2004 7:08 pm

Doing something wrong

Post by kyle » Sun Aug 29, 2004 3:27 pm

Ok I am in East Commonland lvl 65 BL. just wanted to test this out without making any changes.. I copied all the files to the same dir as where bsthunter.mac is. When i run the macro I get

Attempting to Read Section "East Commonlands" Zone Information from HunterMob.ini...
Unparsable in Calculations: 'g'
bsthunter.mac@746 (ReadINI(FileName,SectionName)): /if($(FileName.Equal["HunterMob.ini"}}&&$(nValues}>0){bsthunter.mac@63 (Main): /call ReadINI HunterMob "$(Zone.Name}"

The macro has ended.
Failed to parse /if condition '(TRUE&&3&gt,0)', non-numeric encountered


Any clue what I am doing wrong. I am not a programmer so i did not change a thing. jsut typed /macro bsthunter

User avatar
Cr4zyb4rd
Plugins Czar
Posts: 1449
Joined: Tue Jul 20, 2004 11:46 am

Post by Cr4zyb4rd » Sun Aug 29, 2004 5:59 pm

You'll find this problem a lot with "older" macros. You'll need to search and replace all occurances of > with > (greater-than) and < with < (less-than) in the macro. You also might want to check out some of the more recently updated hunter macros (though this one may well be as good or better...I've never used a hunter) which shouldn't have this problem.