View difference between Paste ID: ZUJ8Zzuk and DnS5K48X
SHOW: | | - or go back to the newest paste.
1
-- The script was fixed and made working by Rochet2 of AcWeb
2
3
local T = {} -- The script saves info about whether the script is running in an instance or not
4-
Whitemane =
4+
5-
 
5+
6-
function Spawnzzz(pUnit, event)
6+
local function Accept90000(event, pPlayer, QuestId, pQuestGiver)
7-
	Whitemane = pUnit
7+
8
		pPlayer:AddItem(159, 4)
9
		pPlayer:AddItem(4540, 4)
10
	end
11-
function OnQuestAccept_Whitemane90000(event, pPlayer, QuestId, pUnit)
11+
12
13
-- First quest inside
14
function Complete90001(event, pPlayer, QuestId, pUnit)
15
	local ID = pUnit:GetInstanceID() -- Get the instance ID for the table that saves data for the spesific instances.
16
	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
17
		local Whitemane = pPlayer:GetCreatureNearestCoords(199.408005, 121.653, 134.910004, 90010)
18
		if(Whitemane) then --If the selected npc is Whitemane the script continues.
19-
function OnQuestComplete_Whitemane90001(event, pPlayer, QuestId, pUnit)
19+
20
			Whitemane:SetNPCFlags(4) -- Disable talking and make the NPC not be able to give or complete quests while walking and talking
21
			Whitemane:SendChatMessage(12, 7, "Follow me.")
22
			local Player = Whitemane:GetClosestPlayer()
23
			Player:CastSpellOnTarget(5406, pPlayer)
24
			Player:CastSpellOnTarget(49, pPlayer)
25
			Whitemane:RegisterEvent("Move01_Whitemane90001", 1000, 1) --In 1 second "1000ms" the function "Move01_Whitemane" will run.
26
		end
27
	end
28
end
29
30
function Move01_Whitemane90001(Whitemane, event)
31
	Whitemane:MoveTo(199.556656, 108.91169, 128.522507, 4.753242)
32
	Whitemane:RegisterEvent("Move02_Whitemane90001", 4000, 1)
33
end
34
35
function Move02_Whitemane90001(Whitemane, event)
36
	Whitemane:MoveTo(201.447388, 52.051525, 128.766281, 4.742254)
37
	Whitemane:RegisterEvent("Move03_Whitemane90001", 24000, 1)
38
end
39
40
function Move03_Whitemane90001(Whitemane, event)
41
	Whitemane:MoveTo(209.785873, 51.152771, 128.840088, 6.267476)
42
	Whitemane:RegisterEvent("Move04_Whitemane90001", 3000, 1)
43
end
44
45
function Move04_Whitemane90001(Whitemane, event)
46
	Whitemane:MoveTo(236.721359, 50.011505, 115.708603, 0.027489)
47
	Whitemane:RegisterEvent("Move05_Whitemane90001", 12000, 1)
48
end
49
50
function Move05_Whitemane90001(Whitemane, event)
51
	Whitemane:MoveTo(233.375031, 41.485565, 115.707848, 4.374668)
52
	Whitemane:RegisterEvent("Move06_Whitemane90001", 3000, 1)
53
end
54
55
function Move06_Whitemane90001(Whitemane, event)
56
	Whitemane:MoveTo(201.992569, 12.324375, 115.707878, 1.586526)
57
	Whitemane:RegisterEvent("Talk01_Whitemane90001", 19000, 1)
58
end
59
60
function Talk01_Whitemane90001(Whitemane, event)
61
	Whitemane:SendChatMessage(12, 7, "Here we are, speak with me to begin your next test.")
62
	Whitemane:SetNPCFlags(3) -- Set the NPC to be able to give quests and talk again.
63
	T[Whitemane:GetInstanceID()][2] = false -- You can now launch the next quest
64
	-- !!NOTE!! You can no longer start or restart quest 1.
65
end
66
67
68
-- Second quest
69
function OnQuestAccept_Whitemane90002(event, pPlayer, QuestId, pUnit)
70
	local ID = pUnit:GetInstanceID() -- Get the instance ID for the table that saves data for the spesific instances.
71
	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
72
		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.
73
		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
74
	end
75
end
76
77
function Quest01_Whitemane90002(Whitemane, event)
78
	local Portal = Whitemane:SpawnCreature(37227, 200.697739, 59.384331, 115.708244, 1.576423, 694, 180000, 0, 0, 0, 1, 0) -- Spawns the portal
79
	Whitemane:SendChatMessage(42, 0, "The undead are coming, prepare yourself!") -- Questgiver says
80
	Whitemane:RegisterEvent("Spawn_Timer_Whitemane90002", 4000, 1) -- Spawns an NPC after 4 seconds
81
end
82
83
function Spawn_Timer_Whitemane90002(Whitemane, event)
84
	Whitemane:RegisterEvent("Spawn01_Whitemane90002", 13000, 5) -- Spawn an NPC after 13 seconds 4 times.
85
end
86
87
function Spawn01_Whitemane90002(Whitemane, event) -- The function that spawns the NPCs
88
	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.)
89
	Whitemane:RegisterEvent("Move_Ghoul90002", 2000, 1)
90
end
91
92
function Move_Ghoul90002(Whitemane, event) -- Sends the spawned Ghoul closer to Whitemane as to make the player engage combat
93
	local Ghoul = Whitemane:GetCreatureNearestCoords(200.697739, 59.384331, 115.708244, 90012)
94
	Ghoul:MoveTo(201.975159, 21.787292, 114.983719, 4.718697)
95
end
96
97
function Spawn_On_Death(pUnit, event, pPlayer)
98
	local ID = pUnit:GetInstanceID()
99
	if(T[ID] and T[ID][1] == 2 and T[ID][2] == true and T[ID][3]) then
100
		T[ID][3] = T[ID][3] + 1
101
		if(T[ID][3] >= 5) then
102
			local Whitemane = pPlayer:GetCreatureNearestCoords(201.992569, 12.324375, 115.707878, 90010)
103
			local Portal = Whitemane:GetCreatureNearestCoords(200.697739, 59.384331, 115.708244, 37227)
104
			Portal:Despawn(1000, 0)
105
			Whitemane:SendChatMessage(12, 7, "On to the next test, follow me.")
106
			local Player = Whitemane:GetClosestPlayer()
107
			Player:CastSpellOnTarget(5406, Whitemane:GetClosestPlayer())
108
			Player:CastSpellOnTarget(49, Whitemane:GetClosestPlayer())
109
			Whitemane:SetNPCFlags(4) -- Disable talking and make the NPC not be able to give or complete quests while walking and talking
110
			Whitemane:RegisterEvent("Move01_Whitemane90002", 1000, 1)
111
		end
112
	end
113
end
114
115
function Move01_Whitemane90002(Whitemane, event)
116
	Whitemane:MoveTo(247.740143, 37.573757, 115.717438, 0.002345)
117
	Whitemane:RegisterEvent("Move02_Whitemane90002", 21000, 1)
118
end
119
120
function Move02_Whitemane90002(Whitemane, event)
121
	Whitemane:MoveTo(262.464417, 37.656471, 115.727440, 1.606948)
122
	Whitemane:RegisterEvent("Move03_Whitemane90002", 6000, 1)
123
end
124
125
function Move03_Whitemane90002(Whitemane, event)
126
	Whitemane:MoveTo(262.334930, 60.696800, 109.974747, 1.598312)
127
	Whitemane:RegisterEvent("Move04_Whitemane90002", 7000, 1)
128
end
129
130
function Move04_Whitemane90002(Whitemane, event)
131
	Whitemane:MoveTo(262.259644, 101.386047, 109.971985, 1.610067)
132
	Whitemane:RegisterEvent("Move05_Whitemane90002", 20000, 1)
133
end
134
135
function Move05_Whitemane90002(Whitemane, event)
136
	Whitemane:SetNPCFlags(3)
137
	Whitemane:SendChatMessage(12, 7, "Here we are, don't worry about the Necromancers they won't attack you for now...")
138
end
139
140
-------------Everything Below here is untested and probably not working as intended-----------------
141
142
function OnQuestAccept_Whitemane90003(event, pPlayer, QuestId, pUnit)
143
	if QuestId == 90003 then
144
		local Whitemane = pPlayer:GetCreatureNearestCoords(262.259644, 101.386047, 109.971985, 90010)
145
		Whitemane:SendChatMessage(42, 0, "The Necromancers have been released!")
146
		Whitemane:SetFaction(11)
147
		Whitemane:CastSpell(43202)
148
		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
149
	end
150
end
151
152
function Spawn_Timer_Whitemane90003(Whitemane, event)
153
	Whitemane:RegisterEvent(function() Whitemane:FullCastSpell(26573) end, 10000, 2)
154
	Whitemane:RegisterEvent("Spawn_Whitemane90003", 2000, 20) -- Spawn an NPC after 2 seconds 19 times.
155
end
156
157
function Spawn_Whitemane90003(Whitemane, event)
158-
	Whitemane:RegisterEvent("Whitemane_Spell90003", 10000, 2)
158+
	local choice = math.random(1,6)
159
	if choice ==1 then
160
		Whitemane:SpawnCreature(90034, 246.671005, 81.976799, 110.250999, 0.931493, 14, 120000, 0, 0, 0, 1, 0):ModThreat(Whitemane, 100)
161
	elseif choice == 2 then
162-
function Whitemane_Spell90003(Whitemane, event)
162+
		Whitemane:SpawnCreature(90034, 247.867828, 84.609749, 109.903709, 0.862092, 14, 120000, 0, 0, 0, 1, 0):ModThreat(Whitemane, 100)
163-
	Whitemane:FullCastSpell(26573)
163+
	elseif choice == 3 then
164
		Whitemane:SpawnCreature(90034, 247.351852, 101.655975, 110.166222, 6.175311, 14, 120000, 0, 0, 0, 1, 0):ModThreat(Whitemane, 100)
165
	elseif choice == 4 then
166
		Whitemane:SpawnCreature(90034, 275.648315, 101.904953, 109.98517, 3.175088, 14, 120000, 0, 0, 0, 1, 0):ModThreat(Whitemane, 100)
167-
local choice = math.random(1,6)
167+
	elseif choice == 5 then
168-
if choice ==1 then
168+
		Whitemane:SpawnCreature(90034, 246.627472, 118.120979, 110.091766, 5.504576, 14, 120000, 0, 0, 0, 1, 0):ModThreat(Whitemane, 100)
169-
	Whitemane:SpawnCreature(90034, 246.671005, 81.976799, 110.250999, 0.931493, 14, 120000, 0, 0, 0, 1, 0)
169+
	elseif choice == 6 then
170-
	local Minion = Whitemane:GetCreatureNearestCoords(246.671005, 81.976799, 110.250999, 90034)
170+
		Whitemane:SpawnCreature(90034, 275.929443, 118.208099, 109.920647, 3.988760, 14, 120000, 0, 0, 0, 1, 0):ModThreat(Whitemane, 100)
171-
	Minion:ModThreat(Whitemane, 100)
171+
172-
else if choice == 2 then
172+
173-
	Whitemane:SpawnCreature(90034, 247.867828, 84.609749, 109.903709, 0.862092, 14, 120000, 0, 0, 0, 1, 0)
173+
174-
	local Minion = Whitemane:GetCreatureNearestCoords(247.867828, 84.609749, 109.903709, 90034)
174+
175-
	Minion:ModThreat(Whitemane, 100)
175+
176-
else if choice == 3 then
176+
177-
	Whitemane:SpawnCreature(90034, 247.351852, 101.655975, 110.166222, 6.175311, 14, 120000, 0, 0, 0, 1, 0)
177+
178-
	local Minion = Whitemane:GetCreatureNearestCoords(247.351852, 101.655975, 110.166222, 90034)
178+
179-
	Minion:ModThreat(Whitemane, 100)
179+
180-
else if choice == 4 then
180+
181-
	Whitemane:SpawnCreature(90034, 275.648315, 101.904953, 109.98517, 3.175088, 14, 120000, 0, 0, 0, 1, 0)
181+
RegisterServerHook(14, Accept90000)
182-
	local Minion = Whitemane:GetCreatureNearestCoords(275.648315, 101.904953, 109.98517, 90034)
182+
RegisterServerHook(22, Complete90001)
183-
	Minion:ModThreat(Whitemane, 100)
183+
184-
else if choice == 5 then
184+
185-
	Whitemane:SpawnCreature(90034, 246.627472, 118.120979, 110.091766, 5.504576, 14, 120000, 0, 0, 0, 1, 0)
185+
186-
	local Minion = Whitemane:GetCreatureNearestCoords(246.627472, 118.120979, 110.091766, 90034)
186+
RegisterUnitEvent(90010, 18, function() return end) -- This allows the use of :RegisterEvent() for Whitemane