Code: Select all
| Shadow.mac
| v1.0
|
| This is just a slight modification of the hunter.mac that Grimjack wrote.
| I also used sections of code from genbot which Grimjack also wrote.
| Thank you very much for the original works.
| I had specific goals that hunter.mac didn't fulfill:
|
| 1) Camp Shadowmen and loot all their corpses when they die. (The whole camp aggros when you attack one)
| 2) Move back to a campsite after looting is done
| 3) Rebuff me and my pet at campsite
|
| Script Setup:
|
| 1) Be aware it casts spell 4 during combat.
| 2) You'll probably want to modify the buffs it casts when it returns to camp.
| 3) Modify which way you face after you return to camp based on what zone you're camping.
|
| Running the script:
|
| 1) Summon a pet
| 2) Turn on Walk mode to reduce ping ponging around corpses
| 3) Start the script at the campsite you wish to return to after killing & looting.
|
Sub Main
/declare MobToHunt global
/declare MainArray array2
/declare MyXLOC global
/declare MyYLOC global
/declare KSRadius global
/declare NotSee global
/declare TooFar global
/declare MyTarget global
/declare TargetDead global
/declare HasTarget global
/declare ObstCount global
/declare LootSlot global
/declare CheckLoot global
/declare LootTotal global
/declare MobArraySize global
/declare AnchorX global
/declare AnchorY global
|
| Added a corpse counter
|
/declare CorpseCount global
/press esc
/press esc
/press esc
/press esc
/press alt
/press shift
/press ctrl
/varset LootSlot 0
/varset CheckLoot 0
/varset MainArray(1,0) "essence of shadow"
| Add as many of these as you want but make sure you
| increase LootTotal
/varset MainArray(2,0) "a shadowed man"
| Add as many of these as you want but make sure you
| increase MobArraySize
/varset LootTotal 1
/varset KSRadius 60
/varset HasTarget 0
/varset ObstCount 0
/varset MobArraySize 1
/varset AnchorX $char(y)
/varset AnchorY $char(x)
:Start
|
| We looted all previous corpses, back at campsite, reset corpse counter.
|
/varset CorpseCount 0
/call GetTarget
/if @HasTarget=="1" /call MoveToMob
/if @HasTarget=="1" /call CombatSub
/if @HasTarget=="1" /call MoveToMob
/if @HasTarget=="1" /call LootMob
/call ResetSub
/goto :Start
/return
sub GetTarget
:Aquire
/target nopcnear @KSRadius npc "@MainArray(2,$rand(@MobArraySize))"
/varset MyTarget $target(id)
/varset TargetDead 0
/if n $target(id)==0 /goto :Aquire
/if $target()=="False" /goto :Aquire
/varset HasTarget 1
/varset MobToHunt $target(name)
/return
sub MoveToMob
/delay 2s
/varset MyXLOC $char(x)
/varset MyYLOC $char(y)
/if n $target(distance)<=13 {
/face fast look nopredict
/return
}
/sendkey down up
:Movementloop
/varadd ObstCount 1
/if $target()=="FALSE" {
/varset HasTarget 0
/return
}
/face fast look nopredict
/if n $target(distance)<=13 {
/face fast look nopredict
/sendkey up up
/return
}
/if @ObstCount>=3 {
/call CheckObst
/goto :Movementloop
}
/if n $target(distance)>13 /goto :MovementLoop
/return
sub CombatSub
/if $target()=="FALSE" {
/varset HasTarget 0
/return
}
/attack on
:combatloop
/face fast look nopredict
/cast 4
/delay 2s
/if n $target(distance)>13 {
/sendkey down up
/goto :combatloop
}
/if n $target(distance)<=13 /sendkey up up
/face fast nopredict
/if n $target(id)==0 /varset TargetDead 1
/if n @TargetDead!=1 /goto :combatloop
/sendkey up up
/delay 1s
/target corpse
/lootn never
/delay 2s
/return
sub LootMob
|
| Added a corpse counter
|
:toploot
/varadd CorpseCount 1
/loot
/delay 2s
:lootloop
/if n @LootSlot>=9 /goto :doneloot
/click left corpse @LootSlot
/delay 1s
/if "$cursor()"!="TRUE" /goto :doneloot
:lootChecker
/if "$cursor(name)"~~"@MainArray(1,@CheckLoot)" {
/delay 1s
/click left auto
/delay 1s
/varadd LootSlot 1
/goto :lootloop
}
/varadd CheckLoot 1
/if "$cursor()"=="TRUE" {
/if n @CheckLoot<@LootTotal /goto :lootchecker
}
/if "$cursor()"=="TRUE" {
/delay 1s
/click left destroy
/delay 1s
}
/varadd LootSlot 1
/varset CheckLoot 0
/goto :lootloop
:doneloot
/varset LootSlot 0
/press esc
/press esc
|
| Assuming we killed the first Shadowed Man, Pause 10 seconds to give the pet time
| enough to kill the next one that aggro'd on me, move to the new corpse and loot.
| Usually only 6 or less Shadowed Men at a time in camp.
|
/if n @CorpseCount<6 {
/delay 10s
/target corpse shadowed
/call MoveToMob
/goto :toploot
}
/lootn always
|
| All Corpses are looted, move back to campsite
|
/call MoveToAnchor
|
| Pause for 2 minutes to allow mobs to respawn.
|
/delay 2m
/return
Sub MoveToAnchor
:AnchorMoveLoop
/doevents
/if "$char(state)"=="SIT" /stand
/face loc @AnchorX,@AnchorY
/if n $distance(@AnchorX,@AnchorY)>11 /sendkey down up
/if n $distance(@AnchorX,@AnchorY)<=11 {
/sendkey up up
|
| I know there are some cleaner ways to rebuff and handle fizzles, recast time, etc
| But this is a single purpose macro and I know which spells are in these slots and their recast time
| So I made it fixed for simplicity. Since we rebuff after each camp clearing I don't worry about Fizzles.
|
/face heading 270
/press F1
/delay 1s
/cast item "silken augmenter's pantaloons"
/delay 14s
/cast item "staff of the serpent"
/delay 8s
/cast 3
/delay 8s
/press F1
/cast item "staff of the serpent"
/delay 8s
/cast 2
/delay 9s
/return
}
/goto :AnchorMoveLoop
/return
sub ResetSub
/sendkey up up
/press esc
/press esc
/press esc
/press esc
/press alt
/press shift
/press ctrl
/varset CheckLoot 0
/varset HasTarget 0
/varset ObstCount 0
/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 @Param0
/sendkey up Right
/sendkey down up
/delay 3s
/sendkey up up
} else {
/delay 3s
/sendkey up down
/sendkey down left
/delay @Param0
/sendkey up left
/sendkey down up
/delay 3s
/sendkey up up
}
/sendkey up down
/sendkey up Right
/sendkey up Left
/sendkey down up
/return