Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- The script was fixed and made working by Rochet2 of AcWeb
- local T = {} -- The script saves info about whether the script is running in an instance or not
- -- First quest outside, it just gives the player some food and water
- local function Accept90000(event, pPlayer, QuestId, pQuestGiver)
- if QuestId == 90000 then
- pPlayer:AddItem(159, 4)
- pPlayer:AddItem(4540, 4)
- end
- end
- -- First quest inside
- function Complete90001(event, pPlayer, QuestId, pUnit)
- local ID = pUnit:GetInstanceID() -- Get the instance ID for the table that saves data for the spesific instances.
- if(QuestId == 90001 and not T[ID]) then -- If the quest completed is 90001 and none of the other quests have been done and they are not running, then
- local Whitemane = pPlayer:GetCreatureNearestCoords(199.408005, 121.653, 134.910004, 90010)
- if(Whitemane) then --If the selected npc is Whitemane the script continues.
- T[ID] = {1, true} -- Save that quest 1 was activated and that it is running. NOTE! The quests should be chained and the NPCs spawned to the right positions with the right quests
- Whitemane:SetNPCFlags(4) -- Disable talking and make the NPC not be able to give or complete quests while walking and talking
- Whitemane:SendChatMessage(12, 7, "Follow me.")
- local Player = Whitemane:GetClosestPlayer()
- Player:CastSpellOnTarget(5406, pPlayer)
- Player:CastSpellOnTarget(49, pPlayer)
- Whitemane:RegisterEvent("Move01_Whitemane90001", 1000, 1) --In 1 second "1000ms" the function "Move01_Whitemane" will run.
- end
- end
- end
- function Move01_Whitemane90001(Whitemane, event)
- Whitemane:MoveTo(199.556656, 108.91169, 128.522507, 4.753242)
- Whitemane:RegisterEvent("Move02_Whitemane90001", 4000, 1)
- end
- function Move02_Whitemane90001(Whitemane, event)
- Whitemane:MoveTo(201.447388, 52.051525, 128.766281, 4.742254)
- Whitemane:RegisterEvent("Move03_Whitemane90001", 24000, 1)
- end
- function Move03_Whitemane90001(Whitemane, event)
- Whitemane:MoveTo(209.785873, 51.152771, 128.840088, 6.267476)
- Whitemane:RegisterEvent("Move04_Whitemane90001", 3000, 1)
- end
- function Move04_Whitemane90001(Whitemane, event)
- Whitemane:MoveTo(236.721359, 50.011505, 115.708603, 0.027489)
- Whitemane:RegisterEvent("Move05_Whitemane90001", 12000, 1)
- end
- function Move05_Whitemane90001(Whitemane, event)
- Whitemane:MoveTo(233.375031, 41.485565, 115.707848, 4.374668)
- Whitemane:RegisterEvent("Move06_Whitemane90001", 3000, 1)
- end
- function Move06_Whitemane90001(Whitemane, event)
- Whitemane:MoveTo(201.992569, 12.324375, 115.707878, 1.586526)
- Whitemane:RegisterEvent("Talk01_Whitemane90001", 19000, 1)
- end
- function Talk01_Whitemane90001(Whitemane, event)
- Whitemane:SendChatMessage(12, 7, "Here we are, speak with me to begin your next test.")
- Whitemane:SetNPCFlags(3) -- Set the NPC to be able to give quests and talk again.
- T[Whitemane:GetInstanceID()][2] = false -- You can now launch the next quest
- -- !!NOTE!! You can no longer start or restart quest 1.
- end
- -- Second quest
- function OnQuestAccept_Whitemane90002(event, pPlayer, QuestId, pUnit)
- local ID = pUnit:GetInstanceID() -- Get the instance ID for the table that saves data for the spesific instances.
- if(QuestId == 90002 and T[ID] and T[ID][1] == 1 and T[ID][2] == false) then -- If the quest accepted is 90002 and quest 90001 has been completed in the instance, then
- T[ID] = {2, true, 0} -- Save that quest 2 was activated and that it is running. NOTE! The quests should be chained and the NPCs spawned to the right positions with the right quests. The 0 is for counting the killed undead, when it hits 5 the event finished down below.
- pUnit:RegisterEvent("Quest01_Whitemane90002", 5000, 1) -- We use the questgiver (pUnit) to register events since we need him later to do stuff in the script
- end
- end
- function Quest01_Whitemane90002(Whitemane, event)
- local Portal = Whitemane:SpawnCreature(37227, 200.697739, 59.384331, 115.708244, 1.576423, 694, 180000, 0, 0, 0, 1, 0) -- Spawns the portal
- Whitemane:SendChatMessage(42, 0, "The undead are coming, prepare yourself!") -- Questgiver says
- Whitemane:RegisterEvent("Spawn_Timer_Whitemane90002", 4000, 1) -- Spawns an NPC after 4 seconds
- end
- function Spawn_Timer_Whitemane90002(Whitemane, event)
- Whitemane:RegisterEvent("Spawn01_Whitemane90002", 13000, 5) -- Spawn an NPC after 13 seconds 4 times.
- end
- function Spawn01_Whitemane90002(Whitemane, event) -- The function that spawns the NPCs
- Whitemane:SpawnCreature(90012, 200.697739, 59.384331, 115.708244, 4.644086, 14, 120000, 0, 0, 0, 1, 0) -- Sets the spawned creature to the MindlessGhoul variable. (locally, so it will only exist in this function. The variable I mean.)
- Whitemane:RegisterEvent("Move_Ghoul90002", 2000, 1)
- end
- function Move_Ghoul90002(Whitemane, event) -- Sends the spawned Ghoul closer to Whitemane as to make the player engage combat
- local Ghoul = Whitemane:GetCreatureNearestCoords(200.697739, 59.384331, 115.708244, 90012)
- Ghoul:MoveTo(201.975159, 21.787292, 114.983719, 4.718697)
- end
- function Spawn_On_Death(pUnit, event, pPlayer)
- local ID = pUnit:GetInstanceID()
- if(T[ID] and T[ID][1] == 2 and T[ID][2] == true and T[ID][3]) then
- T[ID][3] = T[ID][3] + 1
- if(T[ID][3] >= 5) then
- local Whitemane = pPlayer:GetCreatureNearestCoords(201.992569, 12.324375, 115.707878, 90010)
- local Portal = Whitemane:GetCreatureNearestCoords(200.697739, 59.384331, 115.708244, 37227)
- Portal:Despawn(1000, 0)
- Whitemane:SendChatMessage(12, 7, "On to the next test, follow me.")
- local Player = Whitemane:GetClosestPlayer()
- Player:CastSpellOnTarget(5406, Whitemane:GetClosestPlayer())
- Player:CastSpellOnTarget(49, Whitemane:GetClosestPlayer())
- Whitemane:SetNPCFlags(4) -- Disable talking and make the NPC not be able to give or complete quests while walking and talking
- Whitemane:RegisterEvent("Move01_Whitemane90002", 1000, 1)
- end
- end
- end
- function Move01_Whitemane90002(Whitemane, event)
- Whitemane:MoveTo(247.740143, 37.573757, 115.717438, 0.002345)
- Whitemane:RegisterEvent("Move02_Whitemane90002", 21000, 1)
- end
- function Move02_Whitemane90002(Whitemane, event)
- Whitemane:MoveTo(262.464417, 37.656471, 115.727440, 1.606948)
- Whitemane:RegisterEvent("Move03_Whitemane90002", 6000, 1)
- end
- function Move03_Whitemane90002(Whitemane, event)
- Whitemane:MoveTo(262.334930, 60.696800, 109.974747, 1.598312)
- Whitemane:RegisterEvent("Move04_Whitemane90002", 7000, 1)
- end
- function Move04_Whitemane90002(Whitemane, event)
- Whitemane:MoveTo(262.259644, 101.386047, 109.971985, 1.610067)
- Whitemane:RegisterEvent("Move05_Whitemane90002", 20000, 1)
- end
- function Move05_Whitemane90002(Whitemane, event)
- Whitemane:SetNPCFlags(3)
- Whitemane:SendChatMessage(12, 7, "Here we are, don't worry about the Necromancers they won't attack you for now...")
- end
- -------------Everything Below here is untested and probably not working as intended-----------------
- function OnQuestAccept_Whitemane90003(event, pPlayer, QuestId, pUnit)
- if QuestId == 90003 then
- local Whitemane = pPlayer:GetCreatureNearestCoords(262.259644, 101.386047, 109.971985, 90010)
- Whitemane:SendChatMessage(42, 0, "The Necromancers have been released!")
- Whitemane:SetFaction(11)
- Whitemane:CastSpell(43202)
- pUnit:RegisterEvent("Spawn_Timer_Whitemane90003", 5000, 1) -- We use the questgiver (pUnit) to register events since we need him later to do stuff in the script
- end
- end
- function Spawn_Timer_Whitemane90003(Whitemane, event)
- Whitemane:RegisterEvent(function() Whitemane:FullCastSpell(26573) end, 10000, 2)
- Whitemane:RegisterEvent("Spawn_Whitemane90003", 2000, 20) -- Spawn an NPC after 2 seconds 19 times.
- end
- function Spawn_Whitemane90003(Whitemane, event)
- local choice = math.random(1,6)
- if choice ==1 then
- Whitemane:SpawnCreature(90034, 246.671005, 81.976799, 110.250999, 0.931493, 14, 120000, 0, 0, 0, 1, 0):ModThreat(Whitemane, 100)
- elseif choice == 2 then
- Whitemane:SpawnCreature(90034, 247.867828, 84.609749, 109.903709, 0.862092, 14, 120000, 0, 0, 0, 1, 0):ModThreat(Whitemane, 100)
- elseif choice == 3 then
- Whitemane:SpawnCreature(90034, 247.351852, 101.655975, 110.166222, 6.175311, 14, 120000, 0, 0, 0, 1, 0):ModThreat(Whitemane, 100)
- elseif choice == 4 then
- Whitemane:SpawnCreature(90034, 275.648315, 101.904953, 109.98517, 3.175088, 14, 120000, 0, 0, 0, 1, 0):ModThreat(Whitemane, 100)
- elseif choice == 5 then
- Whitemane:SpawnCreature(90034, 246.627472, 118.120979, 110.091766, 5.504576, 14, 120000, 0, 0, 0, 1, 0):ModThreat(Whitemane, 100)
- elseif choice == 6 then
- Whitemane:SpawnCreature(90034, 275.929443, 118.208099, 109.920647, 3.988760, 14, 120000, 0, 0, 0, 1, 0):ModThreat(Whitemane, 100)
- end
- end
- --[[
- function END_Whitemane90001(pUnit) -- DO NOT RUN THIS UNTIL THE PLAYER HAS FINISHED THE ENTIRE QUEST CHAIN
- pUnit:Despawn(0, 0)
- table.remove(T, ID) -- Quest chain can now be re-triggered
- end
- ]]
- RegisterServerHook(14, Accept90000)
- RegisterServerHook(22, Complete90001)
- RegisterServerHook(14, "OnQuestAccept_Whitemane90002")
- RegisterServerHook(14, "OnQuestAccept_Whitemane90003")
- RegisterUnitEvent(90012, 4, "Spawn_On_Death")
- RegisterUnitEvent(90010, 18, function() return end) -- This allows the use of :RegisterEvent() for Whitemane
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement