#IsSpellInRange()

18 messages · Page 1 of 1 (latest)

tropic pumice
#

Does this just not work for Mind Flay(15407) and Mind Spike(73510)? It continues to return nil, but will return 1 for Shadow Word: Pain(589) and Vampiric Touch(34914)

rain fiber
#

Do you know those spells when you test?

tropic pumice
#

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

sullen stone
#

Works fine for me, did you double check for typos?

tropic pumice
#

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

tropic pumice
#

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

rain fiber
#

did you try a default spell trigger with a default condition?

tropic pumice
#

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

sullen stone
#

It looks like default triggers can do anything you're trying to do

tropic pumice
#

I'm just trying to learn where i messed up