stoneharry

Untitled

Jun 2nd, 2015
484
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 14.99 KB | None | 0 0
  1. -- Variables
  2.  
  3. local Krasus
  4. local VH_Spawn1
  5. local VH_Spawn2
  6. local VH_Spawn3
  7. local VH_Spawn4
  8. local VH_Spawn5
  9. local GossipGuy
  10. local Controll
  11. local Portal_1
  12. local Portal_2
  13. local OBJECT_END = 0x006
  14. local UNIT_FIELD_FLAGS = OBJECT_END + 0x028
  15. local UNIT_FLAG_NOT_ATTACKABLE_2 = 0x00000002
  16. local Add_One
  17. local Add_Two
  18.  
  19. -- Here we have the channeling parts
  20.  
  21. function VH_KrasusBeams(pUnit, event)
  22.         Krasus = pUnit
  23.         VH_Spawn1:ChannelSpell(47855, Krasus)
  24.         VH_Spawn2:ChannelSpell(47855, Krasus)
  25.         VH_Spawn3:ChannelSpell(47855, Krasus)
  26.         VH_Spawn4:ChannelSpell(47855, Krasus)
  27.         VH_Spawn5:ChannelSpell(47855, Krasus)
  28.         Krasus:ChannelSpell(47855, VH_Spawn3)
  29. end
  30.  
  31. RegisterUnitEvent(836733, 18, "VH_KrasusBeams")
  32.  
  33. function Minion1(pUnit, event)
  34.         VH_Spawn1 = pUnit
  35. end
  36. RegisterUnitEvent(499940, 18, "Minion1")
  37. function Minion2(pUnit, event)
  38.         VH_Spawn2 = pUnit
  39. end
  40. RegisterUnitEvent(499941, 18, "Minion2")
  41. function Minion3(pUnit, event)
  42.         VH_Spawn3 = pUnit
  43. end
  44. RegisterUnitEvent(499942, 18, "Minion3")
  45. function Minion4(pUnit, event)
  46.         VH_Spawn4 = pUnit
  47. end
  48. RegisterUnitEvent(499943, 18, "Minion4")
  49. function Minion5(pUnit, event)
  50.         VH_Spawn5 = pUnit
  51. end
  52. RegisterUnitEvent(499944, 18, "Minion5")
  53.  
  54.  
  55.  
  56. -- Here we have our gossip to start it
  57.  
  58. function VH_KrasusSpeak(pUnit, event, player)                    
  59.     pUnit:GossipCreateMenu(70015, player, 0)
  60.     pUnit:GossipMenuAddItem(0, "I am ready to fight the boss. (You only get one try!)", 10, 0)
  61.     pUnit:GossipMenuAddItem(0, "I need some more time to prepare.", 20, 0)
  62.     pUnit:GossipSendMenu(player)
  63. end
  64.  
  65. function VH_KrasusSelect(pUnit, event, player, id, intid, code)
  66.     if (intid == 10) then
  67.     pUnit:GossipCreateMenu(70016, player, 0)
  68.     pUnit:GossipMenuAddItem(4, "I am ready. (You only get one try!)", 11, 0)
  69.     pUnit:GossipMenuAddItem(4, "I am not.", 21, 0)
  70.     pUnit:GossipSendMenu(player)
  71.     end
  72.     if (intid == 11) then
  73.     pUnit:RegisterEvent("VH_StartInstance", 2000, 1)
  74.     GossipGuy = pUnit
  75.     Krasus:StopChannel()
  76.     VH_Spawn1:StopChannel()
  77.     VH_Spawn2:StopChannel()
  78.     VH_Spawn3:StopChannel()
  79.     VH_Spawn4:StopChannel()
  80.     VH_Spawn5:StopChannel()
  81.     pUnit:SetNPCFlags(2)
  82.     pUnit:SpawnCreature(499945, 1616, 414, 94, 3.198040, 35, 0)
  83.     pUnit:SendChatMessage(12, 0, "Very well, Get ready people!")
  84.     player:GossipComplete()
  85.     end
  86.     if (intid == 20) then
  87.     player:SendBroadcastMessage("Take your time.")
  88.     player:SendAreaTriggerMessage("Take your time.")
  89.     player:GossipComplete()
  90.     end
  91.     if (intid == 21) then
  92.     player:SendBroadcastMessage("Take your time.")
  93.     player:SendAreaTriggerMessage("Take your time.")
  94.     player:GossipComplete()
  95.     end
  96. end
  97.                
  98. RegisterUnitGossipEvent(359763, 1, "VH_KrasusSpeak")
  99. RegisterUnitGossipEvent(359763, 2, "VH_KrasusSelect")
  100.  
  101. -- Controll Npc
  102. RegisterUnitEvent(499945, 18, "ControllNpc")
  103.  
  104. function ControllNpc(pUnit, event)
  105.     Controll = pUnit
  106.     pUnit:SetScale(0.01)
  107.     GossipGuy:PlaySoundToSet(11707) -- Dramatic?
  108.     GossipGuy:ChannelSpell(47855, Krasus)
  109.     Krasus:ChannelSpell(47855, GossipGuy)
  110.     pUnit:RegisterEvent("Start_Talking_Etc_Etc", 5000, 0)
  111. end
  112.  
  113. function Start_Talking_Etc_Etc(pUnit, event)
  114.     pUnit:RemoveEvents()
  115.     VH_Spawn1:SendChatMessage(14, 0, "Your a fool! Without us he will break free!")
  116.     pUnit:RegisterEvent("Start_Talking_Etc_Etc_Etc", 5000, 0)
  117. end
  118.  
  119. function Start_Talking_Etc_Etc_Etc(pUnit, event)
  120.     pUnit:RemoveEvents()
  121.     VH_Spawn5:SendChatMessage(14, 0, "We cant let you get away with this!")
  122.     VH_Spawn1:SetFaction(21)
  123.     VH_Spawn2:SetFaction(21)
  124.     VH_Spawn3:SetFaction(21)
  125.     VH_Spawn4:SetFaction(21)
  126.     VH_Spawn5:SetFaction(21)
  127.     pUnit:RegisterEvent("CheckMobOne", 1000, 0)
  128. end
  129. -- This is checking for 1st 5 mobs death
  130. function CheckMobOne(pUnit, event)
  131.  if VH_Spawn1:GetHealthPct() <= 2 then
  132.     pUnit:RemoveEvents()
  133.     VH_Spawn1:SendChatMessage(14, 0, "Fight on brothers!")
  134.     pUnit:RegisterEvent("CheckMobTwo", 3000, 0)
  135.     end
  136. end
  137. function CheckMobTwo(pUnit, event)
  138.  if VH_Spawn2:GetHealthPct() <= 2 then
  139.     pUnit:RemoveEvents()
  140.     VH_Spawn2:SendChatMessage(14, 0, "I will be avenged!")
  141.     pUnit:RegisterEvent("CheckMobThree", 3000, 0)
  142.     end
  143. end
  144. function CheckMobThree(pUnit, event)
  145.  if VH_Spawn3:GetHealthPct() <= 2 then
  146.     pUnit:RemoveEvents()
  147.     VH_Spawn3:SendChatMessage(14, 0, "It is futile to resist!")
  148.     pUnit:RegisterEvent("CheckMobFour", 3000, 0)
  149.     end
  150. end
  151. function CheckMobFour(pUnit, event)
  152.  if VH_Spawn4:GetHealthPct() <= 2 then
  153.     pUnit:RemoveEvents()
  154.     VH_Spawn4:SendChatMessage(14, 0, "Don't let him escape the prison! Destroy the Intruders!")
  155.     pUnit:RegisterEvent("CheckMobFive", 3000, 0)
  156.     end
  157. end
  158. function CheckMobFive(pUnit, event)
  159.  if VH_Spawn5:GetHealthPct() <= 2 then
  160.     pUnit:RemoveEvents()
  161.     VH_Spawn5:SendChatMessage(12, 0, "Mortals, you have doomed us all...")
  162.     pUnit:RegisterEvent("FreeBoss_Tehe_Tehe", 5000, 0)
  163.     end
  164. end
  165.  
  166. function FreeBoss_Tehe_Tehe(pUnit, event)
  167.     pUnit:RemoveEvents()
  168.     GossipGuy:StopChannel()
  169.     Krasus:StopChannel()
  170.     Krasus:SendChatMessage(14, 0, "...and I am FREE!")
  171.     Krasus:CastSpell(51110)
  172.     Krasus:CastSpell(54306)
  173.     Krasus:MoveTo(1613, 452, 94, 0.039271)
  174.     GossipGuy:Emote(45, 10000)
  175.     pUnit:RegisterEvent("Suicide_Lol", 5000, 0)
  176. end
  177.  
  178. function Suicide_Lol(pUnit, event)
  179.     pUnit:RemoveEvents()
  180.     GossipGuy:SendChatMessage(12, 0, "I shall destroy you once and for all!")
  181.     pUnit:RegisterEvent("Suicide_Lol_Lol", 4000, 0)
  182. end
  183.  
  184. function Suicide_Lol_Lol(pUnit, event)
  185.     pUnit:RemoveEvents()
  186.     Krasus:SendChatMessage(12, 0, "You can not if your dead.")
  187.     Krasus:FullCastSpellOnTarget(31984, GossipGuy)
  188.     pUnit:RegisterEvent("Suicide_Lol_Lol_Lol", 3500, 0)
  189. end
  190.  
  191. function Suicide_Lol_Lol_Lol(pUnit, event)
  192.     pUnit:RemoveEvents()
  193.     GossipGuy:Despawn(1000,0)
  194.     Krasus:SendChatMessage(12, 0, "Now you shall be destroyed.")
  195.     pUnit:RegisterEvent("Suicide_Lol_Lol_Lol_Lol", 2500, 0)
  196. end
  197.  
  198. function Suicide_Lol_Lol_Lol_Lol(pUnit, event)
  199.     pUnit:RemoveEvents()
  200.     Krasus:SetFaction(21)
  201.     pUnit:RegisterEvent("Suicide_Lol_Lol_Lol_Lol_Lol", 5000, 0)
  202. end
  203.  
  204. function Suicide_Lol_Lol_Lol_Lol_Lol(pUnit, event)
  205.     pUnit:RemoveEvents()
  206.     Krasus:FullCastSpellOnTarget(43439, Krasus:GetRandomPlayer(0))
  207.     Krasus:FullCastSpellOnTarget(43439, Krasus:GetRandomPlayer(0))
  208.     Krasus:FullCastSpellOnTarget(43439, Krasus:GetRandomPlayer(0))
  209.     Krasus:FullCastSpellOnTarget(43439, Krasus:GetRandomPlayer(0))
  210.     Krasus:FullCastSpellOnTarget(43439, Krasus:GetRandomPlayer(0))
  211.     Krasus:FullCastSpellOnTarget(43439, Krasus:GetRandomPlayer(0))
  212.     Krasus:FullCastSpellOnTarget(43439, Krasus:GetRandomPlayer(0)) -- CURSE EVERYONE!!! >.>
  213.     Krasus:FullCastSpellOnTarget(43439, Krasus:GetRandomPlayer(0))
  214.     Krasus:FullCastSpellOnTarget(43439, Krasus:GetRandomPlayer(0))
  215.     Krasus:FullCastSpellOnTarget(43439, Krasus:GetRandomPlayer(0))
  216.     Krasus:FullCastSpellOnTarget(43439, Krasus:GetRandomPlayer(0))
  217.     Krasus:FullCastSpellOnTarget(43439, Krasus:GetRandomPlayer(0))
  218.     Krasus:FullCastSpellOnTarget(43439, Krasus:GetRandomPlayer(0))
  219.     Krasus:FullCastSpellOnTarget(43439, Krasus:GetRandomPlayer(0))
  220.     pUnit:RegisterEvent("ExplosionThenSpells_Tehe", 20000, 0)
  221. end
  222.  
  223. function ExplosionThenSpells_Tehe(pUnit, event)
  224.     pUnit:RemoveEvents()
  225.     Krasus:CastSpell(36092)
  226.     Krasus:StopMovement(999999)
  227.     pUnit:RegisterEvent("LetsCastSomeNastySpells", 3001, 0)
  228.     pUnit:RegisterEvent("EndThisRandomCrapTehe", 25000, 0)
  229. end
  230.  
  231. function LetsCastSomeNastySpells(pUnit, event)
  232.     Krasus:FullCastSpellOnTarget(39252, Krasus:GetRandomPlayer(0)) -- Ok it works but he moves and it can be inturupted :S
  233. end
  234.  
  235. function EndThisRandomCrapTehe(pUnit, event)
  236.     pUnit:RemoveEvents()
  237.     Krasus:CastSpell(22663) -- We may need to do it again incase of stun? (Imunes to all)
  238.     Krasus:StopMovement(999999999)
  239.     Krasus:SetCombatCapable(1)
  240.     Krasus:SendChatMessage(12, 0, "Mortals, did you really believe you would defeat me?")
  241.     pUnit:RegisterEvent("MoveToCentreOfTheRoom", 2500, 0)
  242. end
  243.  
  244. function MoveToCentreOfTheRoom(pUnit, event)
  245.     pUnit:RemoveEvents()
  246.     Krasus:MoveTo(1591, 451, 98, 6.272190) -- This will be on top of the platform
  247.     pUnit:RegisterEvent("MoveToCentreOfTheRoom_Now", 10000, 0) -- 10 seconds should give him long enough to get there, or more do you think?
  248. end
  249.  
  250. function MoveToCentreOfTheRoom_Now(pUnit, event)
  251.     pUnit:RemoveEvents()
  252.     pUnit:SpawnCreature(111000, 1597, 414, 94, 1.830532, 35, 0) -- These are the portals minions will come out of
  253.     pUnit:SpawnCreature(111001, 1594, 491, 94, 4.798336, 35, 0)
  254.     Krasus:SendChatMessage(14, 0, "Come my minions!")
  255.     pUnit:RegisterEvent("MoveToCentreOfTheRoom_Now_Now", 2500, 0)
  256. end
  257. -- Portal effects and flags
  258.     RegisterUnitEvent(111000, 18, "Portal_One_For_Minions")
  259.     function Portal_One_For_Minions(pUnit, event)
  260.         Portal_1 = pUnit
  261. --      pUnit:FullCastSpell(40280) -- Disabled, not needed
  262.         Portal_1:SetFieldFlags(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2) -- Now he cant be attacked to break the event
  263.     end
  264.    
  265.     RegisterUnitEvent(111001, 18, "Portal_Two_For_Minions")
  266.     function Portal_Two_For_Minions(pUnit, event)
  267.         Portal_2 = pUnit
  268. --      pUnit:FullCastSpell(40280) -- Disabled, not needed
  269.         Portal_2:SetFieldFlags(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2) -- Now he cant be attacked to break the event
  270.     end
  271. -- End portal stuff
  272. function MoveToCentreOfTheRoom_Now_Now(pUnit, event)
  273.     pUnit:RemoveEvents()
  274.     pUnit:SpawnGameObject(189997, 1655, 453, 93, 3.157301, 120000) -- We need to stop them running away
  275.     Portal_2:FullCastSpell(40280) -- Portal effect, make sure it's Full not Cast?... Update: Works now!
  276.     Portal_1:FullCastSpell(40280) -- Portal effect, make sure it's Full not Cast?... Update: Works now!
  277.     Krasus:ChannelSpell(47855, Portal_1)
  278.     Portal_2:ChannelSpell(47855, Krasus) -- Maybe he can only channel to 1 at a time?]]
  279.     pUnit:RegisterEvent("ComeOnAddsSpawnAlready", 7500, 0)
  280. end
  281.  
  282. ---------------------------
  283. -- Coords -----------------
  284. ---------------------------
  285. --      ___________       -
  286. --     /    Top    \      -
  287. --     ¦ A       D ¦      -
  288. --     \____ E ____/      -
  289. --                        -
  290. --  A = Left              -
  291. --  D = Right             -
  292. --  E = Enterance         -
  293. ---------------------------
  294. -- x y z o     Map = 603  -
  295. ---------------------------
  296. -- A = 1597, 415, 94, 1.5 -
  297. -- D = 1596, 488, 94, 4.6 -
  298. ---------------------------
  299. ---------------------------
  300.  
  301.     RegisterUnitEvent(111003, 18, "gAgdd_One_For_Minions")
  302.     function gAgdd_One_For_Minions(pUnit, event) -- A
  303.         Add_One = pUnit
  304.         Add_One:SendChatMessage(14, 0, "Mortals will perish!")
  305.         Add_One:MoveTo(1625,445,94,0.777544) -- Use exact, not variable
  306.     end
  307.     RegisterUnitEvent(111004, 18, "gAgdd_Two_For_Minions")
  308.     function gAgdd_Two_For_Minions(pUnit, event) -- D
  309.         Add_Two = pUnit
  310.         Add_Two:SendChatMessage(14, 0, "For the master!")
  311.         Add_Two:MoveTo(1626,462,94,5.743618) -- Use exact, not variable
  312.     end
  313.  
  314. function ComeOnAddsSpawnAlready(pUnit, event)
  315.     pUnit:RemoveEvents()
  316. --  local x = Krasus:GetX()
  317. --  local y = Krasus:GetY() -- Un-needed since 2 mobs using same variables = buggy
  318. --  local z = Krasus:GetZ()
  319. --  local o = Krasus:GetO()
  320.     pUnit:SpawnCreature(111003, 1597, 415, 94, 1.5, 20, 0) -- A
  321.     pUnit:SpawnCreature(111004, 1596, 488, 94, 4.6, 20, 0) -- D
  322.     pUnit:RegisterEvent("ComeOnAddsSpawnAlready_Go", 1000, 0)
  323. end
  324.  
  325. function ComeOnAddsSpawnAlready_Go(pUnit, event)
  326.  if Add_One:GetHealthPct() <= 2 then
  327.     pUnit:RemoveEvents()
  328.     Add_One:SendChatMessage(14, 0, "I am invincible!")
  329.     pUnit:RemoveEvents()
  330.     pUnit:RegisterEvent("ComeOnAddsSpawnAlready_Go_Go", 1000, 0)
  331.     end
  332. end
  333.  
  334. function ComeOnAddsSpawnAlready_Go_Go(pUnit, event)
  335.  if Add_Two:GetHealthPct() <= 2 then
  336.     pUnit:RemoveEvents()
  337.     Add_Two:SendChatMessage(15, 0, "No...")
  338.     pUnit:RemoveEvents()
  339.     pUnit:RegisterEvent("ComeOnAddsSpawnAlready_Go_Go_Go", 5000, 0)
  340.     end
  341. end
  342.  
  343. function ComeOnAddsSpawnAlready_Go_Go_Go(pUnit, event)
  344.     pUnit:RemoveEvents()
  345.     Krasus:StopChannel()
  346.     Portal_2:StopChannel()
  347.     pUnit:RegisterEvent("ComeOnAddsSpawnAlready_Go_Go_Go_Go", 2500, 0)
  348. end
  349.  
  350. function ComeOnAddsSpawnAlready_Go_Go_Go_Go(pUnit, event)
  351.     pUnit:RemoveEvents()
  352.     Portal_1:Despawn(1000,0)
  353.     Portal_2:Despawn(1000,0) -- Simpler than killing em
  354.     Krasus:SendChatMessage(14,0,"You have not won yet!")
  355.     Krasus:StopMovement(1000) -- Resets movement
  356.     Krasus:RemoveAura(22663) -- Removes Imune
  357.     Krasus:SetCombatCapable(0) -- Let him attack!
  358.     Krasus:FullCastSpell(17695) -- -100 shadow reistance every few seconds to nearby people
  359.     pUnit:RegisterEvent("Knock_Knock_Whos_There", 15000, 0)
  360.     pUnit:RegisterEvent("Knock_Knock_Whos_There_Boom", 7000, 0)
  361.     pUnit:RegisterEvent("Knock_Knock_Whos_There_Boom_End", 30100, 0)
  362. end
  363.  
  364. function Knock_Knock_Whos_There(pUnit, event)
  365.     local screwerup = Krasus:GetMainTank()
  366.     if (screwerup ~= nil) then
  367.     Krasus:ClearThreatList()
  368.     Krasus:FullCastSpellOnTarget(24199, screwerup)
  369.     Krasus:SendChatMessage(42, 0, "The main tank is knocked away!")
  370.    else
  371.    end
  372. end
  373. function Knock_Knock_Whos_There_Boom(pUnit, event)
  374.     Krasus:FullCastSpell(60851)
  375. end
  376.  
  377. function Knock_Knock_Whos_There_Boom_End(pUnit, event)
  378.     pUnit:RemoveEvents()
  379.     Krasus:FullCastSpellOnTarget(43439, Krasus:GetRandomPlayer(0))
  380.     Krasus:FullCastSpellOnTarget(43439, Krasus:GetRandomPlayer(0))
  381.     Krasus:FullCastSpellOnTarget(43439, Krasus:GetRandomPlayer(0))
  382.     Krasus:FullCastSpellOnTarget(43439, Krasus:GetRandomPlayer(0))
  383.     Krasus:FullCastSpellOnTarget(43439, Krasus:GetRandomPlayer(0))
  384.     Krasus:FullCastSpellOnTarget(43439, Krasus:GetRandomPlayer(0))
  385.     Krasus:FullCastSpellOnTarget(43439, Krasus:GetRandomPlayer(0)) -- CURSE EVERYONE AGAIN!!! <.>
  386.     Krasus:FullCastSpellOnTarget(43439, Krasus:GetRandomPlayer(0))
  387.     Krasus:FullCastSpellOnTarget(43439, Krasus:GetRandomPlayer(0))
  388.     Krasus:FullCastSpellOnTarget(43439, Krasus:GetRandomPlayer(0))
  389.     Krasus:FullCastSpellOnTarget(43439, Krasus:GetRandomPlayer(0))
  390.     Krasus:FullCastSpellOnTarget(43439, Krasus:GetRandomPlayer(0))
  391.     Krasus:FullCastSpellOnTarget(43439, Krasus:GetRandomPlayer(0))
  392.     Krasus:FullCastSpellOnTarget(43439, Krasus:GetRandomPlayer(0))
  393.     Krasus:CastSpell(28531) -- frost aura
  394.     pUnit:RegisterEvent("Let_It_Rain", 5000, 0)
  395.     pUnit:RegisterEvent("Restart_These_Spells_Again", 36000, 0)
  396. end
  397. function Let_It_Rain(pUnit, event)
  398.     Krasus:CastSpell(38635) -- rain of fire
  399. end
  400.  
  401. function Restart_These_Spells_Again(pUnit, event)
  402.     pUnit:RemoveEvents()
  403.     pUnit:RegisterEvent("Knock_Knock_Whos_There", 15000, 0)
  404.     pUnit:RegisterEvent("Knock_Knock_Whos_There_Boom", 7000, 0)
  405.     pUnit:RegisterEvent("EndThisRandomCrapTehe", 45000, 0) -- Start of script
  406. end
  407.  
  408.  
  409. -- If the boss dies or leaves combat.
  410. RegisterUnitEvent(836733, 4, "VH_KrasusDie")
  411.  
  412. function VH_KrasusDie(pUnit, event)
  413.     pUnit:RemoveEvents()
  414.     Controll:Despawn(1000,0)
  415.     pUnit:PlaySoundToSet(11652)
  416.     x = Krasus:GetX()
  417.     y = Krasus:GetY()
  418.     z = Krasus:GetZ()
  419.     o = Krasus:GetO()
  420.     Krasus:SpawnCreature(555331,x,y,z,o,35,0)
  421. end
  422.  
  423. -- vendor
  424.  
  425. RegisterUnitEvent(555331, 18, "Vendor_On_Spawn_Move")
  426.  
  427. function Vendor_On_Spawn_Move(pUnit, event)
  428.     pUnit:MoveTo(1617,453,94,6.254140) -- Near start
  429.     pUnit:SendChatMessage(12, 0, "Well done mortals for defeating Yog'Sarons General, please come and talk to me and we can barter a reward for freeing me.")
  430. end
Advertisement
Add Comment
Please, Sign In to add comment