stoneharry

Untitled

Jun 25th, 2011
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 30.01 KB | None | 0 0
  1. -------------------
  2. -- By Stoneharry --
  3. -------------------
  4. -- Variable Decleration
  5. -- Configuration
  6.  
  7. ARG = {}
  8. ARG.VAR = {}
  9.  
  10. local Spawned = {}
  11.  
  12. local HANDLER_CREATURE = 780000
  13. local AddA = 780002 -- 4 of them     Gate A
  14. local AddB = 780003 -- 10 of them    Gate A
  15. local AddC = 780004 -- 2 of them     Gate A and B
  16. local AddD = 780005 -- 20 of them    Gate A and B
  17. local AddE = 780006 -- 6 of them     Gate A
  18. local AddF = 780007 -- 15 of them    Gate B
  19. local AddG = 780008 -- 4 of them     Gate A and B
  20. local AddH = 780009 -- 20 of them    no gate
  21. local BossID = 780001
  22. local FIRE = 780010 -- The ID for the lines of fire that spawn
  23.  
  24. local locA, locB, locC = 4523, 2778, 404 -- Randomly moves to one of these two coords on spawn (make near middle)
  25. local locX, locY, locZ = 4522, 2760, 404
  26. local gateAX, gateAY, gateAZ, gateAID = 4522.24, 2740.8, 403.984, 201374 -- The coords then ID of each gate on each side of the room
  27. local gateBX, gateBY, gateBZ, gateBID = 4522.21, 2797.87, 403.984, 201374
  28. local behindGateAX, behindGateAY, behindGateAZ = 4522, 2734, 404 -- The coords behind gate A to spawn mobs
  29. local behindGateBX, behindGateBY, behindGateBZ = 4522, 2804, 404 -- The coords behind gate B to spawn mobs
  30.  
  31. -- Do not touch below unless you are not using 3.3.5a
  32.  
  33. local OBJECT_END = 0x0006
  34. local GAMEOBJECT_BYTES_1 = OBJECT_END + 0x000B
  35. local SMSG_INIT_WORLD_STATES = 0x2C2
  36. local SMSG_UPDATE_WORLD_STATE = 0x2C3
  37.  
  38. SetDBCSpellVar(52989, "c_is_flags", 0x01000)
  39.  
  40. ---------------------------------------------------------
  41. -- Wave Handler -----------------------------------------
  42. ---------------------------------------------------------
  43.  
  44. function ARG.VAR.Invisible_NpcDEFENDMALL(pUnit, Event)
  45.     pUnit:RegisterEvent("ARG.VAR.Check_For_EventDEFENDMALL", 5000, 0)
  46. end
  47.  
  48. function ARG.VAR.Check_For_EventDEFENDMALL(pUnit)
  49.     local id = pUnit:GetInstanceID()
  50.     if id == nil then id = 1 end
  51.     ARG[id] = ARG[id] or {VAR={}}
  52.     if ARG.VAR.CanStart then
  53.         pUnit:RemoveEvents()
  54.         ARG.VAR.CanStart = false
  55.         ARG.VAR.Wave = 1
  56.         ARG.VAR.Dead = 0
  57.         ARG.VAR.gateA = pUnit:GetGameObjectNearestCoords(gateAX, gateAY, gateAZ, gateAID)
  58.         ARG.VAR.gateB = pUnit:GetGameObjectNearestCoords(gateBX, gateBY, gateBZ, gateBID)
  59.         for place, plrs in pairs(pUnit:GetInRangePlayers()) do
  60.             pUnit:SendChatMessageToPlayer(42,0,"The event has begun! Defend the room for all 8 waves.", plrs)
  61.             pack = LuaPacket:CreatePacket(SMSG_INIT_WORLD_STATES, 18) -- Waves remaining
  62.             pack:WriteULong(534) -- Map
  63.             pack:WriteULong(3606) -- Zone
  64.             pack:WriteULong(0)
  65.             pack:WriteUShort(2)
  66.             pack:WriteULong(2842) -- ID
  67.             pack:WriteULong(1) -- Value
  68.             plrs:SendPacketToPlayer(pack)
  69.             pack = LuaPacket:CreatePacket(SMSG_UPDATE_WORLD_STATE, 8)
  70.             pack:WriteULong(2842) -- ID, total
  71.             pack:WriteULong(ARG.VAR.Wave) -- Value
  72.             plrs:SendPacketToPlayer(pack)
  73.             pUnit:SendChatMessageToPlayer(42, 0, "Wave "..ARG.VAR.Wave.."!", plrs) -- 1
  74.         end
  75.         pUnit:PlaySoundToSet(8887) -- Scary music
  76.         pUnit:RegisterEvent("ARG.VAR.Spawn_Adds_DEFENDMALL", 7000, 1)
  77.     end
  78. end
  79.  
  80. RegisterUnitEvent(HANDLER_CREATURE, 18, "ARG.VAR.Invisible_NpcDEFENDMALL")
  81.  
  82. function ARG.VAR.Spawn_Adds_DEFENDMALL(pUnit)
  83.     local id = pUnit:GetInstanceID()
  84.     if id == nil then id = 1 end
  85.     ARG[id] = ARG[id] or {VAR={}}
  86.     if ARG.VAR.gateA ~= nil then
  87.         ARG.VAR.gateA:SetByte(GAMEOBJECT_BYTES_1,0,0) -- Open
  88.         ARG.VAR.Open = true
  89.     end
  90.     local i = 0
  91.     while i ~= 4 do
  92.         i = i + 1
  93.         pUnit:SpawnCreature(AddA, behindGateAX, behindGateAY, behindGateAZ, 0, 15, 180000)
  94.     end
  95.     pUnit:RegisterEvent("ARG.VAR.CheckForDeadAddsOhLol", 10000, 0)
  96.     pUnit:RegisterEvent("ARG.VAR.CHECK_FOR_WIPE_hurpdurpDEFENDMALL", 180000, 1)
  97. end
  98.  
  99. function ARG.VAR.CheckForDeadAddsOhLol(pUnit)
  100.     local id = pUnit:GetInstanceID()
  101.     if id == nil then id = 1 end
  102.     ARG[id] = ARG[id] or {VAR={}}
  103.     if ARG.VAR.Open then
  104.         if ARG.VAR.gateA ~= nil then
  105.             ARG.VAR.gateA:SetByte(GAMEOBJECT_BYTES_1,0,1) -- Close
  106.             ARG.VAR.Open = false
  107.         end
  108.     end
  109.     if ARG.VAR.Dead > 3 then
  110.         ARG.VAR.Wave = ARG.VAR.Wave + 1
  111.         pUnit:RemoveEvents()
  112.         for place, plrs in pairs(pUnit:GetInRangePlayers()) do
  113.             pack = LuaPacket:CreatePacket(SMSG_UPDATE_WORLD_STATE, 8)
  114.             pack:WriteULong(2842) -- ID, total
  115.             pack:WriteULong(ARG.VAR.Wave) -- Value
  116.             plrs:SendPacketToPlayer(pack)
  117.             pUnit:SendChatMessageToPlayer(42, 0, "Wave "..ARG.VAR.Wave.."!", plrs) -- 2
  118.         end
  119.         if ARG.VAR.gateA ~= nil then
  120.             ARG.VAR.gateA:SetByte(GAMEOBJECT_BYTES_1,0,0) -- Open
  121.             ARG.VAR.Open = true
  122.         end
  123.         local i = 0
  124.         while i ~= 10 do
  125.             i = i + 1
  126.             pUnit:SpawnCreature(AddB, behindGateAX, behindGateAY, behindGateAZ, 0, 15, 300000)
  127.         end
  128.         pUnit:RegisterEvent("ARG.VAR.Check_For_All_DeadDEFENDMALL", 10000, 0)
  129.         pUnit:RegisterEvent("ARG.VAR.CHECK_FOR_WIPE_hurpdurpDEFENDMALL", 300000, 1)
  130.     end
  131. end
  132.  
  133. function ARG.VAR.Check_For_All_DeadDEFENDMALL(pUnit)
  134.     local id = pUnit:GetInstanceID()
  135.     if id == nil then id = 1 end
  136.     ARG[id] = ARG[id] or {VAR={}}
  137.     if ARG.VAR.Open then
  138.         if ARG.VAR.gateA ~= nil then
  139.             ARG.VAR.gateA:SetByte(GAMEOBJECT_BYTES_1,0,1) -- Close
  140.             ARG.VAR.Open = false
  141.         end
  142.     end
  143.     if ARG.VAR.Dead > 11 then
  144.         pUnit:RemoveEvents()
  145.         ARG.VAR.Wave = ARG.VAR.Wave + 1
  146.         for place, plrs in pairs(pUnit:GetInRangePlayers()) do
  147.             pack = LuaPacket:CreatePacket(SMSG_UPDATE_WORLD_STATE, 8)
  148.             pack:WriteULong(2842) -- ID, total
  149.             pack:WriteULong(ARG.VAR.Wave) -- Value
  150.             plrs:SendPacketToPlayer(pack)
  151.             pUnit:SendChatMessageToPlayer(42, 0, "Wave "..ARG.VAR.Wave.."!", plrs) -- 3
  152.         end
  153.         if ARG.VAR.gateA ~= nil then
  154.             ARG.VAR.gateA:SetByte(GAMEOBJECT_BYTES_1,0,0) -- Open
  155.             ARG.VAR.Open = true
  156.         end
  157.         if ARG.VAR.gateB ~= nil then
  158.             ARG.VAR.gateB:SetByte(GAMEOBJECT_BYTES_1,0,0) -- Open
  159.             ARG.VAR.Open = true
  160.         end
  161.         for place,creature in pairs(Spawned) do
  162.             if creature ~= nil then
  163.                 if creature:IsInWorld() then
  164.                     if creature:IsAlive() == false then
  165.                         if creature:GetInstanceID() == id then
  166.                             creature:Despawn(1000,0)
  167.                         end
  168.                     end
  169.                 end
  170.             end
  171.         end
  172.         pUnit:SpawnCreature(AddC, behindGateAX, behindGateAY, behindGateAZ, 0, 15, 320000)
  173.         pUnit:SpawnCreature(AddC, behindGateBX, behindGateBY, behindGateBZ, 0, 15, 320000)
  174.         pUnit:RegisterEvent("ARG.VAR.CHECK_FOR_WIPE_hurpdurpDEFENDMALL", 320000, 1)
  175.         pUnit:RegisterEvent("ARG.VAR.Check_For_ADDCDEATHS_DEFENDMALL", 10000, 0)
  176.     end
  177. end
  178.  
  179. function ARG.VAR.Check_For_ADDCDEATHS_DEFENDMALL(pUnit)
  180.     local id = pUnit:GetInstanceID()
  181.     if id == nil then id = 1 end
  182.     ARG[id] = ARG[id] or {VAR={}}
  183.     if ARG.VAR.Open then
  184.         if ARG.VAR.gateA ~= nil then
  185.             ARG.VAR.gateA:SetByte(GAMEOBJECT_BYTES_1,0,1) -- Close
  186.             ARG.VAR.Open = false
  187.         end
  188.         if ARG.VAR.gateB ~= nil then
  189.             ARG.VAR.gateB:SetByte(GAMEOBJECT_BYTES_1,0,1) -- Close
  190.             ARG.VAR.Open = false
  191.         end
  192.     end
  193.     if ARG.VAR.Dead > 13 then
  194.         pUnit:RemoveEvents()
  195.         ARG.VAR.Wave = ARG.VAR.Wave + 1
  196.         for place, plrs in pairs(pUnit:GetInRangePlayers()) do
  197.             pack = LuaPacket:CreatePacket(SMSG_UPDATE_WORLD_STATE, 8)
  198.             pack:WriteULong(2842) -- ID, total
  199.             pack:WriteULong(ARG.VAR.Wave) -- Value
  200.             plrs:SendPacketToPlayer(pack)
  201.             pUnit:SendChatMessageToPlayer(42, 0, "Wave "..ARG.VAR.Wave.."!", plrs) -- 4
  202.         end
  203.         pUnit:RegisterEvent("ARG.VAR.Break_Break_GiveBreak_DEFENDMALL", 8000, 1)
  204.     end
  205. end
  206.  
  207. function ARG.VAR.Break_Break_GiveBreak_DEFENDMALL(pUnit)
  208.     local id = pUnit:GetInstanceID()
  209.     if id == nil then id = 1 end
  210.     ARG[id] = ARG[id] or {VAR={}}
  211.     local i = 0
  212.     while i ~= 20 do
  213.         i = i + 1
  214.         if math.random(1,2) == 1 then
  215.             pUnit:SpawnCreature(AddD, behindGateAX, behindGateAY, behindGateAZ , 0, 15, 180000)
  216.         else
  217.             pUnit:SpawnCreature(AddD, behindGateBX, behindGateBY, behindGateBZ , 0, 15, 180000)
  218.         end
  219.     end
  220.     if ARG.VAR.gateA ~= nil then
  221.         ARG.VAR.gateA:SetByte(GAMEOBJECT_BYTES_1,0,0) -- Open
  222.         ARG.VAR.Open = true
  223.     end
  224.     if ARG.VAR.gateB ~= nil then
  225.         ARG.VAR.gateB:SetByte(GAMEOBJECT_BYTES_1,0,0) -- Open
  226.         ARG.VAR.Open = true
  227.     end
  228.     pUnit:RegisterEvent("ARG.VAR.CHECK_FOR_WIPE_hurpdurpDEFENDMALL", 180000, 1)
  229.     pUnit:RegisterEvent("ARG.VAR.Check_For_mobDDeaths_Yarp", 10000, 0)
  230. end
  231.  
  232. function ARG.VAR.Check_For_mobDDeaths_Yarp(pUnit)
  233.     local id = pUnit:GetInstanceID()
  234.     if id == nil then id = 1 end
  235.     ARG[id] = ARG[id] or {VAR={}}
  236.     if ARG.VAR.Open then
  237.         if ARG.VAR.gateA ~= nil then
  238.             ARG.VAR.gateA:SetByte(GAMEOBJECT_BYTES_1,0,1) -- Close
  239.             ARG.VAR.Open = false
  240.         end
  241.         if ARG.VAR.gateB ~= nil then
  242.             ARG.VAR.gateB:SetByte(GAMEOBJECT_BYTES_1,0,1) -- Close
  243.             ARG.VAR.Open = false
  244.         end
  245.     end
  246.     if ARG.VAR.Dead > 35 then
  247.         pUnit:RemoveEvents()
  248.         ARG.VAR.Wave = ARG.VAR.Wave + 1
  249.         for place, plrs in pairs(pUnit:GetInRangePlayers()) do
  250.             pack = LuaPacket:CreatePacket(SMSG_UPDATE_WORLD_STATE, 8)
  251.             pack:WriteULong(2842) -- ID, total
  252.             pack:WriteULong(ARG.VAR.Wave) -- Value
  253.             plrs:SendPacketToPlayer(pack)
  254.             pUnit:SendChatMessageToPlayer(42, 0, "Wave "..ARG.VAR.Wave.."!", plrs) -- 5
  255.         end
  256.         pUnit:PlaySoundToSet(15119)
  257.         pUnit:RegisterEvent("ARG.VAR.WAIT_FOR_THE_RIGHT_MOMENT_DUN_DUN_DEFENDMALL", 7500, 1)
  258.     end
  259. end
  260.  
  261. function ARG.VAR.WAIT_FOR_THE_RIGHT_MOMENT_DUN_DUN_DEFENDMALL(pUnit)
  262.     local id = pUnit:GetInstanceID()
  263.     if id == nil then id = 1 end
  264.     ARG[id] = ARG[id] or {VAR={}}
  265.     local i = 0
  266.     while i ~= 6 do
  267.         i = i + 1
  268.         pUnit:SpawnCreature(AddE, behindGateAX, behindGateAY, behindGateAZ , 0, 15, 380000)
  269.     end
  270.     if ARG.VAR.gateA ~= nil then
  271.         ARG.VAR.gateA:SetByte(GAMEOBJECT_BYTES_1,0,0) -- Open
  272.         ARG.VAR.Open = true
  273.     end
  274.     pUnit:RegisterEvent("ARG.VAR.CHECK_FOR_WIPE_hurpdurpDEFENDMALL", 380000, 1)
  275.     pUnit:RegisterEvent("ARG.VAR.CHECK_FOR_DEAD_MALLEVENTgtoustwo", 10000, 0)
  276. end
  277.  
  278. function ARG.VAR.CHECK_FOR_DEAD_MALLEVENTgtoustwo(pUnit)
  279.     local id = pUnit:GetInstanceID()
  280.     if id == nil then id = 1 end
  281.     ARG[id] = ARG[id] or {VAR={}}
  282.     if ARG.VAR.Open then
  283.         if ARG.VAR.gateA ~= nil then
  284.             ARG.VAR.gateA:SetByte(GAMEOBJECT_BYTES_1,0,1) -- Close
  285.             ARG.VAR.Open = false
  286.         end
  287.     end
  288.     if ARG.VAR.Dead > 40 then
  289.         pUnit:RemoveEvents()
  290.         ARG.VAR.Wave = ARG.VAR.Wave + 1
  291.         for place, plrs in pairs(pUnit:GetInRangePlayers()) do
  292.             pack = LuaPacket:CreatePacket(SMSG_UPDATE_WORLD_STATE, 8)
  293.             pack:WriteULong(2842) -- ID, total
  294.             pack:WriteULong(ARG.VAR.Wave) -- Value
  295.             plrs:SendPacketToPlayer(pack)
  296.             pUnit:SendChatMessageToPlayer(42, 0, "Wave "..ARG.VAR.Wave.."!", plrs) -- 6
  297.         end
  298.         pUnit:RegisterEvent("ARG.VAR.WAIT_FOR_THE_RIGHT_MOMENT_DUN_DUN_DEFENDMALLtwo", 7500, 1)
  299.     end
  300. end
  301.  
  302. function ARG.VAR.WAIT_FOR_THE_RIGHT_MOMENT_DUN_DUN_DEFENDMALLtwo(pUnit)
  303.     local id = pUnit:GetInstanceID()
  304.     if id == nil then id = 1 end
  305.     ARG[id] = ARG[id] or {VAR={}}
  306.     local i = 0
  307.     while i ~= 15 do
  308.         i = i + 1
  309.         pUnit:SpawnCreature(AddF, behindGateBX, behindGateBY, behindGateBZ , 0, 15, 280000)
  310.     end
  311.     if ARG.VAR.gateB ~= nil then
  312.         ARG.VAR.gateB:SetByte(GAMEOBJECT_BYTES_1,0,0) -- Open
  313.         ARG.VAR.Open = true
  314.     end
  315.     pUnit:RegisterEvent("ARG.VAR.CHECK_FOR_WIPE_hurpdurpDEFENDMALL", 280000, 1)
  316.     pUnit:RegisterEvent("ARG.VAR.CHECK_FOR_DEAD_MALLEVENTaaassssffff", 10000, 0)
  317. end
  318.  
  319. function ARG.VAR.CHECK_FOR_DEAD_MALLEVENTaaassssffff(pUnit)
  320.     if ARG.VAR.Open then
  321.         if ARG.VAR.gateB ~= nil then
  322.             ARG.VAR.gateB:SetByte(GAMEOBJECT_BYTES_1,0,1) -- Close
  323.             ARG.VAR.Open = false
  324.         end
  325.     end
  326.     if ARG.VAR.Dead > 54 then
  327.         pUnit:RemoveEvents()
  328.         ARG.VAR.Wave = ARG.VAR.Wave + 1
  329.         for place, plrs in pairs(pUnit:GetInRangePlayers()) do
  330.             pack = LuaPacket:CreatePacket(SMSG_UPDATE_WORLD_STATE, 8)
  331.             pack:WriteULong(2842) -- ID, total
  332.             pack:WriteULong(ARG.VAR.Wave) -- Value
  333.             plrs:SendPacketToPlayer(pack)
  334.             pUnit:SendChatMessageToPlayer(42, 0, "Wave "..ARG.VAR.Wave.."!", plrs) -- 7
  335.         end
  336.         for place,creature in pairs(Spawned) do
  337.             if creature ~= nil then
  338.                 if creature:IsInWorld() then
  339.                     if creature:IsAlive() == false then
  340.                         if creature:GetInstanceID() == id then
  341.                             creature:Despawn(1000,0)
  342.                         end
  343.                     end
  344.                 end
  345.             end
  346.         end
  347.         pUnit:RegisterEvent("ARG.VAR.WAIT_FOR_THE_RIGHT_MOMENT_DUN_DUN_DEFENDMALLgaga", 7500, 1)
  348.     end
  349. end
  350.  
  351. function ARG.VAR.WAIT_FOR_THE_RIGHT_MOMENT_DUN_DUN_DEFENDMALLgaga(pUnit)
  352.     local id = pUnit:GetInstanceID()
  353.     if id == nil then id = 1 end
  354.     ARG[id] = ARG[id] or {VAR={}}
  355.     local i = 0
  356.     while i ~= 4 do
  357.         i = i + 1
  358.         if math.random(1,2) == 1 then
  359.             pUnit:SpawnCreature(AddG, behindGateAX, behindGateAY, behindGateAZ , 0, 15, 480000)
  360.         else
  361.             pUnit:SpawnCreature(AddG, behindGateBX, behindGateBY, behindGateBZ , 0, 15, 480000)
  362.         end
  363.     end
  364.     if ARG.VAR.gateA ~= nil then
  365.         ARG.VAR.gateA:SetByte(GAMEOBJECT_BYTES_1,0,0) -- Open
  366.         ARG.VAR.Open = true
  367.     end
  368.     if ARG.VAR.gateB ~= nil then
  369.         ARG.VAR.gateB:SetByte(GAMEOBJECT_BYTES_1,0,0) -- Open
  370.         ARG.VAR.Open = true
  371.     end
  372.     pUnit:RegisterEvent("ARG.VAR.CHECK_FOR_WIPE_hurpdurpDEFENDMALL", 480000, 1)
  373.     pUnit:RegisterEvent("ARG.VAR.Check_For_mobDDeaths_Yarpgggggh", 10000, 0)
  374. end
  375.  
  376. function ARG.VAR.Check_For_mobDDeaths_Yarpgggggh(pUnit)
  377.     local id = pUnit:GetInstanceID()
  378.     if id == nil then id = 1 end
  379.     ARG[id] = ARG[id] or {VAR={}}
  380.     if ARG.VAR.Open then
  381.         if ARG.VAR.gateA ~= nil then
  382.             ARG.VAR.gateA:SetByte(GAMEOBJECT_BYTES_1,0,1) -- Close
  383.             ARG.VAR.Open = false
  384.         end
  385.         if ARG.VAR.gateB ~= nil then
  386.             ARG.VAR.gateB:SetByte(GAMEOBJECT_BYTES_1,0,1) -- Close
  387.             ARG.VAR.Open = false
  388.         end
  389.     end
  390.     if ARG.VAR.Dead > 59 then
  391.         pUnit:RemoveEvents()
  392.         ARG.VAR.Wave = ARG.VAR.Wave + 1
  393.         for place, plrs in pairs(pUnit:GetInRangePlayers()) do
  394.             pack = LuaPacket:CreatePacket(SMSG_UPDATE_WORLD_STATE, 8)
  395.             pack:WriteULong(2842) -- ID, total
  396.             pack:WriteULong(ARG.VAR.Wave) -- Value
  397.             plrs:SendPacketToPlayer(pack)
  398.             pUnit:SendChatMessageToPlayer(42, 0, "Wave "..ARG.VAR.Wave.."!", plrs) -- 8
  399.         end
  400.         pUnit:RegisterEvent("ARG.VAR.FINALWAVE_DEFENDMALL", 8000, 1)
  401.     end
  402. end
  403.  
  404. function ARG.VAR.FINALWAVE_DEFENDMALL(pUnit)
  405.     local i = 0
  406.     local pla = nil
  407.     while i ~= 20 do
  408.         i = i + 1
  409.         pla = pUnit:GetRandomPlayer(0)
  410.         if pla ~= nil then
  411.             pUnit:SpawnCreature(AddH, pla:GetX(), pla:GetY(), pla:GetZ(), 0, 15, 300000)
  412.         end
  413.     end
  414.     pUnit:RegisterEvent("ARG.VAR.CHECK_FOR_WIPE_hurpdurpDEFENDMALL", 300000, 1)
  415.     pUnit:RegisterEvent("ARG.VAR.WAVES_COMPLETE_BOSS_DUNDUN", 10000, 0)
  416. end
  417.  
  418. function ARG.VAR.WAVES_COMPLETE_BOSS_DUNDUN(pUnit)
  419.     local id = pUnit:GetInstanceID()
  420.     if id == nil then id = 1 end
  421.     ARG[id] = ARG[id] or {VAR={}}
  422.     if ARG.VAR.Dead > 63 then
  423.         pUnit:RemoveEvents()
  424.         ARG.VAR.Wave = 1
  425.         ARG.VAR.Dead = 0
  426.         local Grill = pUnit:GetGameObjectNearestCoords(4522, 2769, 404, 201755) -- x,y,z,id
  427.         if Grill ~= nil then
  428.             Grill:SetByte(GAMEOBJECT_BYTES_1,0,0) -- Open Trap
  429.             pUnit:PlaySoundToSet(16541)
  430.             Grill:Despawn(30000, 30000)
  431.         end
  432.         for place, plrs in pairs(pUnit:GetInRangePlayers()) do
  433.             pUnit:SendChatMessageToPlayer(42, 0, "The way to the boss is clear!", plrs)
  434.         end
  435.         pUnit:SpawnCreature(BossID, 4575, 2768, 361.3, 3.121345, 35, 0)
  436.         pUnit:RegisterEvent("ARG.VAR.Check_For_EventDEFENDMALL", 10000, 0) -- CanStart is not true yet
  437.     end
  438. end
  439.  
  440. --
  441.  
  442. function ARG.VAR.CHECK_FOR_WIPE_hurpdurpDEFENDMALL(pUnit)
  443.     local id = pUnit:GetInstanceID()
  444.     if id == nil then id = 1 end
  445.     ARG[id] = ARG[id] or {VAR={}}
  446.     pUnit:RemoveEvents()
  447.     ARG.VAR.Wave = 1
  448.     ARG.VAR.Dead = 0
  449.     if ARG.VAR.Open then
  450.         if ARG.VAR.gateA ~= nil then
  451.             ARG.VAR.gateA:SetByte(GAMEOBJECT_BYTES_1,0,1) -- Close
  452.             ARG.VAR.Open = false
  453.         end
  454.         if ARG.VAR.gateB ~= nil then
  455.             ARG.VAR.gateB:SetByte(GAMEOBJECT_BYTES_1,0,1) -- Close
  456.             ARG.VAR.Open = false
  457.         end
  458.     end
  459.     pUnit:RegisterEvent("ARG.VAR.Check_For_EventDEFENDMALL", 10000, 0)
  460. end
  461.  
  462. ---------------------------------------------------------
  463. -- Add Scripts ------------------------------------------
  464. ---------------------------------------------------------
  465.  
  466. function ARG.VAR.Adds_OnSpawn_ohlol(pUnit, Event)
  467.     table.insert(Spawned, pUnit)
  468.     pUnit:SetMovementFlags(1)
  469.     pUnit:RegisterEvent("ARG.VAR.SetFaction_Hostile_After_Gate", 2500, 1)
  470.     if pUnit:GetEntry() == AddC then
  471.         pUnit:RegisterEvent("ARG.VAR.Cast_ADDC_DEFENDMALL", math.random(6000, 12000), 0)
  472.     elseif pUnit:GetEntry() == AddG then
  473.         pUnit:RegisterEvent("ARG.VAR.CastSoekks_DEFENDMALL", math.random(2000, 12000), 1)
  474.     elseif pUnit:GetEntry() == AddH then
  475.         pUnit:RegisterEvent("ARG.VAR.SPawnVisual_teoaj", math.random(250, 1000), 1)
  476.     end
  477. end
  478.  
  479. function ARG.VAR.SetFaction_Hostile_After_Gate(pUnit)
  480.     pUnit:SetMovementFlags(1)
  481.     pUnit:SetFaction(21)
  482.     if math.random(1,2) == 1 then
  483.         pUnit:MoveTo(locA+math.random(0,2),locB-math.random(0,2),locC,0)
  484.     else
  485.         pUnit:MoveTo(locX-math.random(0,2),locY+math.random(0,2),locZ,0)
  486.     end
  487. end
  488.  
  489. function ARG.VAR.Adds_OnDead_Ohlol(pUnit)
  490.     pUnit:RemoveEvents()
  491.     local id = pUnit:GetInstanceID()
  492.     if id == nil then id = 1 end
  493.     ARG[id] = ARG[id] or {VAR={}}
  494.     ARG.VAR.Dead = ARG.VAR.Dead + 1
  495.     --pUnit:Despawn(10,0) -- bugs
  496. end
  497.  
  498. function ARG.VAR.Cast_ADDC_DEFENDMALL(pUnit)
  499.     pUnit:FullCastSpell(36132) -- Normal damage + 300 for two strong adds
  500. end
  501.  
  502. function ARG.VAR.CastSoekks_DEFENDMALL(pUnit)
  503.     pUnit:CastSpell(15636) -- Avatar of flame
  504. end
  505.  
  506. function ARG.VAR.SPawnVisual_teoaj(pUnit)
  507.     pUnit:CastSpell(64446) -- Teleport visual
  508. end
  509.  
  510. RegisterUnitEvent(AddA, 18, "ARG.VAR.Adds_OnSpawn_ohlol")
  511. RegisterUnitEvent(AddB, 18, "ARG.VAR.Adds_OnSpawn_ohlol")
  512. RegisterUnitEvent(AddC, 18, "ARG.VAR.Adds_OnSpawn_ohlol")
  513. RegisterUnitEvent(AddD, 18, "ARG.VAR.Adds_OnSpawn_ohlol")
  514. RegisterUnitEvent(AddE, 18, "ARG.VAR.Adds_OnSpawn_ohlol")
  515. RegisterUnitEvent(AddF, 18, "ARG.VAR.Adds_OnSpawn_ohlol")
  516. RegisterUnitEvent(AddG, 18, "ARG.VAR.Adds_OnSpawn_ohlol")
  517. RegisterUnitEvent(AddH, 18, "ARG.VAR.Adds_OnSpawn_ohlol")
  518.  
  519. RegisterUnitEvent(AddA, 4, "ARG.VAR.Adds_OnDead_Ohlol")
  520. RegisterUnitEvent(AddB, 4, "ARG.VAR.Adds_OnDead_Ohlol")
  521. RegisterUnitEvent(AddC, 4, "ARG.VAR.Adds_OnDead_Ohlol")
  522. RegisterUnitEvent(AddD, 4, "ARG.VAR.Adds_OnDead_Ohlol")
  523. RegisterUnitEvent(AddE, 4, "ARG.VAR.Adds_OnDead_Ohlol")
  524. RegisterUnitEvent(AddF, 4, "ARG.VAR.Adds_OnDead_Ohlol")
  525. RegisterUnitEvent(AddG, 4, "ARG.VAR.Adds_OnDead_Ohlol")
  526. RegisterUnitEvent(AddH, 4, "ARG.VAR.Adds_OnDead_Ohlol")
  527.  
  528. ---------------------------------------------------------
  529. -- Boss -------------------------------------------------
  530. ---------------------------------------------------------
  531.  
  532. function ARG.VAR.BOSS_ONDEATH_HURPDURP(pUnit)
  533.     pUnit:RemoveEvents()
  534.     pUnit:SendChatMessage(12,0,"Death... Is only the beginning.")
  535.     for place, plrs in pairs(pUnit:GetInRangePlayers()) do
  536.         pack = LuaPacket:CreatePacket(SMSG_INIT_WORLD_STATES, 18) -- Waves remaining
  537.         pack:WriteULong(0) -- Map
  538.         pack:WriteULong(0) -- Zone
  539.         pack:WriteULong(0)
  540.         pack:WriteUShort(0)
  541.         pack:WriteULong(0) -- ID
  542.         pack:WriteULong(0) -- Value
  543.         plrs:SendPacketToPlayer(pack)
  544.     end
  545. end
  546.  
  547. function ARG.VAR.BOSS_ONLEAVE_HURPDURP(pUnit)
  548.     pUnit:RemoveEvents()
  549. end
  550.  
  551. function ARG.VAR.Boss_ONSPAWN_DEFENDMALL(pUnit)
  552.     pUnit:RegisterEvent("ARG.VAR.CheckFOrPlayers_HUtoayp", 2500, 0)
  553. end
  554.  
  555. function ARG.VAR.CheckFOrPlayers_HUtoayp(pUnit)
  556.     local plr = pUnit:GetClosestPlayer()
  557.     if plr ~= nil then
  558.         if pUnit:GetDistanceYards(plr) < 12 then
  559.             for place,creature in pairs(Spawned) do
  560.                 if creature ~= nil then
  561.                     if creature:IsInWorld() then
  562.                         if creature:IsAlive() == false then
  563.                             if creature:GetInstanceID() == id then
  564.                                 creature:Despawn(1000,0)
  565.                             end
  566.                         end
  567.                     end
  568.                 end
  569.             end
  570.             pUnit:RemoveEvents()
  571.             pUnit:SendChatMessage(12,0,"Welcome all, salutations are in order. My name is Arugal and unfortunately, you appear to be on tonights menu.")
  572.             pUnit:MoveTo(4552.8, 2769.2, 351.4, 3)
  573.             pUnit:EquipWeapons(18842, 0, 0)
  574.             pUnit:RegisterEvent("ARG.VAR.WalkingDownStairs_DEFENDMALL", 11000, 1)
  575.         end
  576.     end
  577. end
  578.  
  579. function ARG.VAR.WalkingDownStairs_DEFENDMALL(pUnit)
  580.     pUnit:SendChatMessage(12,0,"Let me tenderise you all.")
  581.     pUnit:Emote(1,3000)
  582.     pUnit:RegisterEvent("ARG.VAR.Delay_A_Moment_GPOAJ", 4000, 1)
  583. end
  584.  
  585. function ARG.VAR.Delay_A_Moment_GPOAJ(pUnit)
  586.     pUnit:CastSpell(29880) -- Mana shield
  587.     pUnit:Root()
  588.     pUnit:SetFaction(21)
  589.     local plr = nil
  590.     local i = 0
  591.     while i ~= 10 do
  592.         i = i + 1
  593.         plr = pUnit:GetRandomPlayer(0)
  594.         if plr ~= nil then
  595.             pUnit:CastSpellOnTarget(52257, plr) -- Shadowbolt
  596.             pUnit:CastSpellOnTarget(7124, plr) -- Damage
  597.         end
  598.     end
  599.     pUnit:RegisterEvent("ARG.VAR.Shadowbolt_Spam_Three_Argual", 3005, 0)
  600.     pUnit:RegisterEvent("ARG.VAR.VolleyOfShadowbolts", 7000, 0)
  601.     pUnit:RegisterEvent("ARG.VAR.CheckForManaPCTPCTPCT", 2500, 0)
  602. end
  603.  
  604. function ARG.VAR.Shadowbolt_Spam_Three_Argual(pUnit)
  605.     local plr = pUnit:GetRandomPlayer(0)
  606.     if plr ~= nil then
  607.         if math.random(1,2) == 1 then
  608.             pUnit:FullCastSpellOnTarget(12739, plr) -- shadowbolt
  609.         else
  610.             pUnit:FullCastSpell(39082) -- shadowfury
  611.         end
  612.     end
  613. end
  614.  
  615. function ARG.VAR.VolleyOfShadowbolts(pUnit)
  616.     pUnit:CastSpell(29166) -- Innervate
  617.     local plr = nil
  618.     local i = 0
  619.     while i ~= 10 do
  620.         i = i + 1
  621.         plr = pUnit:GetRandomPlayer(0)
  622.         if plr ~= nil then
  623.             pUnit:CastSpellOnTarget(52257, plr) -- Shadowbolt
  624.         end
  625.     end
  626. end
  627.  
  628. function ARG.VAR.CheckForManaPCTPCTPCT(pUnit)
  629.     if pUnit:GetManaPct() < 86 then
  630.         pUnit:RemoveEvents()
  631.         pUnit:SendChatMessage(12,0,"You're still underdone. Let me see if I can speed up the process.")
  632.         pUnit:Unroot()
  633.         pUnit:SetCombatCapable(1)
  634.         pUnit:SetMovementFlags(1) -- Run
  635.         for place, plrs in pairs(pUnit:GetInRangePlayers()) do
  636.             plrs:CastSpell(46416) -- Stun
  637.         end
  638.         pUnit:MoveTo(4522.52, 2769.3, 351.5, 0)
  639.         pUnit:RegisterEvent("ARG.VAR.ResetPlayershurpdurp", 5000, 1)
  640.     end
  641. end
  642.  
  643. function ARG.VAR.ResetPlayershurpdurp(pUnit)
  644.     pUnit:MoveTo(4522.52, 2769.3, 351.5, 0)
  645.     pUnit:Root()
  646.     pUnit:SetCombatCapable(0)
  647.     for place, plrs in pairs(pUnit:GetInRangePlayers()) do
  648.         plrs:RemoveAura(46416) -- Stun
  649.     end
  650.     pUnit:RegisterEvent("ARG.VAR.Stoneharry_FireLines", 1000, 1)
  651.     pUnit:RegisterEvent("ARG.VAR.Shadowbolt_Spam_Three_Argual", 3005, 0)
  652.     pUnit:RegisterEvent("ARG.VAR.VolleyOfShadowbolts", 7000, 0)
  653.     pUnit:RegisterEvent("ARG.VAR.FlyPhaseDUndundun", 5000, 0)
  654.     pUnit:RegisterEvent("ARG.VAR.LightningVisual_DEFENDMALL", 6397, 0)
  655.    
  656. end
  657.  
  658. function ARG.VAR.LightningVisual_DEFENDMALL(pUnit)
  659.     local plz = pUnit:GetRandomPlayer(0)
  660.     if plz ~= nil then
  661.         pUnit:CastSpellOnTarget(37848, plz)
  662.         pUnit:FullCastSpell(17228)
  663.     end
  664.     plz = pUnit:GetClosestPlayer()
  665.     if plz ~= nil then
  666.         if pUnit:GetDistanceYards(plz) < 10 then
  667.             pUnit:CastSpellOnTarget(24199,plz)
  668.         end
  669.     end
  670. end
  671.  
  672. function ARG.VAR.Stoneharry_FireLines(pUnit)
  673.     -- So we are random timer each time
  674.     pUnit:RegisterEvent("ARG.VAR.Stoneharry_FireLines", math.random(4000, 10000), 1)
  675.     -- We have four directions in which to go in
  676.     local choice = math.random(1,4)
  677.     if choice == 1 then
  678.         -- Direction 1
  679.         pUnit:SpawnCreature(FIRE, pUnit:GetX()+5, pUnit:GetY(), pUnit:GetZ(), 0, 21, 4500)
  680.         zX = pUnit:GetX()+5
  681.         -- Keep them spawning in the line
  682.         pUnit:RegisterEvent("ARG.VAR.Keep_spawning_fires_in_a_line", 750, 5)
  683.     elseif choice == 2 then
  684.         pUnit:SpawnCreature(FIRE, pUnit:GetX(), pUnit:GetY()+5, pUnit:GetZ(), 0, 21, 4500)
  685.         zX = pUnit:GetY()+5
  686.         pUnit:RegisterEvent("ARG.VAR.zKeep_spawning_fires_in_a_line", 750, 5)
  687.     elseif choice == 3 then
  688.         pUnit:SpawnCreature(FIRE, pUnit:GetX()+5, pUnit:GetY()+5, pUnit:GetZ(), 0, 21, 4500)
  689.         zX = pUnit:GetY()+5
  690.         zY = pUnit:GetX()+5
  691.         pUnit:RegisterEvent("ARG.VAR.zzKeep_spawning_fires_in_a_line", 750, 5) 
  692.     elseif choice == 4 then
  693.         pUnit:SpawnCreature(FIRE, pUnit:GetX()-5, pUnit:GetY()-5, pUnit:GetZ(), 0, 21, 4500)
  694.         zX = pUnit:GetY()-5
  695.         zY = pUnit:GetX()-5
  696.         pUnit:RegisterEvent("ARG.VAR.zzzKeep_spawning_fires_in_a_line", 750, 5)
  697.     elseif choice == 5 then
  698.         pUnit:SpawnCreature(FIRE, pUnit:GetX()-5, pUnit:GetY()+5, pUnit:GetZ(), 0, 21, 4500)
  699.         zX = pUnit:GetY()+5
  700.         zY = pUnit:GetX()-5
  701.         pUnit:RegisterEvent("ARG.VAR.zzzzKeep_spawning_fires_in_a_line", 750, 5)   
  702.     elseif choice == 5 then
  703.         pUnit:SpawnCreature(FIRE, pUnit:GetX()+5, pUnit:GetY()-5, pUnit:GetZ(), 0, 21, 4500)
  704.         zX = pUnit:GetY()-5
  705.         zY = pUnit:GetX()+5
  706.         pUnit:RegisterEvent("ARG.VAR.zzzzzKeep_spawning_fires_in_a_line", 750, 5)  
  707.     end
  708. end
  709.  
  710. function ARG.VAR.Keep_spawning_fires_in_a_line(pUnit)
  711.     zX = zX + 5 -- left
  712.     pUnit:SpawnCreature(FIRE, zX, pUnit:GetY(), pUnit:GetZ(), 0, 21, 5000) 
  713. end
  714.  
  715. function ARG.VAR.zKeep_spawning_fires_in_a_line(pUnit)
  716.     zX = zX + 5 -- Right
  717.     pUnit:SpawnCreature(FIRE, pUnit:GetX(), zX, pUnit:GetZ(), 0, 21, 5000) 
  718. end
  719.  
  720. function ARG.VAR.zzKeep_spawning_fires_in_a_line(pUnit)
  721.     zX = zX + 5 -- Up
  722.     zY = zY + 5 -- Up
  723.     pUnit:SpawnCreature(FIRE, zY, zX, pUnit:GetZ(), 0, 21, 5000)   
  724. end
  725.  
  726. function ARG.VAR.zzzKeep_spawning_fires_in_a_line(pUnit)
  727.     zX = zX - 5 -- Down
  728.     zY = zY - 5 -- Down
  729.     pUnit:SpawnCreature(FIRE, zY, zX, pUnit:GetZ(), 0, 21, 5000)   
  730. end
  731.  
  732. function ARG.VAR.zzzzKeep_spawning_fires_in_a_line(pUnit)
  733.     zX = zX - 5
  734.     zY = zY + 5
  735.     pUnit:SpawnCreature(FIRE, zY, zX, pUnit:GetZ(), 0, 21, 5000)   
  736. end
  737.  
  738. function ARG.VAR.zzzzzKeep_spawning_fires_in_a_line(pUnit)
  739.     zX = zX + 5 -- Down
  740.     zY = zY - 5 -- Down
  741.     pUnit:SpawnCreature(FIRE, zY, zX, pUnit:GetZ(), 0, 21, 5000)   
  742. end
  743.  
  744. function ARG.VAR.FlyPhaseDUndundun(pUnit)
  745.     if pUnit:GetManaPct() < 50 then
  746.         for place, plrs in pairs(pUnit:GetInRangePlayers()) do
  747.             plrs:EnableFlight(true)
  748.         end
  749.         pUnit:CastSpell(29166) -- Innervate
  750.         pUnit:RemoveEvents()
  751.         pUnit:SendChatMessage(12,0,"I think you would taste better overdone afterall!")
  752.         pUnit:Unroot()
  753.         pUnit:SetMovementFlags(2)
  754.         pUnit:SetCombatCapable(1)
  755.         pUnit:CastSpell(41918) -- Visual
  756.         pUnit:MoveTo(pUnit:GetX(), pUnit:GetY(), pUnit:GetZ()+8, 0)
  757.         pUnit:SendChatMessage(42,0,"You can now fly!")
  758.         pUnit:RegisterEvent("ARG.VAR.CheckHealthTROLOLOL", 5000, 0)
  759.         pUnit:RegisterEvent("ARG.VAR.FixtateMovement", 1000, 1)
  760.         pUnit:RegisterEvent("ARG.VAR.messup_Stoneharry", 5500, 0)
  761.         pUnit:RegisterEvent("ARG.VAR.Stoneharry_FireLines", 5000, 1)
  762.         pUnit:RegisterEvent("ARG.VAR.Shadowbolt_Spam_Three_Argual", 3005, 0)
  763.         pUnit:RegisterEvent("ARG.VAR.VolleyOfShadowbolts", 7000, 0)
  764.     end
  765. end
  766.  
  767. function ARG.VAR.FixtateMovement(pUnit)
  768.     pUnit:SetCombatCapable(0)
  769.     pUnit:Root()
  770. end
  771.  
  772. function ARG.VAR.messup_Stoneharry(pUnit)
  773.     local plrA = pUnit:GetRandomPlayer(0) -- Get two players
  774.     local plrB = pUnit:GetRandomPlayer(0) -- Get two players
  775.     if plrA ~= nil and plrB ~= nil then   -- Make sure we did return somebody in the fight
  776.         if plrA == plrB then -- Make sure they are not the same person
  777.             local plrB = pUnit:GetRandomPlayer(0) -- Try again
  778.             if plrA == plrB then -- You better not be the same person
  779.                 plrB = pUnit:GetClosestPlayer() -- That's it, someone more reliable
  780.             end
  781.         end
  782.         plrA:CancelSpell()
  783.         plrB:CancelSpell() -- Stop casting
  784.         local aX = plrA:GetX()
  785.         local aY = plrA:GetY()
  786.         local aZ = plrA:GetZ()
  787.         local aO = plrA:GetO()
  788.         plrA:SetPosition(plrB:GetX(), plrB:GetY(), plrB:GetZ(), plrB:GetO()) -- Switch players, muhahaha
  789.         plrB:SetPosition(aX, aY, aZ, aO)
  790.         pUnit:SendChatMessageToPlayer(42,0,"You have switches places with "..plrB:GetName().."!", plrA)
  791.         pUnit:SendChatMessageToPlayer(42,0,"You have switches places with "..plrA:GetName().."!", plrB)
  792.         plrA:CastSpell(64446) -- Teleport visual
  793.         plrB:CastSpell(64446)
  794.     end
  795. end
  796.  
  797. function ARG.VAR.CheckHealthTROLOLOL(pUnit)
  798.     if pUnit:GetManaPct() < 2 then
  799.         pUnit:SetMana(pUnit:GetMaxMana())
  800.         pUnit:CastSpell(29166) -- Innervate
  801.         pUnit:RemoveEvents()
  802.         pUnit:SetMovementFlags(1)
  803.         pUnit:Unroot()
  804.         pUnit:RemoveAura(29880) -- Mana shield
  805.         pUnit:SetCombatCapable(0)
  806.         pUnit:SendChatMessage(12,0,"Shaken, not stirred.")
  807.         for place, plrs in pairs(pUnit:GetInRangePlayers()) do
  808.             plrs:EnableFlight(false)
  809.         end
  810.         pUnit:RegisterEvent("ARG.VAR.nomanaleft_malldefense", 5000, 0)
  811.         pUnit:RegisterEvent("ARG.VAR.MINDCONTROLLLLLLL", 3005, 0)
  812.     end
  813. end
  814.  
  815. function ARG.VAR.MINDCONTROLLLLLLL(pUnit)
  816.     local plr = pUnit:GetRandomPlayer(0)
  817.     if plr ~= nil then
  818.         plr:SetPlayerLock(1)
  819.         pUnit:Root()
  820.         plr:SetFaction(21)
  821.         pUnit:ChannelSpell(60452, plr)
  822.         plr:FullCastSpell(39082) -- shadowfury
  823.         RegisterTimedEvent("ARG.VAR.RESETPUNITANDPLAYER_DEFENDMALL", 3000, 1, pUnit, plr)
  824.     end
  825. end
  826.  
  827. function ARG.VAR.RESETPUNITANDPLAYER_DEFENDMALL(pUnit, plr)
  828.     if plr ~= nil then
  829.         plr:SetPlayerLock(0)
  830.         local race = plr:GetPlayerRace()
  831.         if race == 1 or race == 3 or race == 4 or race == 7 or race == 11 then -- alliance
  832.             plr:SetFaction(1)
  833.         else
  834.             plr:SetFaction(2)
  835.         end
  836.         pUnit:Unroot()
  837.         pUnit:StopChannel()
  838.     end
  839. end
  840.  
  841. function ARG.VAR.nomanaleft_malldefense(pUnit)
  842.     if pUnit:GetHealthPct() < 80 then
  843.         pUnit:RemoveEvents()
  844.         pUnit:RegisterEvent("ARG.VAR.Stoneharry_FireLines", 1000, 1)
  845.         pUnit:RegisterEvent("ARG.VAR.MINDCONTROLLLLLLL", 3005, 0)
  846.         pUnit:SendChatMessage(12,0,"You appear to have escaped a roasted end, however, I am afraid I will have to put you out of your misery. Livestock must not be released.")
  847.     end
  848. end
  849.  
  850. RegisterUnitEvent(BossID, 18, "ARG.VAR.Boss_ONSPAWN_DEFENDMALL")
  851. RegisterUnitEvent(BossID, 4, "ARG.VAR.BOSS_ONDEATH_HURPDURP")
  852. RegisterUnitEvent(BossID, 2, "ARG.VAR.BOSS_ONLEAVE_HURPDURP")
  853.  
  854. ---------------------------------------------------------
  855.  
  856. function ARG.VAR.Fire_Visuals_Stoneharry(pUnit, event)
  857.     pUnit:Root()
  858.     pUnit:SetPhase(2)
  859.     pUnit:SetCombatCapable(1)
  860.     pUnit:RegisterEvent("ARG.VAR.WAIT_A_SEC_SEC_SEC", 1000, 1)
  861. end
  862.  
  863. function ARG.VAR.WAIT_A_SEC_SEC_SEC(pUnit, Event)
  864.     pUnit:Root() -- On spawn doesn't always trigger properly, so we'll do it again to be safe
  865.     pUnit:SetCombatCapable(1)
  866.     pUnit:CastSpell(74713) -- Visual
  867.     pUnit:RegisterEvent("ARG.VAR.zzzWAIT_A_SEC_SEC_SEC", math.random(500,1000), 5) -- To give a bit of variety
  868. end
  869.  
  870. function ARG.VAR.zzzWAIT_A_SEC_SEC_SEC(pUnit, Event)
  871.     pUnit:CastSpell(1449) -- Visual and damage
  872. end
  873.  
  874. RegisterUnitEvent(FIRE, 18, "ARG.VAR.Fire_Visuals_Stoneharry")
  875.  
  876. ---------------------------------------------------------
  877.  
  878. --[[
  879.     Debug Below
  880.         Comment out later
  881. ]]
  882.  
  883. function ARG.VAR.OnChat_Hook_ToJoinBG(event, plr, message, pType, pLanguage, pMisc)
  884.     local message = string.lower(message)
  885.     if message == "#start" then
  886.         local id = plr:GetInstanceID()
  887.         if id == nil then id = 1 end
  888.         ARG[id] = ARG[id] or {VAR={}}
  889.         ARG.VAR.CanStart = true
  890.         return 0
  891.     end
  892. end
  893.  
  894. RegisterServerHook(16, "ARG.VAR.OnChat_Hook_ToJoinBG")
  895.  
  896. function ARG.VAR.ControlNPC_OnDeath(pUnit, Event)
  897.     local id = pUnit:GetInstanceID()
  898.     if id == nil then id = 1 end
  899.     ARG[id] = ARG[id] or {VAR={}}
  900.     ARG.VAR.CanStart = true
  901. end
  902.  
  903. RegisterUnitEvent(95341, 4, "ARG.VAR.ControlNPC_OnDeath")
  904.  
  905. ---------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment