I noticed that my ench was failing to Mez properly in Jewel of Atiiki in some situations. After digging into the issue, I saw the problem was due to the scarab traps inside the pyramids (a swarm of ~4 scarabs appear for a few seconds, and then disappear without a trace!).
After debugging the issue I saw this is caused by the fact that the only code in KA which currently 'cleans up' the MezArray is in the CombatReset code (i.e. after the mob is dead). The trap spawns were never dying and hence were just being left in the MezArray causing problems!
I also manually charm pets with my enchanter and noticed that the pet is being left in the MezArray on a charm break (Not the end of the world, but not ideal).
To fix the issue, I changed the MezRadar sub to validate the MezArray like the following. Not sure if this is the best approach, but it works fine for me. (Possibly a better approach is a more extensive check to ensure the mob in the MezArray is still (i) Close to you (didnt warp/gate/leash home) (ii) Has agro on you (i.e. could be charmed by a different party member))
After debugging the issue I saw this is caused by the fact that the only code in KA which currently 'cleans up' the MezArray is in the CombatReset code (i.e. after the mob is dead). The trap spawns were never dying and hence were just being left in the MezArray causing problems!
I also manually charm pets with my enchanter and noticed that the pet is being left in the MezArray on a charm break (Not the end of the world, but not ideal).
To fix the issue, I changed the MezRadar sub to validate the MezArray like the following. Not sure if this is the best approach, but it works fine for me. (Possibly a better approach is a more extensive check to ensure the mob in the MezArray is still (i) Close to you (didnt warp/gate/leash home) (ii) Has agro on you (i.e. could be charmed by a different party member))
Rich (BB code):
Sub MezRadar
/if ((${DMZ} && ${Me.InInstance}==FALSE)) /return
/if (${DebugMez}) /echo \atDEBUG MezRadar Enter \agLine#: ${Macro.CurLine}
/declare NMMob int local 0
/declare i int local
/varset MezMobCount 0
/varset MezMobAECount 0
/varset MezAEClosest 0
/for i 1 to 13
/if (${DebugMez}) /echo \atDEBUG MezRadar: ${i} ${Me.XTarget[${i}].ID} && ${Me.XTarget[${i}].TargetType.Equal[Auto Hater]} && ${Me.XTarget[${i}].Type.Equal[NPC]} \agLine#: ${Macro.CurLine}
/if (${Me.XTarget[${i}].ID} && ${Me.XTarget[${i}].TargetType.Equal[Auto Hater]} && ${Me.XTarget[${i}].Type.Equal[NPC]}) {
/varset NMMob ${Me.XTarget[${i}].ID}
/varcalc MezMobCount ${MezMobCount}+1
| Setup closest mob for AE mez target necros can't aemez
/if (${Select[${Me.Class.ShortName},BRD,ENC]}) {
/if (!${MezAEClosest} && ${Spawn[${NMMob}].Distance}<=${MezRadius}) /varset MezAEClosest ${NMMob}
/if (${MezAEClosest} && ${Spawn[${NMMob}].Distance}<${Spawn[${MezAEClosest}].Distance} && ${Spawn[${NMMob}].Distance}<=${MezRadius}) /varset MezAEClosest ${NMMob}
/if (${Spawn[${NMMob}].Distance}<=${MezRadius}) /varcalc MezMobAECount ${MezMobAECount}+1
}
/if (${DebugMez}) /echo \atDEBUG MezRadar: MezMobCount ${MezMobCount} ${NMMob} \agLine#: ${Macro.CurLine}
/if (${NMMob} && (${Spawn[${NMMob}].Type.Equal[Corpse]} || !${Spawn[${NMMob}].ID} || ${Spawn[${NMMob}].Distance}>${MezRadius})) /call RemoveFromArray MezArray ${Select[${NMMob},${MezArray[1,1]},${MezArray[2,1]},${MezArray[3,1]},${MezArray[4,1]},${MezArray[5,1]},${MezArray[6,1]},${MezArray[7,1]},${MezArray[8,1]},${MezArray[9,1]},${MezArray[10,1]},${MezArray[11,1]},${MezArray[12,1]},${MezArray[13,1]}]}
/if (${MezMobCount}>0 && ${Select[${NMMob},${MezArray[1,1]},${MezArray[2,1]},${MezArray[3,1]},${MezArray[4,1]},${MezArray[5,1]},${MezArray[6,1]},${MezArray[7,1]},${MezArray[8,1]},${MezArray[9,1]},${MezArray[10,1]},${MezArray[11,1]},${MezArray[12,1]},${MezArray[13,1]}]}==0) {
/if (${DebugMez}) /echo \atDEBUG MezRadar: ADDING -> Name: ${Spawn[${NMMob}].Name} ID: ${NMMob} to mezlist \agLine#: ${Macro.CurLine}
/call AddToArray MezArray ${NMMob}
}
/varset NMMob 0
}
/next i
|WhoDunIt Mod start - Loop through MezArray and remove agro mobs when they disappear without dying (e.g. trap spawns in Jewel of Atiiki, or when you charm a mob)
/for i 1 to 13
/if (${MezArray[${i},1].Equal[NULL]}) {
/if (${DebugMez}) /echo MezArray ${i} MezArray[${i},1] was equal to NULL, Continue.\agLine#: ${Macro.CurLine}
/continue
}
/if (${MezArray[${i},3].Find[corpse]} || !${Spawn[${MezArray[${i},1]}].ID}) {
/if (${DebugMez}) /echo MezArray ${i} ${MezArray[${i},3]} is dead or no longer exists, Removing the ID from MezArray. \agLine#: ${Macro.CurLine}
/call RemoveFromArray MezArray ${Select[${MezArray[${i},1]},${MezArray[1,1]},${MezArray[2,1]},${MezArray[3,1]},${MezArray[4,1]},${MezArray[5,1]},${MezArray[6,1]},${MezArray[7,1]},${MezArray[8,1]},${MezArray[9,1]},${MezArray[10,1]},${MezArray[11,1]},${MezArray[12,1]},${MezArray[13,1]}]}
/continue
}
/if (${Me.Pet.ID} && ${MezArray[${i},1]} == ${Me.Pet.ID}) {
/if (${DebugMez}) /echo MezArray ${i} ${MezArray[${i},3]} is my pet, Removing the ID from MezArray. \agLine#: ${Macro.CurLine}
/call RemoveFromArray MezArray ${Select[${MezArray[${i},1]},${MezArray[1,1]},${MezArray[2,1]},${MezArray[3,1]},${MezArray[4,1]},${MezArray[5,1]},${MezArray[6,1]},${MezArray[7,1]},${MezArray[8,1]},${MezArray[9,1]},${MezArray[10,1]},${MezArray[11,1]},${MezArray[12,1]},${MezArray[13,1]}]}
/continue
}
/if (${DebugMez}) /echo MezArray ${i} ${MezArray[${i},3]} ID: ${MezArray[${i},1]} is still alive and considered for Mezzing. \agLine#: ${Macro.CurLine}
/next i
|WhoDunIt Mod end
/if (${DebugMez}) /delay 5
/if (${DebugMez}) /echo \atDEBUG MezRadar: MezMobCount: ${MezMobCount} Leave \agLine#: ${Macro.CurLine}
/return

