Jump to content
Sign in to follow this  
Patrykiel

A simple macro that fails in PvP but works in PvE...

Recommended Posts

So I wrote myself something very simple:

/script if (UnitMana("target")>0) then CastSpellByName("Curse of Shadow") else CastSpellByName("Curse of Exhaustion")end;

I also wanted to make it apply Exhaustion on Paladins buuuuut.... this (the way it is now) does not work in PvP, nope! Works on mobs and never on players, honestly, we Warlocks have enough stuff to click as it is, so does anyone have a solution? Right now in PvP, the macro applies Curse of Shadow and never Exhaustion unless I'm targeting a player's pet and it's driving me crazy!

And yes before you ask I am using "SuperMacro".

Also, I have no idea how to make it work on Paladins, essentially I wanted something that's supposed to snare melee classes and Curse of Shadow everyone else.

Share this post


Link to post
Share on other sites
/run local c,u=CastSpellByName,UnitClass('target') if u == 'Druid' then c('Curse of Shadow') elseif UnitPowerType('target') ~= 0 or u == 'Paladin' then c('Curse of Exhaustion') else c('Curse of Shadow') end

 

Share this post


Link to post
Share on other sites
On 16.05.2017 at 8:49 AM, asdaaf said:
/run local c,u=CastSpellByName,UnitClass('target') if u == 'Druid' then c('Curse of Shadow') elseif UnitPowerType('target') ~= 0 or u == 'Paladin' then c('Curse of Exhaustion') else c('Curse of Shadow') end

 

Man! You deserve some kind of medal for this! Can this macro be expanded even more? Maybe with some addon that increase the number of characters from 255 to 500?

Share this post


Link to post
Share on other sites
Just now, WobLight said:

SuperMacro allow support lua code

Yes but how would you write this in lua? I have no experience with it at all.

Share this post


Link to post
Share on other sites

everything after `/run` is lua already, all you need to is to wrap it into a function

function a()
    local c,u=CastSpellByName,UnitClass('target') if u == 'Druid' then c('Curse of Shadow') elseif UnitPowerType('target') ~= 0 or u == 'Paladin' then c('Curse of Exhaustion') else c('Curse of Shadow') end
end

then you can call a() into you macro

(using a meaningful name would be better though)

Share this post


Link to post
Share on other sites

OK, I am not a programmer, I just copied the code in to the Extended LUA code section like this:

/run function a()
    local c,u=CastSpellByName,UnitClass('target') if u == 'Druid' then c('Curse of Shadow') elseif UnitPowerType('target') ~= 0 or u == 'Paladin' then c('Curse of Exhaustion') else c('Curse of Shadow') end
end

Wrap it in to a function? Sounds like black magic to me and it doesn't work because I obviously did something wrong.

Share this post


Link to post
Share on other sites
12 minutes ago, WobLight said:

remove `/run` from extended lua, then in your macro use `/run a()`

Ah I figured it out, thanks. But for someone who's not experienced with this sort of stuff people are looking at this and going "WHAT THE HELL ARE THEY TALKING ABOUT! GAHAAAAAAAAAAAAA!!!!!!!!!" <insert random sounds of electronics being crushed and kicked>

 

So STEP 1 what you do is type:

/run a()

Inn to the ======> Enter Macro Commands: section, but "a" can be change in to something else like "Curses"

STEP 2! You insert the following code:

function a()
    local c,u=CastSpellByName,UnitClass('target') if u == 'Druid' then c('Curse of Shadow') elseif UnitPowerType('target') ~= 0 or u == 'Paladin' then c('Curse of Exhaustion') else c('Curse of Shadow') end
end

In to the Enter Extended LUA code: section and PEW PEW! You have yourself a macro.

 

Think you could help me with one more thing?

I wanted to expand this macro a bit with Amplify Curse/Curse of Exhaustion. Thing is I'd like to amplify the curse when the target is buffed with Sprint and apply the buffed version of Exhaustion instead to actually have a chance at winning.

Share this post


Link to post
Share on other sites
3 minutes ago, WobLight said:

You can't see enemy buffs unless a mage casted Detect Magic on it, so that can't be done.

But Natur's Enemy cast bar does actually detect them and shows you durations and everything, so why can't it be done?

Share this post


Link to post
Share on other sites
Just now, Patrykiel said:

But Natur's Enemy cast bar does actually detect them and shows you durations and everything, so why can't it be done?

Addons can track combat log to detect Sprint cast (then they guess its duration). That's not even safe since Combat log range is quite short. So it's possible, but not easy nor 100% reliable. It would also require some time to code it (and it's 00:20 here)

Share this post


Link to post
Share on other sites
Just now, WobLight said:

Addons can track combat log to detect Sprint cast (then they guess its duration). That's not even safe since Combat log range is quite short. So it's possible, but not easy nor 100% reliable. It would also require some time to code it (and it's 00:20 here)

You should probably get some sleep? Thanks for your help, now thanks to some of these macros I really feel the burden of Warlock spells/keybinds being much less severe, and being in combat with another player does not end with a quick and very painful death, especially when you hide behind some tough warriors, preferably Tauren with massive HP.

Anyway! It would be great if you could code something like this later. A macro which can apply proper curses for right targets and amplify the effects when a Rouge start sprinting at you (which usually ends with a quick death since Warlocks are mushrooms and Rouges are scissors made out of diamonds) would be priceless!

Share this post


Link to post
Share on other sites

just a random note UnitMana("unit") and UnitManaMax("unit") returns energy/rage values for rogues and warriors so u might wanna use ">120" for casters if you wanna use this function again

Share this post


Link to post
Share on other sites
2 hours ago, Knife said:

just a random note UnitMana("unit") and UnitManaMax("unit") returns energy/rage values for rogues and warriors so u might wanna use ">120" for casters if you wanna use this function again

No, everything is working perfectly, there is just one problem with LUA and that problem is that it doesn't show the range of the main spell. Normally when I am out of range the icon lights up red but now it stays normal and I do not know when I'm in range or out of range.

Share this post


Link to post
Share on other sites
10 hours ago, Knife said:

just a random note UnitMana("unit") and UnitManaMax("unit") returns energy/rage values for rogues and warriors so u might wanna use ">120" for casters if you wanna use this function again

`UnitPowerType("unit")` is the proper way to check that, as asdaaf did in his macro.

Share this post


Link to post
Share on other sites
1 hour ago, WobLight said:

`UnitPowerType("unit")` is the proper way to check that, as asdaaf did in his macro.

And I'm grateful to asdaaf as well but you were the one who showed how to make it work in LUA.

Any chance you could see if you can make something based on enemy buffs? When ever you have the time that is.

Share this post


Link to post
Share on other sites

I hate to bump this thread but I am pretty desperate for a solution. If that code for Rouge sprints ever gets completed so that amplify curse can work with this macro there might finally be a slim glimmer of hope for Warlocks.

Share this post


Link to post
Share on other sites
local f = CreateFrame('frame')
f:RegisterEvent('CHAT_MSG_SPELL_PERIODIC_HOSTILEPLAYER_BUFFS')

local exhaust = {}

function castcurse()
    if exhaust[UnitName('target')] then
        if exhaust[UnitName('target')] > time() then
            CastSpellByName('Amplify Curse')
            exhaust[UnitName('target')] = nil
        end
        CastSpellByName('Curse of Exhaustion')
    elseif UnitClass('target') == 'Druid' then
        CastSpellByName('Curse of Shadow')
    elseif UnitPowerType('target') ~= 0 or UnitClass('target') == 'Paladin' then
        CastSpellByName('Curse of Exhaustion')
    else
        CastSpellByName('Curse of Shadow')
    end
end

function curse_OnEvent()
    for k,v in pairs(exhaust) do
        if time() > v then
            exhaust[k] = nil
        end
    end
    if string.find(arg1,'%a+ gains Sprint%.') then
        local _,_,name = string.find(arg1,'(%a+) gains Sprint%.')
        exhaust[name] = time() + 15
    end
end

f:SetScript('OnEvent',curse_OnEvent)

i don't know how you can make this into a macro so i suggest you make into an addon.

Share this post


Link to post
Share on other sites
On 19.05.2017 at 10:23 PM, asdaaf said:
local f = CreateFrame('frame')
f:RegisterEvent('CHAT_MSG_SPELL_PERIODIC_HOSTILEPLAYER_BUFFS')

local exhaust = {}

function castcurse()
    if exhaust[UnitName('target')] then
        if exhaust[UnitName('target')] > time() then
            CastSpellByName('Amplify Curse')
            exhaust[UnitName('target')] = nil
        end
        CastSpellByName('Curse of Exhaustion')
    elseif UnitClass('target') == 'Druid' then
        CastSpellByName('Curse of Shadow')
    elseif UnitPowerType('target') ~= 0 or UnitClass('target') == 'Paladin' then
        CastSpellByName('Curse of Exhaustion')
    else
        CastSpellByName('Curse of Shadow')
    end
end

function curse_OnEvent()
    for k,v in pairs(exhaust) do
        if time() > v then
            exhaust[k] = nil
        end
    end
    if string.find(arg1,'%a+ gains Sprint%.') then
        local _,_,name = string.find(arg1,'(%a+) gains Sprint%.')
        exhaust[name] = time() + 15
    end
end

f:SetScript('OnEvent',curse_OnEvent)

i don't know how you can make this into a macro so i suggest you make into an addon.

This looks perfect! But it's not possible to simply put it in LUA? I have no idea how to make an addon.

Share this post


Link to post
Share on other sites
8 hours ago, Patrykiel said:

This looks perfect! But it's not possible to simply put it in LUA? I have no idea how to make an addon.

That is LUA already, but it into your support code and call `castcurse()` in your macro

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×