Jump to content

Fonction didnt work.


purownage

Recommended Posts

Hi Eluna team!

I'm currently rewriting a few bosses in Lua, heres my prob.... :P here's the fonction;

function abomination.HatefulStrike(event, delay, pCall, creature)
  local tankInRange = creature:GetAITarget(1, true, 2, 6)
  -- Check for off-tank in 5 yd range excluding main tank...
     local threatlist = creature:GetAITargets()
     -- Check all existing players in the threat list for Hateful Strike...
        for _, v in pairs(threatlist) do
          if v:GetHealth() <= tankInRange:GetHealth() then
          -- Compare health of all listed players.
            creature:CastSpell(tankInRange, SPELL_HATEFULSTRIKE)
            else
            creature:CastSpell(v, SPELL_HATEFULSTRIKE);
          end
     end
end

Link to comment
Share on other sites

You have not specified what the problem is.
What happens and what should happen?
On which line of code?

Are there any errors in console or Eluna.log or ElunaErrorLogFile.log ? What are they?
What have you tried to do to debug the code?

Link to comment
Share on other sites

If the spell ID is 28308, then it has melee range and will not be cast over longer distances (creature:CastSpell(v, SPELL_HATEFULSTRIKE)).

Also your code implies that the offtank (tankInRange), if found at all, will get at least 1x damage (i.e. spellcast). I suppose the additional check in the threatlist cycle is needed.

Any other issue may represent an error, but we really have to know it before doing anything.

Link to comment
Share on other sites

Thanks for your reply guys I've found a way to make it work basicly there is no support in core for the primer spell patchwerk use normaly so ive tryed to patch this up by making a fonction cthat check for all players in melee range due to the fact that patchwerk will not target farther target for hateful strike it will only compare all players in threatlist AND players in melee ranger and hit the player with the most HP if main tank have less hp.. thats basically this :) I was wondering if there is any method to target player that are in back of the boss heres an old lua script that im trying to make it work ;

Register event .....
local tbl=Unit:GetInRangePlayers();
for k,v in pairs(tbl) do
if v:IsInBack(Unit) == true then
local behindtargets={}
if v:IsInBack(Unit) == true then
table.insert(behindtargets, v)
local player=math.random(1, table.getn(behindtargets))
Unit:FullCastSpellOnTarget(15847,behindtargets[player])
end
end
end
end
end

I want to make her check if theres is player in melee ranger behind here before casting tail swip...

 

thanks in advance :):)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use