I understand what your saying about spell IDs, but how do you go in reverse? Say I want to know what spell is ID 1459?
Sometimes google works, but sometimes not. You can't just look at the code and know what's there unless it's commented, and it wasn't.
Code-wise, I really don't know what I'm doing. I'm just hacking together bits from the code that's already there, and seeing if it works. As I recall, one class had offensive and defensive checks at one point, and I just copied that format.
Oh, I feel I should mention that this will only add offensive/defensive range checks, it won't fix the fact that un-flagged enemy players and some NPCs will always evaluate as out of range. This is especially distracting, but mostly on the un-flagged players.
The RangeCheck function USED to display all in-range things as, well, in-range (after fixing it, that is) I don't know exactly how the function has changed, but now only things you can cast on are treated as in-range. I don't know how to fix this.
It seems RangeCheck has become more of a "can I affect this target" as opposed to a "range to target". Ugg.
Ok, I think I managed to fix it once again, though it was a real pain to look up all the spell IDs
The basic goal here is to make the offensive range at the range of your speced offensive spell, while the defensive range to be that of 40 yards. This ensures that you are near healers and such. Also, this should work for characters level 19 and above to accomidate twinks. (Not sure if speced range is calculated, but if not, there's nothing I can do about it.)
Below is a segment of code you can use to replace the default. I have removed the short and long range thresholds and just went with the long one, as I just found it to make the situation more confusing. Some may argue that there is benefit to this, but strangely only Locks and Mages have this built in. If the argument is that it is indeed usefull, then just about every class should get it, no?
There are a couple problems for Pallys, Hunters, and Locks.
Pallies have little offence greater than 10 yards, and keeping targets faded until 10 yards seems like a poor choice. Exorcism may be a possibility, but that appears at level 20 and not sure if the range check will work against all enemies or just undead and demons.
Locks have no deffnsive spell at 40 yards, so the 30 yard buffs will have to do.
Not sure what to do about Hunters as they have no suitable defensive spells.
Also, it is necessary to manualy swap out some spells to use your speced range.
For instance, if you're a forst mage, fireball is an innappropriate range check, and vice versa.
I'm not currently sure how Rogues and Warriors are handled.
It's not fully tested, (seems to work on my mage) but for what it's worth here is the code to use.
if class == "PRIEST" then
distanceCheckFunction = function(unit) return IsSpellInRange(GetSpellInfo(2050), unit) == 1 or IsSpellInRange(GetSpellInfo(589), unit) == 1 end
elseif class == "DRUID" then
distanceCheckFunction = function(unit) return IsSpellInRange(GetSpellInfo(5176), unit) == 1 or IsSpellInRange(GetSpellInfo(5185), unit) == 1 end
elseif class == "PALADIN" then
distanceCheckFunction = function(unit) return IsSpellInRange(GetSpellInfo(879), unit) == 1 or IsSpellInRange(GetSpellInfo(635), unit) == 1 end
elseif class == "SHAMAN" then
distanceCheckFunction = function(unit) return IsSpellInRange(GetSpellInfo(403), unit) == 1 or IsSpellInRange(GetSpellInfo(331), unit) == 1 end
elseif class == "WARLOCK" then
distanceCheckFunction = function(unit) return IsSpellInRange(GetSpellInfo(172), unit) == 1 or IsSpellInRange(GetSpellInfo(5697), unit) == 1 end
elseif class == "MAGE" then
distanceCheckFunction = function(unit) return IsSpellInRange(GetSpellInfo(116), unit) == 1 or IsSpellInRange(GetSpellInfo(1459), unit) == 1 end
elseif class == "HUNTER" then
distanceCheckFunction = function(unit)
return IsSpellInRange(UnitIsUnit(unit, "pet") == 1 and GetSpellInfo(136) or GetSpellInfo(75), unit) == 1 or CheckInteractDistance(unit, 4)
I've noticed that the RangeCheck for Pitbull is still broken. Strangely, changes seem to be made to that part of the code now and then, but the really big issues seem to never get fixed.
I did a search, and have noticed that other users have also pointed out these problems, and every post I checked had gotten no answers, or even any acknowledgment. Why is this?
Basically, here are the main problems:
1) Most classes only get offensive OR defensive range checks - but not both
2) The Mage class has two offensive ranges and they don't seem to match my spells.
3) The Priest class uses the wrong heal spell to check - it's not available until level 20
4) Whoever designed it seems to have forgotten that RangeCheck is very useful for situational awareness (who is close to you and such - friend and foe alike) but without range check working for both friend and foe it becomes useless for this.
Instead, there seems to be an attempt to make range check be sensitive to multiple spells, and it doesn't work as well for this. Witness the short-range and long-range threshold, despite the face that most classes have more than just two spell ranges.
So on my druid, all enemies appear in range, and all non-healable NPCs appear out of range. It uses a heal spell to check and has no offensive spell. So basically, I have no idea how close anyone is. Please don't assume I'm resto.
On my mage, when the long-range threshold triggers i'm still not in range for frostbolt. Huh? Then at some point a short-range threshold triggers - not sure what spell this short range is keying off of. But having three fade vales is making situational awareness more muddled, not less.
If I go into a BG, I want to know what friendlies are in range on the raid frames, and if any raid members are targeting something, I also want to know if those targets are near or far from me. This makes it easy to focus on the players that are relevant to my immediate tactical situation.
The default setup makes this impossible for some classes.
I used to be able to fix all the problems by changing the code myself. But now it no longer uses spell names and refers to them by a number, and won't accept my changes anymore. Why is the code getting more obfuscated?
So, here are four basic questions:
1) Why is RangeCheck set up so silly? Is there some rationale behind this?
2) Wouldn't it be simpler and clearer to make friendly and enemy units have a single threshold at your max primary spell range? Or simply at 30 yards if no spells? This way it doesn't matter if your offensive or defensive - you know what friends and enemies are in your immediate area, and ranged classes know where their exact max range is.
3) On the harder end, why not give the user the option of picking any particular spell to be used for a range check? (e.g. x-pearl unit frames) maybe seperate picks for offensive and defensives spells, or even multiple spell options for your short and long thresholds.