I've been using this to check for single pulls in my automated xp-gain macro. It sucks up some CPU time - on a 1GHZ system with 160 MOBs in zone it takes 2-3 seconds to execute. I'm sure this could be chopped down some (perhaps by storing the target mobs y,x coords in vars instead of dereferencing each iteration..) I've found it acceptable for the few times I use it though. Anyway, I hope someone finds it useful.
Useage: feed it the ID of the NPC you want to check and the radius, ie:
/call SubCheckSinglePull ${Target.ID} 200
Code: Select all
| Title: SubCheckSinglePull (MQ2DATA enabled)
| Author: Landslide
| Date: 2004.04.24 (Last Updated: )
| Desc: Counts the number of NPCs AND PCs near an NPC with the provided ID and radius
Sub SubCheckSinglePull(id,radius)
/declare mobcount local
/declare startid local
/declare currentid local
/declare targetid local
/varset mobcount 0
/varset startid ${Me.ID}
/varset currentid @startid
:SINGLEPULLLOOP
/varset currentid ${Spawn[@currentid].Prev.ID}
/newif (@id==@currentid) /goto :SINGLEPULLLOOP
/newif (!@currentid) /goto :SINGLELOOPEND
/newif (${Spawn[@currentid].Type.Equal[NPC]} || ${Spawn[@currentid].Type.Equal[PC]}) {
/newif (${Math.Distance[${Spawn[id].Y},${Spawn[id].X}:${Spawn[@currentid].Y},${Spawn[@currentid].X}]}<@radius) /varadd mobcount 1
}
/goto :SINGLEPULLLOOP
:SINGLELOOPEND
/return @mobcount

