stoneharry

Untitled

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