stoneharry

Untitled

Mar 9th, 2012
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 15.53 KB | None | 0 0
  1. -- Final Dragon Boss ---------------------------------------------------------
  2.  
  3. function ZG.VAR.DragonBossEvent_COT(pUnit, Event)
  4.     if Event == 4 then
  5.         pUnit:RemoveEvents()
  6.     elseif Event == 18 then
  7.         pUnit:RegisterEvent("ZG.VAR.SetUpCreatures_Dragon", 1000, 1)
  8.     end
  9. end
  10.  
  11. RegisterUnitEvent(115831, 4, "ZG.VAR.DragonBossEvent_COT")
  12. RegisterUnitEvent(115831, 18, "ZG.VAR.DragonBossEvent_COT")
  13.  
  14. function ZG.VAR.SetUpCreatures_Dragon(pUnit)
  15.     pUnit:SetMaxPower(100, 2)
  16.     pUnit:SetPower(100, 2)
  17.     pUnit:SetPowerType(2)
  18.     local id = pUnit:GetInstanceID()
  19.     if id == nil then id = 1 end
  20.     ZG[id] = ZG[id] or {VAR={}}
  21.     ZG[id].VAR.leader = pUnit:SpawnCreature(36544, -11062, -2306, 145.9, 1.290404, 35, 0, 50429) -- Leader
  22.     ZG[id].VAR.addA = pUnit:SpawnCreature(4052, -11075, -2307, 145, 1.058709, 35, 0, 45212)
  23.     ZG[id].VAR.addB = pUnit:SpawnCreature(4052, -11066, -2311, 145.9, 1.184373, 35, 0, 45212)
  24.     ZG[id].VAR.addC = pUnit:SpawnCreature(4052, -11057, -2314, 147.3, 1.549583, 35, 0, 45212)
  25.     ZG[id].VAR.addD = pUnit:SpawnCreature(4052, -11049, -2311, 146.3, 2, 35, 0, 45212)
  26.     pUnit:RegisterEvent("ZG.VAR.WhileNoPlayer_DoVisual", 1500, 1)
  27.     pUnit:RegisterEvent("ZG.VAR.CheckForPlayers_ToStart", 1000, 0)
  28. end
  29.  
  30. function ZG.VAR.WhileNoPlayer_DoVisual(pUnit)
  31.     local id = pUnit:GetInstanceID()
  32.     if id == nil then id = 1 end
  33.     ZG[id] = ZG[id] or {VAR={}}
  34.     ZG[id].VAR.leader:ChannelSpell(48185, pUnit)
  35.     ZG[id].VAR.addA:ChannelSpell(49128, ZG[id].VAR.leader)
  36.     ZG[id].VAR.addB:ChannelSpell(49128, ZG[id].VAR.leader)
  37.     ZG[id].VAR.addC:ChannelSpell(49128, ZG[id].VAR.leader)
  38.     ZG[id].VAR.addD:ChannelSpell(49128, ZG[id].VAR.leader)
  39. end
  40.  
  41. function ZG.VAR.CheckForPlayers_ToStart(pUnit)
  42.     local id = pUnit:GetInstanceID()
  43.     if id == nil then id = 1 end
  44.     ZG[id] = ZG[id] or {VAR={}}
  45.     local plr = ZG[id].VAR.leader:GetClosestPlayer()
  46.     if plr ~= nil then
  47.         if ZG[id].VAR.leader:GetDistanceYards(plr) < 10 then
  48.             if plr:IsAlive() then
  49.                 ZG[id].VAR.leader:PlaySoundToSet(15861)
  50.                 ZG[id].VAR.leader:SendChatMessage(12,0,"Hurry mortals, I cannot hold the beast back for long!")
  51.                 pUnit:RemoveEvents()
  52.                 pUnit:RegisterEvent("ZG.VAR.HEREWEGO_DRAGON", 4000, 1)
  53.             end
  54.         end
  55.     end
  56. end
  57.  
  58. function ZG.VAR.HEREWEGO_DRAGON(pUnit)
  59.     local id = pUnit:GetInstanceID()
  60.     if id == nil then id = 1 end
  61.     ZG[id] = ZG[id] or {VAR={}}
  62.     pUnit:SendChatMessage(14,0,"ENOUGH! Now you vermin shall feel the force of my birthright: The Fury of the Earth itself!")
  63.     pUnit:SpawnGameObject(146086, -11095.85, -2318.86, 147.5, 6.154612, 900000, 100) -- cave in
  64.     ZG[id].VAR.leader:PlaySoundToSet(8289)
  65.     ZG[id].VAR.leader:StopChannel()
  66.     ZG[id].VAR.addA:StopChannel()
  67.     ZG[id].VAR.addB:StopChannel()
  68.     ZG[id].VAR.addC:StopChannel()
  69.     ZG[id].VAR.addD:StopChannel()
  70.     pUnit:RegisterEvent("ZG.VAR.WaitForVisualsToPlayDURP", 250, 1)
  71.     ZG[id].VAR.e = 0
  72.     ZG[id].VAR.hpCount = 1
  73.     ZG[id].VAR.hpList = {90,80,70,60,50,40,30,20,10}
  74.     pUnit:RegisterEvent("ZG.VAR.BeginZeEventZZ", 7000, 1)
  75.     pUnit:RegisterEvent("ZG.VAR.DrainDragonBossHealth", 500, 0)
  76.     pUnit:RegisterEvent("ZG.VAR.DragonBossCheckForWipe_Astarot", 2000, 0)
  77.     pUnit:RegisterEvent("ZG.VAR.DragonDespawnDeadTrash", 10000, 0)
  78. end
  79.  
  80. function ZG.VAR.WaitForVisualsToPlayDURP(pUnit)
  81.     local id = pUnit:GetInstanceID()
  82.     if id == nil then id = 1 end
  83.     ZG[id] = ZG[id] or {VAR={}}
  84.     ZG[id].VAR.leader:CastSpell(68848)
  85.     ZG[id].VAR.addA:CastSpell(68848) -- knockdown visual
  86.     ZG[id].VAR.addB:CastSpell(68848)
  87.     ZG[id].VAR.addC:CastSpell(68848)
  88.     ZG[id].VAR.addD:CastSpell(68848)
  89. end
  90.  
  91. function ZG.VAR.DrainDragonBossHealth(pUnit)
  92.     local id = pUnit:GetInstanceID()
  93.     if id == nil then id = 1 end
  94.     ZG[id] = ZG[id] or {VAR={}}
  95.     if pUnit:GetHealthPct() > ZG[id].VAR.hpList[ZG[id].VAR.hpCount] then
  96.         pUnit:SetHealth(pUnit:GetHealth()-200)
  97.     end
  98.     --[[if pUnit:GetPower() < pUnit:GetMaxPower() then
  99.         pUnit:SetPower(pUnit:GetPower(2)+1, 2)
  100.     end]]
  101. end
  102.  
  103. function ZG.VAR.BeginZeEventZZ(pUnit)
  104.     local id = pUnit:GetInstanceID()
  105.     if id == nil then id = 1 end
  106.     ZG[id] = ZG[id] or {VAR={}}
  107.     ZG[id].VAR.e = ZG[id].VAR.e + 1
  108.     if ZG[id].VAR.e == 1 then
  109.         ZG[id].VAR.leader:SendChatMessage(12,0,"Mortals, you must defend us while we attempt to destroy this being, or all hope is lost!")
  110.         pUnit:RegisterEvent("ZG.VAR.BeginZeEventZZ", 3000, 1)
  111.     elseif ZG[id].VAR.e == 2 then
  112.         ZG[id].VAR.addA:ChannelSpell(49128, ZG[id].VAR.leader)
  113.         ZG[id].VAR.addB:ChannelSpell(49128, ZG[id].VAR.leader)
  114.         ZG[id].VAR.addC:ChannelSpell(49128, ZG[id].VAR.leader)
  115.         ZG[id].VAR.addD:ChannelSpell(49128, ZG[id].VAR.leader)     
  116.         pUnit:RegisterEvent("ZG.VAR.BeginZeEventZZ", 1000, 1)
  117.     elseif ZG[id].VAR.e == 3 then
  118.         ZG[id].VAR.leader:ChannelSpell(48185, pUnit)
  119.         pUnit:RegisterEvent("ZG.VAR.BeginZeEventZZ", 1000, 1)
  120.     elseif ZG[id].VAR.e == 4 then
  121.         pUnit:CastSpellAoF(-11062.66, -2297.34, 146, 68926)
  122.         pUnit:SpawnCreature(21234, -11062.66, -2297.34, 146, 0, 15, 300000)
  123.         ZG[id].VAR.dragons = 0
  124.         pUnit:RegisterEvent("ZG.VAR.SpawnMoreDamnDragonLords", 5000, 2)
  125.         pUnit:RegisterEvent("ZG.VAR.BeginZeEventZZ", 20000, 1)
  126.     elseif ZG[id].VAR.e == 5 then
  127.         local found = false
  128.         for _,unit in pairs(pUnit:GetInRangeUnits()) do
  129.             local entry = unit:GetEntry()
  130.             if entry == 871111 or entry == 497111 then
  131.                 if unit:IsAlive() then
  132.                     found = true
  133.                     break
  134.                 end
  135.             end
  136.         end
  137.         if not found then
  138.             ZG[id].VAR.leader:PlaySoundToSet(8291)
  139.             pUnit:SendChatMessage(14,0,"Impossible! Rise my minions! Serve your master once more!")
  140.             ZG[id].VAR.hpCount = ZG[id].VAR.hpCount + 1
  141.         else
  142.             ZG[id].VAR.e = ZG[id].VAR.e - 1
  143.         end
  144.         pUnit:RegisterEvent("ZG.VAR.BeginZeEventZZ", 1000, 1)
  145.     elseif ZG[id].VAR.e == 6 then
  146.         ZG[id].VAR.dragons = 0
  147.         pUnit:RegisterEvent("ZG.VAR.SpawnMoreDamnDragonLords", 5000, 3)
  148.         pUnit:RegisterEvent("ZG.VAR.BeginZeEventZZ", 20000, 1)     
  149.     elseif ZG[id].VAR.e == 7 then
  150.         local found = false
  151.         for _,unit in pairs(pUnit:GetInRangeUnits()) do
  152.             local entry = unit:GetEntry()
  153.             if entry == 871111 or entry == 497111 then
  154.                 if unit:IsAlive() then
  155.                     found = true
  156.                     break
  157.                 end
  158.             end
  159.         end
  160.         if not found then
  161.             ZG[id].VAR.hpCount = ZG[id].VAR.hpCount + 1
  162.             ZG[id].VAR.leader:PlaySoundToSet(8290)
  163.             pUnit:SendChatMessage(14,0,"Burn, you wretches! Burn!")
  164.             ZG[id].VAR.hpCount = ZG[id].VAR.hpCount + 1
  165.             local trigger = pUnit:GetCreatureNearestCoords(ZG[id].VAR.leader:GetX(),ZG[id].VAR.leader:GetY(),ZG[id].VAR.leader:GetZ(),27942)
  166.             trigger:SetScale(0.8)
  167.             trigger:CastSpell(63894) -- shield
  168.         else
  169.             ZG[id].VAR.e = ZG[id].VAR.e - 1
  170.         end
  171.         pUnit:RegisterEvent("ZG.VAR.BeginZeEventZZ", 1000, 1)
  172.     elseif ZG[id].VAR.e == 8 then
  173.         ZG[id].VAR.leader:SendChatMessage(14,0,"Quick, get within the barrier!")
  174.         pUnit:RegisterEvent("ZG.VAR.BeginZeEventZZ", 4000, 1)
  175.     elseif ZG[id].VAR.e == 9 then
  176.         for i=1,100 do
  177.             pUnit:RegisterEvent("ZG.VAR.METEORSINCOMINGDUN_DUN", math.random(1000,20000),1)
  178.         end
  179.         pUnit:RegisterEvent("ZG.VAR.BeginZeEventZZ", 23000, 1)
  180.     elseif ZG[id].VAR.e == 10 then
  181.         pUnit:GetCreatureNearestCoords(ZG[id].VAR.leader:GetX(),ZG[id].VAR.leader:GetY(),ZG[id].VAR.leader:GetZ(),27942):RemoveAura(63894) -- shield
  182.         ZG[id].VAR.leader:PlaySoundToSet(8292)
  183.         pUnit:SendChatMessage(14,0,"This cannot be! I am the Master here! You mortals are nothing to my kind! DO YOU HEAR? NOTHING!")
  184.         pUnit:RegisterEvent("ZG.VAR.BeginZeEventZZ", 4000, 1)
  185.     elseif ZG[id].VAR.e == 11 then
  186.         ZG[id].VAR.hpCount = ZG[id].VAR.hpCount + 1
  187.         ZG[id].VAR.dragons = 0
  188.         pUnit:RegisterEvent("ZG.VAR.SpawnMoreDamnDragonLords", 5000, 4)
  189.     end
  190. end
  191.  
  192. function ZG.VAR.METEORSINCOMINGDUN_DUN(pUnit)
  193.     pUnit:SetPower(pUnit:GetPower(2)-3, 2)
  194.     local nx = math.random(11051,11087)
  195.     local ny = math.random(2325,2341)
  196.     pUnit:CastSpellAoF(-nx,-ny,pUnit:GetLandHeight(-nx,-ny),57467)
  197.     if math.random(1,100) < 13 then -- Since the square doesn't cover the sides of the shield, we'll hit those gaps
  198.         if math.random(1,2) == 1 then
  199.             pUnit:CastSpellAoF(-11048.75, -2320.6, 147.8,57467)
  200.         else
  201.             pUnit:CastSpellAoF(-11078.3, -2315, 147,57467)
  202.         end
  203.     end
  204. end
  205.  
  206. function ZG.VAR.SpawnMoreDamnDragonLords(pUnit)
  207.     local id = pUnit:GetInstanceID()
  208.     if id == nil then id = 1 end
  209.     ZG[id] = ZG[id] or {VAR={}}
  210.     if ZG[id].VAR.dragons == 0 then
  211.         pUnit:CastSpellAoF(-11042, -2333, 146.65, 68926)
  212.         pUnit:SpawnCreature(871111, -11042, -2333, 146.8, 2.67, 21, 300000, 39221):SetUInt32Value(UNIT_FIELD_BYTES_2, 1)
  213.     elseif ZG[id].VAR.dragons == 1 then
  214.         pUnit:CastSpellAoF(-11089.64, -2331.76, 146.3, 68926)
  215.         pUnit:SpawnCreature(871111, -11089.64, -2331.76, 146.3, 0.37, 21, 300000, 39221):SetUInt32Value(UNIT_FIELD_BYTES_2, 1)
  216.     elseif ZG[id].VAR.dragons == 2 then
  217.         pUnit:CastSpellAoF(-11090.4, -2332, 146.3, 68926)
  218.         for i=1,math.random(5,12) do
  219.             pUnit:SpawnCreature(497111, -11090.4, -2332, 146.3, 0.206785, 15, 120000)
  220.         end
  221.     elseif ZG[id].VAR.dragons == 3 then
  222.         pUnit:CastSpellAoF(-11042.7, -2333, 146.7, 68926)
  223.         for i=1,math.random(9,15) do
  224.             pUnit:SpawnCreature(497111, -11042.7, -2333, 146.7, 2.649929, 15, 120000)
  225.         end
  226.     end
  227.     ZG[id].VAR.dragons = ZG[id].VAR.dragons + 1
  228. end
  229.  
  230. function ZG.VAR.DragonDespawnDeadTrash(pUnit)
  231.     for _,unit in pairs(pUnit:GetInRangeUnits()) do
  232.         local entry = unit:GetEntry()
  233.         if entry == 21234 or entry == 871111 or entry == 36544 or entry == 497111 or entry == 4052 then
  234.             if not unit:IsAlive() then
  235.                 --pUnit:CastSpellAoF(unit:GetX(), unit:GetY(), unit:GetZ(), 68926) -- causes too much damage
  236.                 unit:Despawn(1,0)
  237.             end
  238.         end
  239.     end
  240. end
  241.  
  242. function ZG.VAR.DragonBossCheckForWipe_Astarot(pUnit)
  243.     local found = false
  244.     for _,plr in pairs(pUnit:GetInRangePlayers()) do
  245.         if plr:GetZ() < 143 or plr:GetZ() > 149 then
  246.             plr:Teleport(309, -11070, -2328.8, 150)
  247.             plr:CastSpell(64446) -- teleport visual
  248.         end
  249.         if not found then
  250.             if plr:IsAlive() then
  251.                 found = true
  252.             end
  253.         end
  254.     end
  255.     if not found then
  256.         -- wipe
  257.         pUnit:RemoveEvents()
  258.         pUnit:StopChannel()
  259.         pUnit:SetHealth(pUnit:GetMaxHealth())
  260.         local object = pUnit:GetGameObjectNearestCoords(-11095.85, -2318.86, 147.5, 146086) -- cave in
  261.         if object ~= nil then
  262.             object:Despawn(1000, 0)
  263.         end
  264.         for _,unit in pairs(pUnit:GetInRangeUnits()) do
  265.             local entry = unit:GetEntry()
  266.             if entry == 21234 or entry == 871111 or entry == 497111 or entry == 36544 or entry == 4052 then
  267.                 unit:StopChannel()
  268.                 unit:CancelSpell()
  269.                 unit:Despawn(1000,0)
  270.             end
  271.         end
  272.         pUnit:RegisterEvent("ZG.VAR.SetUpCreatures_Dragon", 5000, 1)
  273.     end
  274. end
  275.  
  276. -- 8289 <- ENOUGH! Now you vermin shall feel the force of my birthright: The Fury of the Earth itself!
  277. -- 8290 <- Burn, you wretches! Burn!
  278. -- 8291 <- Impossible! Rise my minions! Serve your master once more!
  279. -- 8292 <- This cannot be! I am the Master here! You mortals are nothing to my kind! DO YOU HEAR? NOTHING!
  280. -- 8293 <- Worthless wretch! Your friends will join you soon enough!
  281.  
  282. -- Draconic lords
  283.  
  284. function ZG.VAR.DRACONICLORDEVENT(pUnit, Event)
  285.     if Event == 1 then
  286.         pUnit:RegisterEvent("ZG.VAR.LordSpamFlameStrike", 10000, 0)
  287.         pUnit:RegisterEvent("ZG.VAR.SummonWhelpsAndSuchLordd", 1100, 0)
  288.     elseif Event == 2 or Event == 4 then
  289.         pUnit:RemoveEvents()
  290.     elseif Event == 18 then
  291.         pUnit:RegisterEvent("ZG.VAR.MoveTowardsEnemyZZLord", 1000, 1)
  292.     end
  293. end
  294.  
  295. function ZG.VAR.LordSpamFlameStrike(pUnit)
  296.     local plr = pUnit:GetRandomPlayer(0)
  297.     if plr ~= nil then
  298.         pUnit:CastSpellAoF(plr:GetX(), plr:GetY(), plr:GetZ(), 2121)
  299.     end
  300.     plr = pUnit:GetMainTank()
  301.     if plr ~= nil then
  302.         if pUnit:GetDistanceYards(plr) < 7 then
  303.             pUnit:StopMovement(2500)
  304.             pUnit:FullCastSpellOnTarget(5213, plr)
  305.         end
  306.     end
  307. end
  308.  
  309. function ZG.VAR.MoveTowardsEnemyZZLord(pUnit)
  310.     if not pUnit:IsInCombat() then
  311.         local plr = pUnit:GetClosestPlayer()
  312.         if plr ~= nil then
  313.             pUnit:SetMovementFlags(1)
  314.             pUnit:MoveTo(plr:GetX(), plr:GetY(), plr:GetZ(), 0)
  315.             pUnit:ChangeTarget(plr)
  316.         end
  317.     end
  318. end
  319.  
  320. function ZG.VAR.SummonWhelpsAndSuchLordd(pUnit)
  321.     if pUnit:GetHealthPct() < 20 then
  322.         local a = pUnit:GetCreatureNearestCoords(-11041, -2334.4, 146.8, 25525)
  323.         local b = pUnit:GetCreatureNearestCoords(-11091, -2332.4, 146.3, 25525)
  324.         if a and b then
  325.             pUnit:RemoveEvents()
  326.             pUnit:Root()
  327.             pUnit:CastSpell(22663) -- immune to all damage
  328.             pUnit:AIDisableCombat(true)
  329.             local ad = pUnit:GetDistanceYards(a)
  330.             local bd = pUnit:GetDistanceYards(b)
  331.             if ad > bd then
  332.                 pUnit:ChannelSpell(76221, b)
  333.                 pUnit:RegisterEvent("ZG.VAR.HatchEggsBBB", 7500, 1)
  334.             else
  335.                 pUnit:ChannelSpell(76221, a)
  336.                 pUnit:RegisterEvent("ZG.VAR.HatchEggsAAA", 7500, 1)
  337.             end
  338.         end
  339.     end
  340. end
  341.  
  342. function ZG.VAR.HatchEggsBBB(pUnit)
  343.     pUnit:RemoveAura(22663)
  344.     pUnit:CastSpell(32711) -- AoE
  345.     pUnit:StopChannel()
  346.     for i=1,math.random(5,12) do
  347.         pUnit:SpawnCreature(497111, -11090.4, -2332, 146.3, 0.206785, 15, 120000)
  348.     end
  349.     pUnit:RegisterEvent("ZG.VAR.KILL_SELF_INSEC", 500, 1)
  350. end
  351.  
  352. function ZG.VAR.HatchEggsAAA(pUnit)
  353.     pUnit:RemoveAura(22663)
  354.     pUnit:CastSpell(32711) -- AoE
  355.     pUnit:StopChannel()
  356.     for i=1,math.random(5,12) do
  357.         pUnit:SpawnCreature(497111, -11042, -2333.4, 146.7, 2.853576, 15, 120000)
  358.     end
  359.     pUnit:RegisterEvent("ZG.VAR.KILL_SELF_INSEC", 250, 1)
  360. end
  361.  
  362. function ZG.VAR.KILL_SELF_INSEC(pUnit)
  363.     pUnit:Kill(pUnit)
  364. end
  365.  
  366. RegisterUnitEvent(871111, 1, "ZG.VAR.DRACONICLORDEVENT")
  367. RegisterUnitEvent(871111, 2, "ZG.VAR.DRACONICLORDEVENT")
  368. RegisterUnitEvent(871111, 4, "ZG.VAR.DRACONICLORDEVENT")
  369. RegisterUnitEvent(871111, 18, "ZG.VAR.DRACONICLORDEVENT")
  370.  
  371. -- Whelps
  372.  
  373. function ZG.VAR.WhelpsOverwhelmingDrac(pUnit, Event)
  374.     pUnit:RegisterEvent("ZG.VAR.WHelpsFactionsMove", math.random(900, 2000), 1)
  375. end
  376.  
  377. function ZG.VAR.WHelpsFactionsMove(pUnit)
  378.     pUnit:SetFaction(21)
  379.     local plr = pUnit:GetRandomPlayer(0)
  380.     if plr ~= nil then
  381.         pUnit:SetMovementFlags(1)
  382.         pUnit:MoveTo(plr:GetX(), plr:GetY(), plr:GetZ(), 0)
  383.         pUnit:ChangeTarget(plr)
  384.     end
  385. end
  386.  
  387. RegisterUnitEvent(497111, 18, "ZG.VAR.WhelpsOverwhelmingDrac")
  388.  
  389. -- avoid these balls
  390.  
  391. function ZG.VAR.DESEMAGIZAVOID(pUnit)
  392.     if Event == 4 then
  393.         pUnit:RemoveEvents()
  394.     else
  395.         pUnit:RegisterEvent("ZG.VAR.VisualReadyGoGO", 1000, 1)
  396.         pUnit:RegisterEvent("ZG.VAR.MOVETOWARDS_PLAYZ", 1000, 0)
  397.     end
  398. end
  399.  
  400. function ZG.VAR.VisualReadyGoGO(pUnit)
  401.     pUnit:ChannelSpell(56220, pUnit)
  402.     pUnit:AIDisableCombat(true)
  403.     pUnit:SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE) -- unselectable
  404. end
  405.  
  406. function ZG.VAR.MOVETOWARDS_PLAYZ(pUnit)
  407.     local plr = pUnit:GetClosestPlayer()
  408.     if plr ~= nil then
  409.         if not plr:IsAlive() then
  410.             plr = pUnit:GetRandomPlayer(0)
  411.             if plr ~= nil then
  412.                 pUnit:MoveTo(plr:GetX(), plr:GetY(), plr:GetZ(), 0)
  413.             end
  414.         else
  415.             local trigger = pUnit:GetCreatureNearestCoords(-11062, -2306, 146, 27942)
  416.             if trigger then
  417.                 if trigger:HasAura(63894) then
  418.                     if pUnit:GetDistanceYards(trigger) < 12 then
  419.                         pUnit:StopMovement(100)
  420.                     end
  421.                 else
  422.                     pUnit:MoveTo(plr:GetX(), plr:GetY(), plr:GetZ(), 0)
  423.                 end
  424.             end
  425.         end
  426.     end
  427.     for _,plrs in pairs(pUnit:GetInRangeUnits()) do
  428.         if plrs:GetDistanceYards(pUnit) < 8 then
  429.             if plrs:IsPlayer() then
  430.                 if pUnit:GetDistanceYards(plrs) < 5 then
  431.                     pUnit:Strike(plrs, 2, 59322, 100, 100, 1)
  432.                 end
  433.             else
  434.                 if plrs:GetEntry() ~= 4052 and plrs:GetEntry() ~= 36544 and plrs:GetEntry() ~= 27942 then
  435.                     if not plrs:HasAura(22663) then
  436.                         if (plrs:GetHealth()-150) < 1 then
  437.                             plrs:Kill(plrs)
  438.                         else
  439.                             plrs:SetHealth(plrs:GetHealth()-150)
  440.                         end
  441.                     end
  442.                 else
  443.                     local choice = math.random(1,11)
  444.                     if choice == 1 then
  445.                         plrs:SendChatMessage(14,0,"Ugh, get this thing off me!")
  446.                     elseif choice == 2 then
  447.                         plrs:SendChatMessage(14,0,"It burns!")
  448.                     end
  449.                 end
  450.             end
  451.         end
  452.     end
  453. end
  454.  
  455. RegisterUnitEvent(21234, 18, "ZG.VAR.DESEMAGIZAVOID")
  456. RegisterUnitEvent(21234, 4, "ZG.VAR.DESEMAGIZAVOID")
Advertisement
Add Comment
Please, Sign In to add comment