#IsSpellInRange()
18 messages · Page 1 of 1 (latest)
Do you know those spells when you test?
yes
testing was done w/ Mind Spike while it was learned
I found a crazy work around...im not thrilled with it but was curious if others return the same result
Works fine for me, did you double check for typos?
Yes, many times
my work around is setting it to an action bar and verifying target is hostile and IsActionUsable() to get around IsSpellInRange()
im confounded i even ran a test with the same code for 2 spells and got different results
Here is my debug script, can someone tell me where my mistake is?
function()
-- Spell names and IDs for testing
local mindSpikeSpellName = "Mind Spike"
local vampiricTouchSpellName = "Vampiric Touch"
local mindSpikeSpellID = 73510 -- Mind Spike spell ID
local vampiricTouchSpellID = 34914 -- Vampiric Touch spell ID
-- Ensure target exists
if not UnitExists("target") then
print("No valid target")
return
end
-- Check if target is an enemy and can be attacked
if not UnitIsEnemy("player", "target") or not UnitCanAttack("player", "target") then
print("Target is not a valid enemy")
return
end
-- Check if the player knows the spells
if not IsPlayerSpell(mindSpikeSpellID) then
print("Player does not know Mind Spike")
return
end
if not IsPlayerSpell(vampiricTouchSpellID) then
print("Player does not know Vampiric Touch")
return
end
-- Check IsSpellInRange for both spells using names
local mindSpikeInRange = IsSpellInRange(mindSpikeSpellName, "target")
local vampiricTouchInRange = IsSpellInRange(vampiricTouchSpellName, "target")
print("IsMindSpikeInRange:", mindSpikeInRange)
print("IsVampiricTouchInRange:", vampiricTouchInRange)
end
did you try a default spell trigger with a default condition?
I did everything I could think of, everything looks right but it will always return nil
Im not great at LUA if im being honest
but any other spell, besides Mind Flay, will return the expected value
it seems others are not expereincing the same thing so it has to be local to me
It looks like default triggers can do anything you're trying to do
I'm just trying to learn where i messed up