The majority of this macro is from Grimjacks hunter.mac (http://macroquest2.com/phpBB2/viewtopic.php?t=2313)
I wanted to modify his macro for a high level shadowknight. The macro is SUPPOSED to...
- Check for a GM in the zone, if there is one end the macro etc
- Click a hotkeyed circlet of shadow
- Target one of the mobs you are hunting
- if the mob is under 99% hp it will get another target so you dont KS
- Move to the mob and begin combat
- Attempt to snare the mob until it is snared
- If you get blow 50% hp feign death and end the macro
- Loot the mob
- Keep items you want
- Destroy the rest
- Repeat
Things to fix...
- If you are attacked by another mob not on your hunt list, kill and loot
- If snare or invisibility wear off recast
- Check that Feign was a success
Please post any ideas or code fixes and help me make this a more well rounded macro. And thank you Grimjack for such a powerful base to work with
Code: Select all
| SKhunter.mac
| v1.0
|
| Script made from Grimjack's hunter.mac and modified for a level 65 shadow knight.
| Thank you grimjack for such a wonderful script.
|
| Shadow Knight hunt script with loot for new loot parser.
| As always much of this script is inspired or taken directly from
| pieces of macro's found at macroquest2.com's macro depot
| Thank you to all the people who have donated their scripts which
| made this possible. And thank you to the MQ developers.
|
| Edit /varset a(1,0) "silk" and /varset a(1,1) "skin"
| Also edit /varset a(2,0) "widow" and /varset a(2,1) "wolf"
| You can also make these arrays bigger. If you want to search for
| wolfs, widows and orcs you would have this
| /varset a(2,0) "widow"
| /varset a(2,1) "wolf"
| /varset a(2,2) "orc"
| /varset MobArraySize 3
| This picks a random number based on MobArraySize to pick which
| Type of mob it will chose from the array.
|
| What type of loot you want can be expanded in a similar way to
| the mobs you want to hunt. Just add your array entry and update
| /varset LootTotal 2 to be /varset LootTotal [# of loot entries]
|
| Another thing, for the code to actualy destroy items you don't want to
| keep you must have fast item destroy turned on in the game. I would
| test the script for a while on your machine before doing this. It would
| really suck if it picks up your Eyepatch of Plunder and destroies it
| due to a bug.
|
| This script uses the spells "Festering Darkness" and Feign Death. For it to work
| Feign Death or Death Peace needs to be your first spell gem and Festering Darkness
| needs to be your second spell gem. Also this script uses a circlet of shadow that is
| hotkeyed please modify as needed.
#define MyXLOC v40
#define MyYLOC v41
#define KSRadius v42
#define NotSee v43
#define TooFar v44
#define MyTarget v45
#define TargetDead v46
#define HasTarget v47
#define ObstCount v49
#define LootSlot v50
#define CheckLoot v51
#define LootTotal v52
#define MobArraySize v53
#define UseCamo v54
#define IsSnared v55
#define DefKeep v56
#event Snared "is engulfed by a festering darkness."
Sub Main
/zapvars
/press esc
/press esc
/press alt
/press shift
/press ctrl
/varset LootSlot 0
/varset CheckLoot 0
/varset a(1,0) "silk"
/varset a(1,1) "skin"
| Add as many of these as you want but make sure you
| increase LootTotal
/varset a(2,0) "widow"
/varset a(2,1) "wolf"
| Add as many of these as you want but make sure you
| increase MobArraySize
/varset LootTotal 2
/varset KSRadius 60
/varset HasTarget 0
/varset ObstCount 0
/varset MobArraySize 2
| Change UseCamo to "FALSE" if you do not want to use invisibility
/varset UseCamo "TRUE"
/varset DefKeep "TRUE"
/varset IsSnared "FALSE"
:Start
/call GMAlert
/if "$UseCamo"=="TRUE" {
/mouseto hotkey 6
/click right
}
/call GetTarget
/if $HasTarget=="1" /call MoveToMob
/if $HasTarget=="1" /call CheckKs
/if $HasTarget=="1" /call CombatSub
/if $HasTarget=="1" /call MoveToMob
/if $HasTarget=="1" /call LootMob
/call ResetSub
/goto :Start
/return
sub GMAlert
/alert add 1 pc GM
/target alert 1
/if $target()!=FALSE {
/endmacro
/unload
/q
}
/return
sub GetTarget
:Aquire
/target nopcnear $KSRadius npc "$a(2,$rand($MobArraySize))"
/varset MyTarget $target(id)
/varset TargetDead 0
/if n $target(id)==0 /goto :Aquire
/if $target()=="FALSE" /goto :Aquire
/if n "$target(hp,pct)"<="99" /goto :Aquire
/varset HasTarget 1
/return
sub MoveToMob
/delay 2s
/varset MyXLOC $char(x)
/varset MyYLOC $char(y)
/if n $target(distance)<=20 {
/face fast nopredict
/return
}
/sendkey down up
:Movementloop
/varadd ObstCount 1
/if $target()=="FALSE" {
/varset HasTarget 0
/return
}
/face fast nopredict
/if n $target(distance)<=20 {
/face fast
/sendkey up up
/return
}
/if $ObstCount>=3 {
/call CheckObst
/goto :Movementloop
}
/if n $target(distance)>20 /goto :MovementLoop
/return
sub CheckKS
/if $target()=="FALSE" {
/varset HasTarget 0
/return
}
/target nopcnear $KSRadius npc "$MobToHunt"
/if $target(id)!=$MyTarget {
/echo Target $target(id) and MyTrgId $MyTarget does not match
/echo Starting fresh with new target.
/varset HasTarget 0
/return
}
/return
sub CombatSub
/if $target()=="FALSE" {
/varset HasTarget 0
/return
}
/attack on
:combatloop
/face fast nopredict
/doevents
/call Feign
/if "$IsSnared"=="False" /call Snare
/if n $target(distance)>20 {
/sendkey down up
/goto :combatloop
}
/if n $target(distance)<=20 /sendkey up up
/face fast nopredict
/if n $target(id)==0 /varset TargetDead 1
/if n $TargetDead!=1 /goto :combatloop
/delay 1s
/target corpse
/return
sub LootMob
/loot
/delay 2s
:lootloop
/if n $LootSlot==0 /click left corpse $LootSlot
/if n $LootSlot==1 /click left corpse $LootSlot
/if n $LootSlot==2 /click left corpse $LootSlot
/if n $LootSlot==3 /click left corpse $LootSlot
/if n $LootSlot==4 /click left corpse $LootSlot
/if n $LootSlot==5 /click left corpse $LootSlot
/if n $LootSlot==6 /click left corpse $LootSlot
/if n $LootSlot==7 /click left corpse $LootSlot
/if n $LootSlot==8 /click left corpse $LootSlot
/if n $LootSlot==9 /goto :doneloot
/delay 1
/if "$cursor()"!="NULL" {
/call ItemSort
/delay 1
/varadd LootSlot 1
/goto :lootloop
}
:doneloot
/varset LootSlot 0
/call ItemSort
/delay 5
/return
sub ItemSort
/varset LoopCount 0
:itemchecker
/if "$cursor(name)"~~"$a(1,$LoopCount)" {
/if "$DefKeep"=="TRUE" {
/click left auto
} else {
/click left destroy
}
/delay 5
}
/varadd LoopCount 1
/if "$cursor()"!="NULL" {
/if n $LoopCount<$LootTotal /goto :itemchecker
}
/if "$cursor()"!="NULL" {
/if "$DefKeep"=="TRUE" {
/echo Destroying: << $cursor(name) >>
/click left destroy
} else {
/echo Keeping: << $cursor(name) >>
/click left auto
}
/delay 5
}
/return
sub ResetSub
/sendkey up up
/press esc
/press esc
/press alt
/press shift
/press ctrl
/varset CheckLoot 0
/varset HasTarget 0
/varset ObstCount 0
/varset IsSnared "FALSE"
/delay 1s
/return
sub CheckObst
/if n $MyXLOC==$char(x) /if n $MyYLOC==$char(y) /call HitObst 5
/varset MyXLOC $char(x)
/varset MyYLOC $char(y)
/varset ObstCount 0
/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
sub Snare
/if $target()=="TRUE" {
/face fast nopredict
/cast 2
}
/return
sub Feign
/if n "$char(hp,pct)"<="50" {
/attack off
/cast 1
/cast 1
/cast 1
/endmacro
}
/return
Sub Event_Snared
/varset IsSnared "TRUE"
/return


