NearestSpawn not working for npc

Coranda

Premium Member
Joined
Apr 5, 2019
Messages
11
Reaction score
3
Points
3
I have a script which I've been using for a few weeks. I'm having an issue in the script where it tries to find my next target.

I'm using ${NearestSpawn[npc].ID} which is returning the id for a mob for which I don't want to fight.

I'm doing ${NearestSpawn[npc].Next.ID} to get the next npc but I'm getting the id for one of my characters. It appears that the 'Next' isn't taking into account my Spawn search arguments.

Anyone else noticing this issue?
 
I think this expected behavior.

TLO:NearestSpawn - MacroQuest Wiki

You want to use ${NearestSpawn[1,npc].ID} to get closest and ${NearestSpawn[2,npc].ID} to get the next closest.

You may want to look into using "alerts". They can make your logic a lot easier.

Alert - MacroQuest Wiki

For example you can have your macro code ignore all vampires by using the follow:

/alert 1 add npc vampire
/echo ${NearestSpawn[1,npc noalert 1].ID}