I was wondering if I could get some help to finish this. It works, but the problem I am running into is that before the potential target reaches 45% health, the character is constantly targeting and clearing its target.
How can I check the health of a target to determine if I want to target it or not?
Also, I realize this is a mess, so if you have any suggestions to help me clean it up so it isn't such a hack would be appreciated.
How can I check the health of a target to determine if I want to target it or not?
Also, I realize this is a mess, so if you have any suggestions to help me clean it up so it isn't such a hack would be appreciated.
Code:
#turbo 40
Sub Main
:loopstart
/if (${Target.ID}==FALSE) {
/call NewTarget
} else {
/call NextTarget
}
/if (${Target.Distance}>175) {
/target clear
}
/if (${Target.PctHPs}>45) {
/target clear
}
/goto :loopstart
/return
Sub NewTarget
/declare potentialTarget int local ${Spawn[npc radius 175].ID}
/declare i int local 1
:targetLoop
/if (${Spawn[id ${potentialTarget}].Distance}<1) {
/return
}
/if (${Spawn[id ${potentialTarget}].LineOfSight}) {
/target id ${potentialTarget}
/if (${Target.PctHPs}>45) {
/target clear
/return
} else {
/face
/pet kill
} else {
/goto :loopstart
}
/return
Sub NextTarget
/declare potentialTarget int local ${Spawn[npc radius 175].ID}
/declare i int local 1
/if (!${Target.LineOfSight}) {
/target clear
/return
}
/if (${Target.Distance}>175) {
/target clear
/return
} else {
/varset i ${i} + 1
/varset potentialTarget ${NearestSpawn[${i},npc radius 175].ID}
| /delay 35
/return
}
/goto :loopstart
/return