What's wrong in here? Keep getting a nil error, have I missed something? Rep+ for any help
PHP Code:
local PlayerHP = 100 * UnitHealth("player") / UnitHealthMax("player")
if UnitAffectingCombat("player") then
--Lay on Hands
if PlayerHP <= 20 and PQR_SpellAvailable(633) then
CastSpellByName(GetSpellInfo(633), "player")
end
--Ardent Defender
if IsSpellKnown(31850) then
if PlayerHP <= 15 and UnitPower("player", 9) <= 3 and not PQR_SpellAvailable(633) and
CastSpellByName(GetSpellInfo(31850), "player")
end
end
--Word of Glory
if (select(2, GetSpecializationInfo(GetSpecialization()))) == "Protection" then
if PlayerHP <= 50 and UnitPower("player", 9) >= 3 then
CastSpellByName(GetSpellInfo(85673), "player")
end
end
--Lightwell
if PQR_LightwellTimeout == nil then
PQR_LightwellTimeout = 0
end
if PlayerHP < 70 and UnitBuffID("player", 7001) == nil then
if PQR_LightwellTimeout < GetTime() then
if UnitDebuffID("player", 108220) == nil then
PQR_LightwellTimeout = GetTime() + 1
InteractUnit("Lightwell")
end
end
end
--End of Combat Check
end
--Sacred Shield, Left Ctrl Key Down
if IsLeftControlKeyDown() and UnitBuffID("player", 642) == nil then
CastSpellByName(GetSpellInfo(20925), "player")
end
end
edit: The rotation works fine if I take this ability out so I'm pretty sure this is the culprit.
Code for SancWrath check
PHP Code:
if (select(2, GetSpecializationInfo(GetSpecialization()))) == "Protection" then
if UnitDebuffID("player", 114232) and PQR_SpellAvailable(20271) then
return false
end
end