Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
ok so I want a hunter macro that will repeat: /tar <mob name>; /nav target; kill. can someone who is savy to code help me out here? (I'm completely code illiterate but a quick study)
Sub Main
/delcare mobname string local "Mob Name Goes Here"
/while (1) {
/if (${Spawn[npc ${mobname}}) {
/nav npc ${mobname}
/delay 3s ${Navigation.Active}
/while (${Navigation.Active}) {
/if (${Spawn[npc ${mobname}].Distance3D} > 15) {
/delay 5
} else {
/break
}
}
/if (${Spawn[npc ${mobname}]} < 15) {
/call Attack
}
}
}
/return
Sub Attack
if (!${Me.Combat}) {
/target npc ${mobname}
/squelch /face fast
/echo Attacking ${Target.Name}
/squelch /attack on
} else /if (${Target.Type.Equal[corpse]}) {
/echo Target is a corpse, Clearing our target.
/target clear
}
/return
Sub Main
/declare index int inner
/declare mobs_to_hunt[20] string outer
/declare mobs_to_hunt_count int outer 0
/declare closest_mob_id int inner
/if (${Macro.Params}) {
/for index 0 to ${Math.Calc[${Macro.Params}-1]}
/if (${Defined[Param${index}]}) {
/varcalc mobs_to_hunt_count ${mobs_to_hunt_count}+1
/varset mobs_to_hunt[${mobs_to_hunt_count}] ${Param${index}}
}
/next index
}
/if (${mobs_to_hunt_count}) {
/echo Hunting for the following mobs:
/for index 1 to ${mobs_to_hunt_count}
/echo ${mobs_to_hunt[${index}]}
/next index
} else {
/echo No mobs specified, hunting all mobs.
}
:get_next_mob
/if (${mobs_to_hunt_count}) {
/call FindClosestMob
/varset closest_mob_id ${Macro.Return}
} else {
/varset closest_mob_id ${NearestSpawn[npc targetable noalert 1].ID}
}
/if (${closest_mob_id}==0) /goto :wait_for_mob
/echo Going to kill ${closest_mob_id}
:get_to_mob
/nav id ${closest_mob_id}
/delay 2 ((${Nav.Active}==TRUE)
/delay 120s (${Nav.Active}==FALSE)
/echo OK, we should be there now...
/target NPC id ${closest_mob_id}
/delay 5 (${Target.ID})
/if (${Target.ID}==NULL) {
/echo Lost our target, getting another...
/goto :get_next_mob
}
/attack on
/pet attack
/nav target
/face
/delay 120s (${Target.ID}==NULL)
/goto :get_next_mob
:wait_for_mob
/delay 5s
/goto :get_next_mob
}
/end
Sub FindClosestMob
/declare index int local
/declare mob_id int local
/declare closest_mob_dist float local 100000
/declare closest_mob_id int local 0
/for index 1 to ${mobs_to_hunt_count}
/call FindClosestMatchingMob ${mobs_to_hunt[${index}]}
/varset mob_id ${Macro.Return}
/if (${mob_id}) {
/if (${Navigation.PathLength[id ${mob_id}]} < ${closest_mob_dist}) {
/varset closest_mob_dist ${Navigation.PathLength[id ${mob_id}]}
/varset closest_mob_id ${mob_id}
}
}
/next index
/return ${closest_mob_id}
Sub FindClosestMatchingMob(string match)
/declare mob_index int local
/declare mob_count int local
/declare mob_id int local
/declare closest_mob_dist float local
/declare closest_mob_id int local
/varset mob_count ${SpawnCount[npc ${match} targetable noalert 1]}
/echo There are ${mob_count} mobs matching ${match}
/varset closest_mob_dist 100000
/varset closest_mob_id 0
/for mob_index 1 to ${mob_count}
/varset mob_id ${NearestSpawn[${mob_index}, npc ${match} targetable noalert 1].ID}
/if (${Navigation.PathExists[id ${mob_id}]}) {
/if (${Navigation.PathLength[id ${mob_id}]} < ${closest_mob_dist}) {
/varset closest_mob_dist ${Navigation.PathLength[id ${mob_id}]}
/varset closest_mob_id ${mob_id}
}
}
/next mob_index
/if (${closest_mob_id}) {
/echo I think the closest mob is ${closest_mob_id} @ ${closest_mob_dist}
} else {
/echo No mobs...
}
/return ${closest_mob_id}