stoneharry

Untitled

Apr 29th, 2011
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.80 KB | None | 0 0
  1. ------------------------------------------------------------------
  2. --[[
  3.     This script was made by Stoneharry of www.MMOwned.com
  4.     This script may be edited and changed at will, but full credits must be provided.
  5.     Please respect the original author, thank you.
  6. ]]
  7. -- Variable declaration and generally setting up the script
  8. --?!MAP= 631
  9.  
  10. local TirionNPCID = 38995
  11. local LichKingNPCID = 36597
  12.  
  13. -- For 3.3.5a
  14. local OBJECT_END = 0x0006
  15. local UNIT_NPC_FLAGS = OBJECT_END + 0x004C
  16. local UNIT_FIELD_FLAGS = OBJECT_END + 0x0035
  17. local UNIT_FIELD_BYTES_1 = OBJECT_END + 0x0044
  18. local UNIT_FLAG_NOT_SELECTABLE = 0x02000000
  19.  
  20. -- Unconfigurable Variables
  21. --[[local Lich = nil -- Global variables are automatically local to the script now
  22. local Tirion = nil]]
  23. local Ready = false
  24.  
  25. ------------------------------------------------------------------
  26. -- The gossip used to start the encounter - Tirion ---------------
  27. -- Also set up events etc ----------------------------------------
  28. ------------------------------------------------------------------
  29.  
  30. function Tirion_OnGossipTalk(pUnit, event, player)
  31.     local menu = GossipMenu(pUnit, 2975252, 1)
  32.     menu:AddItem(9, "We are prepared, Highlord. Let us battle for the fate of Azeroth! For the light of dawn!", 1, false)
  33.     menu:AddItem(0, "We are not yet prepared, Highlord.", 2, false)
  34.     menu:Send(player)
  35. end
  36.  
  37. function Tirion_OnGossipSelect(pUnit, Event, player, id, intid, code, pMisc)
  38.     if (id == 1) then
  39.         Tirion = TO_CREATURE(pUnit)
  40.         Ready = true
  41.         Tirion:SetUInt32Value(UNIT_NPC_FLAGS, 2) -- Quest flags disable gossip
  42.         -- Gossip complete
  43.     elseif (id == 2) then
  44.         pUnit:SetUInt32Value(UNIT_NPC_FLAGS, 2) -- Quest flags disable gossip
  45.         -- Gossip complete
  46.     end
  47. end
  48.  
  49. RegisterUnitGossipEvent(TirionNPCID, 1, Tirion_OnGossipTalk)
  50. RegisterUnitGossipEvent(TirionNPCID, 2, Tirion_OnGossipSelect)
  51.  
  52. function Tirion_OnSpawnHandleStart(pUnit, Event)
  53.     TO_CREATURE(pUnit):RegisterEvent("CheckForStart_Tirion", 2500, 0)
  54. end
  55.  
  56. RegisterUnitEvent(TirionNPCID, 18, Tirion_OnSpawnHandleStart)
  57.  
  58. function LichKing_OnSpawnHandleDefineAndBytes(pUnit, Event)
  59.     TO_CREATURE(pUnit):RegisterEvent("SetBytesAndHandleVariable_LichKing", 2000, 1)
  60. end
  61.  
  62. function SetBytesAndHandleVariable_LichKing(pUnit)
  63.     Lich = TO_CREATURE(pUnit)
  64.     Lich:SetUInt32Value(UNIT_FIELD_BYTES_1, 1) -- Sit on the throne
  65. end
  66.  
  67. RegisterUnitEvent(LichKingNPCID, 18, "LichKing_OnSpawnHandleDefineAndBytes")
  68.  
  69. ------------------------------------------------------------------
  70. -- Mini-cinematic at the start -----------------------------------
  71. ------------------------------------------------------------------
  72.  
  73. function CheckForStart_Tirion(pUnit)
  74.     if (Ready and Lich ~= nil) then
  75.         Tirion:RemoveEvents()
  76.         Ready = false
  77.         print("Worked thus far")
  78.     end
  79. end
  80.  
  81. ------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment