Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function ZG.VAR.FireBallSpawn(pUnit, Event)
- pUnit:SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE) -- unselectable
- pUnit:Root()
- pUnit:SetCombatCapable(false)
- pUnit:RegisterEvent("ZG.VAR.SendFireballVisual", 1000, 1)
- pUnit:RegisterEvent("ZG.VAR.GrowBiggerFireball", 2000, 14)
- pUnit:RegisterEvent("ZG.VAR.FireballExplode", 29000, 1)
- end
- function ZG.VAR.SendFireballVisual(pUnit)
- pUnit:CastSpell(71706) -- perm visual
- pUnit:CastSpell(74710) -- spawn visual
- end
- function ZG.VAR.GrowBiggerFireball(pUnit)
- pUnit:SetScale(math.random(5, 20) / 10)
- end
- function ZG.VAR.FireballExplode(pUnit)
- local x2 = pUnit:GetX()
- local y2 = pUnit:GetY()
- pUnit:CastSpell(76010) -- visual
- pUnit:RemoveAura(71706) -- main visual
- for k,plr in pairs(pUnit:GetInRangePlayers()) do
- local distance = plr:GetDistanceYards(pUnit)
- if plr:GetPhase() == 2 and distance < 20 then
- local x1 = plr:GetX()
- local y1 = plr:GetY()
- local x = x2 - x1
- local y = y2 - y1
- local angle = math.pi + math.atan2(-y, -x)
- local x = x1 - ((math.random(25,30)-distance) * math.cos(angle))
- local y = y1 - ((math.random(25,30)-distance) * math.sin(angle))
- local z = pUnit:GetLandHeight(x, y)
- if z > 200 or z < 20 then
- z = plr:GetZ()
- end
- local minimum = distance*40
- local maximum = distance*50
- pUnit:Strike(plr, 2, 72134, minimum, maximum, 1)
- plr:MoveKnockback(x, y, z, 2, 9)
- end
- end
- end
- RegisterUnitEvent(71706, 18, "ZG.VAR.FireBallSpawn")
Advertisement
Add Comment
Please, Sign In to add comment