Target, stick, kill, loot, repeat

Chatwiththisname

Learning2Code
Joined
Sep 28, 2008
Messages
1,234
Reaction score
54
Points
48
Location
Texas
so i made an auto target macro years ago that used monkbug and targeted nearest npc, /warp /mb on and in this way i was able to clear 500 yellow mobs in under 5 minutes.....moving forward this is no longer a viable option i want to kill and move. so i took and modified this same code to target nearest npc and using mq2melee it would stick to the target and kill it with merc healing. then i got the bright idea to try and loot the corpses as i killed. The resulting code is what I have and the macro worked great till i added the loot sub. please gimmie a hand as i'm not sure why but it seems like there is no wait between calls for getting kill target and looting target. i added echos in each sub to try and see where the issue is and instead just get spam lol

Code:
Sub Main 
   /echo NextTarget created by jesse.bevil@us.army.mil
   /echo Usage: to set unkillable NPC on do not target list type /alert add 1 $ {Target.ID}
   /declare MaxPC int outer 
   /echo Sets MaxPC as Param0, usage is /mac AutoTarget #, where # = MaxPC IE: /mac Autotarget 1, This will say only one PC is allowed in the zone, 
   /echo if more than ${Param0} AutoTarget turns off
   /varset MaxPC ${Param0}
   /Echo ${MaxPC} PC allowed in zone with you
   /hidecorpse looted

:mainloop 
/echo main loop
   /call PCcheck
   /call Loot
   /call TrgtNPC 
/goto :mainloop 


|This is the code used to target the NPC nearest you that is not on the alert list. make a hotkey 
|/alert add 1 id ${Target.ID}
|Target the NPC you want to add to the do not target list IE: Quest NPC, NPC's you can't attack etc and click your hotkey

 
Sub TrgtNPC
/echo trgtnpc
   /stand
   /if (${Target.Type.Equal[corpse]}) /keypress esc
   /if (${Target.Type.Equal[NPC]}) /call Wait
   /squelch /target npc noalert 1
   /if (!${Me.Combat}) /attack on 

/return 

Sub Wait
/echo wait
   /delay 1s
   
   /return

/return

Sub Loot
/echo Looting
/target corpse
:loot
/if (${Target.Type.Equal[Corpse]} && ${Target.Distance}<100) {/stick 5
/if (${Target.Distance}<8) {/advloot
			  /return
			   }
/delay 1s
/goto loot
/return

Sub PCcheck 
/echo pc gm check
/if (${Spawn[gm].ID}) { 
  /echo GM in zone! Macro Paused for 5 minutes, setting afk. 
  /afk On the phone! 
  /delay 5m 
} 
/if (${SpawnCount[pc]}>${MaxPC}1) {  
  /echo PC nearby!
  /echo AutoTarget has been disabled!
  /echo To Many PC's in the Zone, There is now ${SpawnCount[pc]} PC's in the zone with you!
  /delay 2m 
} 
/return 

/end
 
Last edited:
Any particular reason you don't use Pete bot? It kills and loots and targets etc etc
 
Any particular reason you don't use Pete bot? It kills and loots and targets etc etc

Ive been gone for a while. But I enjoy programming. Id like to be able to customize something for myself. Pete wont be there when i decide to make a program unrelated to mq2, the flow of the code is more important than the reason for the code

Code:
Sub Main 
   /echo NextTarget created by jesse.bevil@us.army.mil
   /echo Usage: to set unkillable NPC on do not target list type /alert add 3 id $ {Target.ID}
   /declare MaxPC int outer 
   /echo Sets MaxPC as Param0, usage is /mac AutoTarget #, where # = MaxPC IE: /mac Autotarget 1, This will say only one PC is allowed in the zone, 
   /echo if more than ${Param0} AutoTarget turns off
   /varset MaxPC ${Param0}
   /Echo ${MaxPC} PC allowed in zone with you
   /hidecorpse all
   /hidecorpse looted

:mainloop 
   /call PCcheck
   /call TrgtNPC
   |/call GetCorpse
   |/call LootCorpse
    
/goto :mainloop 


|This is the code used to target the NPC nearest you that is not on the alert list. make a hotkey 
|/alert add 1 id ${Target.ID}
|Target the NPC you want to add to the do not target list IE: Quest NPC, NPC's you can't attack etc and click your hotkey

 
Sub TrgtNPC
   /stand
   /if (${Target.Type.Equal[corpse]}) /keypress esc
   /if (${Target.Type.Equal[NPC]}) /call WaitKill
   /squelch /target npc noalert 1
   /if (!${Me.Combat}) /attack on 

/return 

Sub WaitKill
   /delay 1s
   
   /call TrgtNPC

/return


Sub WaitLoot
/echo waitLoot
   /delay 1s
   
   /call GetCorpse

/return

Sub GetCorpse
/echo Looting
/target corpse noalert 1
/if (${Target.Type.Equal[Corpse]} && ${Target.Distance}<250) /stick 5
/if (${Range.Between[9,250:${Target.Distance}]}) /call WaitLoot
/if (${Target.Type.Equal[Corpse]} && ${Target.Distance}>250)
/return

Sub LootCorpse
/if (${Target.Distance}<8) /advloot
/delay 5

/return

Sub PCcheck 
/echo pc gm check
/if (${Spawn[gm].ID}) { 
  /echo GM in zone! Macro Paused for 5 minutes, setting afk. 
  /afk On the phone! 
  /delay 5m 
} 
/if (${SpawnCount[pc]}>${MaxPC}1) {  
  /echo PC nearby!
  /echo AutoTarget has been disabled!
  /echo To Many PC's in the Zone, There is now ${SpawnCount[pc]} PC's in the zone with you!
  /delay 2m 
} 
/return 

/end

works great without the loot code implemented. glitches up when i use loot calls
 
Last edited:
Edit it so that it uses MQ2Advloot. That way, you can customize the ini so it only loots what you want it to.