September 21, 2019, 09:21:25 pm
Welcome, Guest. Please login or register.
146581 Posts in 17802 Topics- by 32555 Members - Latest Member: Arahnid
Pages: [1]
  Print  
Author Topic: Multibox healing macro help  (Read 173 times)
Newbie
*
Posts: 16
View Profile Email
« on: September 07, 2019, 02:59:40 am »

I'm trying to write a small script that would first check if my tank is below 90% health - heal him if so. 

/target "Main Tank Name"

/script if (UnitHealth("target")/UnitHealthMax("target")) <0.9 and UnitIsPlayer("target") then
          CastSpellByName("Greater Heal(Rank 3)")
end


This is working.  However, I'd like to make it more complex/viable.  Hoping someone could help me out with this.  I'd like it to cancel the cast if my tank is above 90% health prior to the heal landing so that I limit my overhealing. 

Also as an else statement if my main tank is above 90% health I'd like the character to then raid heal instead.  I use /lpm script usually but it supermacro doesn't seem to like it when I include it as an else statement...
Logged
Gamemaster
Jr. Member
*****
Posts: 128
Hunter, guardian, destroyer, menace
View Profile
« Reply #1 on: September 08, 2019, 02:57:28 pm »

I'd like it to cancel the cast if my tank is above 90% health prior to the heal landing so that I limit my overhealing. 

This is quite complex since it would require you to either
a) spam an action that can decide between the state [should I cast?] and [already casting?] or
b) schedule an action that does something at time t where
   
Code:
t_casting_started < t < (t_cast_finishes - timeframe_point_of_no_return)

timeframe_point_of_no_return  is a threshold where your character would not cancel its cast anymore, e.g. 0.5seconds before the heal lands.

Regarding b), you can schedule actions with some Ace Library, I can't remember exactly which one. However I'm unsure about the time resolution. If the resolution's minimum is 1 second timeframe_point_of_no_return would need to be equal or greater than 1 second which makes your decision less efficient.

Regarding a), spamming the action would distract you from your other tasks or you'd have to include it in your 'main loop'.

Also as an else statement if my main tank is above 90% health I'd like the character to then raid heal instead.  I use /lpm script usually but it supermacro doesn't seem to like it when I include it as an else statement...

I don't know what /lpm is but you can't fire 'slash commands' from within supermacros LUA scripts. You'd have to call the underlying LUA functions that is triggered by /lpm.
Other than that raid healing should be quite easy.
First wrap your stuff in LUA functions. Then call them via /script.
For example:

Code:
function healMaintank()
    // check whether you're targeting a player, not an NPC or foe?
    if UnitIsPlayer("target") then
        // then maybe check for your target, e.g. UnitName("target") = "MaintankCharacterName"
        if (UnitHealth("target")/UnitHealthMax("target")) <0.9 then
            CastSpellByName("Greater Heal(Rank 3)")
        else
            // raid heal stuff, e.g. shaman chain heals
        end
    end
end

P.S. use
Code:
  ...
to format code :-)
Logged

How to submit tickets.

I have a toothache, can you come look at it for me? It's the one in the back!
Pages: [1]
  Print  
 
Jump to: