stoneharry

Untitled

Nov 15th, 2011
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.09 KB | None | 0 0
  1.  function DM.VAR.FORGE_HASAURA(pUnit,Event)
  2.     local id = pUnit:GetInstanceID()
  3.     if id == nil then id = 1 end
  4.     DM[id] = DM[id] or {VAR={}}
  5.     if DM[id].VAR.Stacks == nil then DM[id].VAR.Stacks = 0 end
  6.     -- if he has aura
  7.     if pUnit:HasAura(61509) == true then
  8.         -- add to stacks
  9.         DM[id].VAR.Stacks = DM[id].VAR.Stacks + 1
  10.         -- if stacks more than 0, cast spell
  11.         if DM[id].VAR.Stacks > 0 then
  12.             -- cast spell
  13.             local PlayersAllAround = pUnit:GetInRangePlayers()
  14.             for a, players in pairs(PlayersAllAround) do
  15.                 if pUnit:GetDistanceYards(players) < 40 then
  16.                     pUnit:CastSpellOnTargets(23341,players)
  17.                 end
  18.             end
  19.         end
  20.     else
  21.         -- if more than one stack, spawn adds
  22.         if DM[id].VAR.Stacks > 1 then
  23.             -- spawn creature on nearby players
  24.             local PlayersAllAround = pUnit:GetInRangePlayers()
  25.             for a, players in pairs(PlayersAllAround) do
  26.                 if pUnit:GetDistanceYards(players) < 40 then
  27.                     players:SpawnCreature(6812, players:GetX(), players:GetY(), players:GetZ(), 0, 35, 15000)
  28.                 end
  29.             end
  30.         else
  31.             -- he doesn't have the aura
  32.             DM[id].VAR.Stacks = 0
  33.         end
  34.     end
  35.  end
  36.  
Advertisement
Add Comment
Please, Sign In to add comment