MaxAggro condition for nukes

Discussion in 'E3' started by Ilirith, Jun 6, 2020.

Tags:
  1. Ilirith

    Ilirith Orc Pawn

    Messages:
    4
    Greetings.

    I was having some issues with my cleric casting nukes and getting aggro all the time.
    I added the /noAggro parameter and it helped a bit, but it would then cast a nuke once it was down to 95% aggro for example, going way past 100% and then regaining actual aggro.

    So, i made a slight modification to my e3, so i can now use /MaxAggro|60
    that will ensure it won't cast the nuke if its above 60% aggro

    Currently, i've only made it for direct damage spells (Nukes), but if people are interested, i can add it for Heals, DoTs, Debuffs etc well.

    For anyone who wish to add it to their e3, make these changes:

    e3_Utilities.inc
    Code:
    (Around Line #193, in the BuildSpellArray sub)
    Change:
            /declare SpellProp[38] string outer 0
    Into:
            /declare SpellProp[39] string outer 0
    
    (Around Line #231, in the BuildSpellArray sub)
    Below:
        /varset SpellProp[38] Ifs
    Add:
        /varset SpellProp[39] iMaxAggro
    
    (Around Line #277, in the BuildSpellArray sub)
    Below:
       /if (!${Defined[iIfs]})       /declare iIfs int outer 38
    Add:
      /if (!${Defined[iMaxAggro]})          /declare iMaxAggro int outer 39
    
    (Around Line #664, in the BuildSpellArray sub)
    Below:
        | get iIfs - conditionals used in various places
        /if (${${ArrayName}[${i}].Find[/Ifs|]}) {
            /call argueString Ifs| "${${ArrayName}[${i}]}"
            /varset ${NewArrayName}[${i},${iIfs}] ${Ini[${Character_Ini},Ifs,${c_argueString},NULL,noparse]}
            | we kind of need to print here instead of like everything else :P
            /if (${printAll}) /echo Ifs ${c_argueString}
        } else {
            /varset ${NewArrayName}[${i},${iIfs}] TRUE
            /if (${printAll}) /echo Ifs TRUE
        }
    Add:
        | get iMaxAggro
        /if (${${ArrayName}[${i}].Find[/MaxAggro|]}) {
          /call argueString MaxAggro| "${${ArrayName}[${i}]}"
          /varset ${NewArrayName}[${i},${iMaxAggro}] ${c_argueString}
        } else {
          |default MaxAggro to 200, cast even when having aggro
          /varset   ${NewArrayName}[${i},${iMaxAggro}] 200
        }
        /if (${printAll}) /echo MaxAggro ${${NewArrayName}[${i},${iMaxAggro}]}
    
    e3_Assists.inc
    Code:
    (Around Line #442, in check_Nukes sub)
    Below:
          |only cast if my aggro is greater than PctAggro and the target is a Named
          /if (${Nukes2D[${castIndex},${iPctAggro}]} > 0) {
            /if (${Me.PctAggro} < ${Nukes2D[${castIndex},${iPctAggro}]} || !${Target.Named}) {
              /if (${Debug} || ${Debug_Assists}) /echo \ay skipping cast of ${Nukes2D[${castIndex},${iCastName}]}, my aggro ${Me.PctAggro} is < PctAggro ${Nukes2D[${castIndex},${iPctAggro}]}
              /if (${Debug} || ${Debug_Assists}) /echo ${Nukes2D[${castIndex},${iPctAggro}]} ${Me.PctAggro} < ${Nukes2D[${castIndex},${iPctAggro}]} !${Target.Named}
              /goto :skipCast
            }
          }
    Add:
          |only cast if my aggro is less than MaxAggro, else skip the spell
          /if (${Nukes2D[${castIndex},${iMaxAggro}]}) {
            /if (${Me.PctAggro} > ${Nukes2D[${castIndex},${iMaxAggro}]}) {
              /if (${Debug} || ${Debug_Assists}) /echo \ay skipping cast of ${Nukes2D[${castIndex},${iCastName}]}, my aggro ${Me.PctAggro} is > MaxAggro ${Nukes2D[${castIndex},${iMaxAggro}]}
              /if (${Debug} || ${Debug_Assists}) /echo ${Nukes2D[${castIndex},${iMaxAggro}]} ${Me.PctAggro} < ${Nukes2D[${castIndex},${iMaxAggro}]}
              /goto :skipCast
            }
          }
    
    That is all for macro modifications for this functionality.

    Example:
    Code:
    (Will only cast Smite from GemSlot #1 if above 90% mana and less than 60% aggro)
    [Nukes]
    Main=Smite/Gem|1/MinMana|90/MaxAggro|60
    
    I haven't tested it in large scale situations, as i'm new to this server, and currently, only run a single group, so 6 chars.
    But i don't see why it would act any different with 60 chars, as its a pretty simple check it does.
     
    • Like Like x 2
  2. trpling

    trpling Orc Centurion

    Messages:
    54
    Looks good, just out of curiosity I noticed this PctAggro field isn't found on the wiki page. How did you find out that Me datatype has access to PctAggro?

    Nvm found it on wiki by directly navigating there isn't a reference in the Main Page.

    https://www.macroquest2.com/wiki/index.php/TLO:Me

    in case anyone is curious.

    Tons of good enhancement stuff in there too btw. Merges coming soon!
     
  3. Ilirith

    Ilirith Orc Pawn

    Messages:
    4
    ${Me} is a TLO, which is of the type Character.

    https://www.macroquest2.com/wiki/index.php/DataType:character

    All of those members should be available on the ${Me} TLO
    On top of that, the Character datatype inherits from the Spawn datatype, so all these should be available as well,
    https://www.macroquest2.com/wiki/index.php/DataType:spawn

    Although, there might be some that arent working, as we are using an older version of MQ2 i believe for this client/server, but i've only stumbled upon a few that werent working when i played around with buffs ( most notable the StacksTarget member, that would check if Spell will stack or not if cast upon your target, which sadly, is not working in our version of MQ2, so there we have to resort to StacksWith[Spellname] to check against all buffs on the target for example)


    BTW, speaking of merges, is the e3 we use on git somewhere? if so, i'l prolly do some more minor enhancements like this one, and make a PR
     
  4. trpling

    trpling Orc Centurion

    Messages:
    54
  5. Ilirith

    Ilirith Orc Pawn

    Messages:
    4
    Fair, and thanks!

    I'l clone and add the changes above to it and send a PR.

    Will look into having it work for Debuffs, DoTs and Heals as well.