Pet attack macro?

Post Reply
Zeroanjel
Posts: 1

Pet attack macro?

Post by Zeroanjel » Fri May 26, 2023 2:41 am

is there a macro that we can use to cast a spell and have your pet attack without clicking the attack button?? Thanks

Frosty73
Posts: 1

Re: Pet attack macro?

Post by Frosty73 » Fri May 26, 2023 4:42 am

/script PetAttack(target)

User avatar
Jolikmc
Posts: 486
Location: United States
Likes: 1 time
Contact:

Re: Pet attack macro?

Post by Jolikmc » Fri May 26, 2023 5:21 am

Here are all the normal pet hotkeys in Vanilla macro format:

Code: Select all

PetAggressiveMode() - Set your pet in aggressive mode.
PetAttack()         - Instruct your pet to attack your target.
PetStopAttack()     - Stop the attack of the pet.
PetDefensiveMode()  - Set your pet in defensive mode.
PetFollow()         - Instruct your pet to follow you.
PetPassiveMode()    - Set your pet into passive mode.
PetWait()           - Instruct your pet to remain still.
And here's a couple of random examples of what you're asking for:

Use Wand + Pet Attack

Code: Select all

/run --CastSpellByName("Shoot")
/run PetAttack(); CastSpellByName("Shoot") end
Cycle Immolate, Corruption, and Shadow Bolt + Pet Attack

Code: Select all

/run --CastSpellByName("Immolate")
/run PetAttack(); local c=CastSpellByName; if IsShiftKeyDown() or n==0 then c("Immolate") n=1; elseif n==1 then c("Corruption") n=2 else c("Shadow Bolt") end
(You have to hold Shift to reset the "castsequence" counter on this one.)
Not currently playing. Just skulking and snarking~

Malfiouss
Posts: 2

Re: Pet attack macro?

Post by Malfiouss » Wed May 31, 2023 12:19 am

I originally had my pet attack mapped to my spells but found this messed up, pulling more mobs and maintaining agro on specific ones. I ended up making the pet attack a separate button for more control.

I can see the macros being nice in dungeons though to avoid having to keep telling your pet to attack. I wish there was a way to tell the pet to attack my target if not already engaged.

Adnoctum
Posts: 4

Re: Pet attack macro?

Post by Adnoctum » Fri Sep 22, 2023 4:50 am

stop using pet attack macro binde attack and passive to mousewheel scroll up for attack and down for passive . you will never again have a pet pull acident and you have full controll of pet. and then just ctrl up/down for camera..

Atsuki
Posts: 2

Re: Pet attack macro?

Post by Atsuki » Mon Dec 23, 2024 3:47 pm

I disagree with Adnoctum here: "stop using attack macro binds, because accidents happen!"

I bind petattack to my usual opener and keep a "pet stop attack" macro just in case...
/run PetStopAttack()
/run PetDefensiveMode()
/run PetFollow()

this will make your pet stop attacking, even mid cast, and follow you instead. Switch PetDefensiveMode() to PetPassiveMode() if you prefer

Jmgibson1981
Posts: 2

Re: Pet attack macro?

Post by Jmgibson1981 » Wed Jan 15, 2025 12:58 am

forget the in game macro interface. lua file / mod style for the win. Granted this one specifically relies on some of my own functions but you aren't limited by the in game macro ui.

Code: Select all

function WarlockPetSkinMACRO(drinkslot, foodslot, hearthslot, wandactionbutton)
    if drinkslot == "help" then
        local function lockprint(text)
            DEFAULT_CHAT_FRAME:AddMessage(text)
        end

        lockprint("Usage:")
        lockprint("Mod Ctrl = Dismiss Pet")
        lockprint("Mod Alt Combat = Health Funnel")
        lockprint("Mod Alt = Use Hearthstone (* hearthstone)")
        lockprint("Mod Shift = Demon Armor / Unending Breath")
        lockprint("Default Friendly Target = Fire Shield (**)")
        lockprint("Default Aggro Target = Send pet (* start wand)")
        lockprint("No mod and no valid target = Drink")
        lockprint("No mod and no valid target if Drink active = Eat")
        lockprint("--")
        lockprint("* = Based on action button location")
        lockprint("** = Requires Imp")
        return
    end

    -- dismiss pet as called
    if IsControlKeyDown() then
        if HasPetUI() then
            PetDismiss()
            return
        end
    end

    -- alt key, combat heals pet
    if IsAltKeyDown() then
        if UnitAffectingCombat("player") == 1 then
            CastSpellByName("Health Funnel")
        else
            UseAction(hearthslot)
        end
        return
    end

    if IsShiftKeyDown() then
        if CheckBuffRemain("Shadow", "RagingScream", "player") < 300 then
            CastSpellByName("Demon Armor")
        else
            if UnitCanCooperate("player", "target") then
                CastSpellByName("Unending Breath")
            else
                if CheckBuffRemain("Shadow", "DemonBreath", "player") < 120 then
                    CastSpellByName("Unending Breath", "player")
                end
            end
        end
        return
    end

    -- friendly target cast flame shield on them if pet is imp
    if UnitCanCooperate("player", "target") then
        local pettype = UnitCreatureFamily("pet")
        if pettype == "Imp" then
            CastSpellByName("Fire Shield")
        end
        return
    end

    if UnitCanAttack("player", "target") and wandactionbutton > 0 then
        wandStart(wandactionbutton)
    end

    -- if have pet send attack / pull back. returns only on attack mode. default is passive
    if HasPetUI() then
        if PetAttackMACRO() then
            return
        end
    end

    -- check status of food and drink. activate as needed
    local drinkexist = CheckBuffRemain("INV", "Drink", "player")
    if drinkexist == 0 then
        if UnitMana("player") < UnitManaMax("player") then
            UseAction(drinkslot)
            return
        end
    end

    local foodexist = CheckBuffRemain("INV", "Fork&Knife", "player")
    if foodexist == 0 then
        if UnitHealth("player") < UnitHealthMax("player") then
            UseAction(foodslot)
            return
        end
    end
end

function PetAttackMACRO()
    if UnitCanAttack("player", "target") then
        PetAttack()
        return true
    end
    PetPassiveMode()
    return false
end

Post Reply