I use this for melee in champ spawns... afk away! (this is just a snipper, but I think its along the lines of what you're looking for)
one word of caution... I freaking HATE ignoreitem. much like event property 9 times out of 10, there is a better way.
repeat
event macro 52 5 ;target nearest
set #lpc 1
finditem #ltargetid * g
set #lpc 20
until #finddist < 2
event macro 53
while #ltargetid = #enemyid && #enemyhits > 0 && #finddist < 2
{
if g notin #charstatus
event macro 6 0 ;war toggle
;event macro 53 0 ;attack
wait 5
set #lpc 1
finditem #ltargetid * g
set #lpc 20
}
modified for pets:
repeat
event macro 50 5 ;target next
set #lpc 1
finditem #ltargetid * g
set #lpc 20
until #finddist < 10 && #findid notin #charid , %aListOfYourPetIdsSeperatedWithUnderscores
event macro 1 0 All kill
target
event macro 22 0 ;no need to set ltargetid or kind because 50 5 does it for you
event macro 53 0 ;attack selected - populates #enemyinfo
while #enemyhits > 0 && #finddist < 10
wait 0
event macro All guard me ;or whatever...
you may want to use something other than #finddist, but maybe not. target next/last runs into issues with not being able to pick up things a certain amount of tiles away. not really sure where the break is, but 10 seems to work ok (minor issues) so just make sure to stay within 10 tiles of the target.
MAKE SURE TO ADD OUR PETIDS to the do not kill list...