View Single Post
04-04-20, 04:42 PM   #1
Shokarta
A Deviate Faerie Dragon
Join Date: Jan 2008
Posts: 11
how to block spell on succeed cast (or remove spell from acitonbar / change actionbar

I'm trying to create script which would block the spell "Explosive Shot" for 2 sec (so the spell will be unclickable or so) when this spell is successfully cast.

EDIT: so far I was only able to check when the Explosive Shot happens and track when I can shot again, if not possible to block the spell (make it unclicable) then I was thinking to remove the icon from action bar so there is actualy nothing to be clicked on, or if you even think up anything else which would prevent to cast again, then Im open to ideas.

So far this is working fine to check when the spell was casted and when can be casted again:

Code:
local myFrame = CreateFrame("Frame");
myFrame:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED");
myFrame:SetScript("OnEvent",
    function(self, event, arg1, arg2, arg3, arg4)
        if (event == "UNIT_SPELLCAST_SUCCEEDED" and arg2 == "Explosive Shot") then

            start_shot()

            local f = CreateFrame("Frame")
            local g = f:CreateAnimationGroup()
            local a = g:CreateAnimation("Animation")
            a:SetDuration(5)
            a:SetOrder(1)
            g:SetLooping("REPEAT")
            g:SetScript("OnLoop", function()

                stop_shot()
                g:Stop()

            end)
            g:Play()

        end
    end
);

function start_shot()

    -- print("CountDown Starts")

end

function stop_shot()

    -- print("CountDown Finishes")

end
EDIT2: or what I think it might be working, is a way to change the all actionbar page (same as you do Shift+1 or Shift+2 ingame), so i can fill the icons same way but leave one with Explosive Shot empty, then there would be nothing to click on actually.

EDIT3: I have tried ChangeActionBarPage() but it works only out of combat. According to this link https://www.wowinterface.com/forums/...ad.php?t=55594 there is a way to do it in combat. can anyone advice how-to please?
  Reply With Quote