• Dear Guest,

    You're browsing our forum as a Guest meaning you can only see a portion of the forum in read-only mode.
    To view all forum nodes and be able to create threads/posts please register or log-in with your existing account.

    TwinStar team

Recasting after rez... Not working

Malkaviano

New Member
Joined
Jul 9, 2015
Posting the code, CastSpell works with /script but not inside the addon.

Code:
local DeathRecast = {};DeathRecast.Spell = "Find Minerals";


local function FindSpell(spell)
    local i = 1;
    
    while true do
        local spell, rank = GetSpellName(i, BOOKTYPE_SPELL);
       
       if (not spell) then
          return 0;
       end
       
        if (spell == DeathRecast.Spell) then
            return i;
        end
        
        i = i + 1;
    end
end


local function ShowSpells()
    local i = 1
    while true do
       local spell, rank = GetSpellName(i, BOOKTYPE_SPELL)
       if (not spell) then
          break
       end
       if (rank) then
          spell = spell.." ("..rank..")"
       end
       DEFAULT_CHAT_FRAME:AddMessage(i..": "..spell)
       i = i + 1
    end
end


function DeathRecast_Load()
     this:RegisterEvent("PLAYER_UNGHOST");
end


function DeathRecast_OnEvent()
    if event == "PLAYER_UNGHOST" or "PLAYER_ALIVE"  then
        local n = FindSpell("Find Minerals");
        CastSpell(n, BOOKTYPE_SPELL);
    end
end
 
Top Bottom