Well I've been doing lua for about 10-15 min now and I made this script
Code:
local King_Varian_Wyrnn
function King_Varian_Wyrnn_Define(Unit, Event)
King_Varian_Wyrnn = Unit
end
function King_Varian_Wyrnn_OnCombat(Unit, Event)
Unit:SendChatMessage(14, 0, "Look what we have here... the horde. After all the time we've let you live in peace, this is what it comes to. A bloody battle that nobody will forget. The existence of the horde will be no more...")
Unit:RegisterEvent("Phase_1", 1000, 0)
end
function King_Varian_Wyrnn_OnDied(Unit, Event)
Unit:SendChatMessage(14, 0, "What... have... I... done?")
end
function King_Varian_Wyrnn_OnLeaveCombat(Unit, Event)
Unit:SendChatMessage(14, 0, "Cowards!")
end
function King_Varian_Wyrnn_OnKilledTarget(Unit, dEvent)
Unit:SendChatMessage(14, 0, "Another Horde dead. So weak.")
end
function Phase_1(Unit, Event)
if Unit:GetHealthPct() <= 90 then
Unit:RemoveEvents()
Unit:SendChatMessage(14, 0, "You will soon be dead!")
Unit:CastSpellOnTarget(41484, Unit:GetRandomPlayer(1))
Unit:RegisterEvent("FireBall", 35000, 0)
end
end
function FireBall(Unit, Event)
Unit:CastSpellOnTarget(41484, Unit:GetRandomPlayer(1))
end
RegisterUnitEvent(49582, 1, "King_Varian_Wyrnn_OnCombat")
RegisterUnitEvent(49582, 2, "King_Varian_Wyrnn_OnLeaveCombat")
RegisterUnitEvent(49582, 3, "King_Varian_Wyrnn_OnKilledTarget")
RegisterUnitEvent(49582, 4, "King_Varian_Wyrnn_OnDied")
And the problem is I try to get him to cast a fireball (Which he does) but he fires it at himself... I've tried all sorts of things, I checked the spell to see if it worked properly and it did.
I tried changing..
Code:
Unit:CastSpellOnTarget(41484,Unit:GetRandomPlayer(1)
To different flags such as...
Code:
:GetRandomPlayer(flag)
RANDOM_ANY = 0,
RANDOM_IN_SHORTRANGE = 1,
RANDOM_IN_MIDRANGE = 2,
RANDOM_IN_LONGRANGE = 3,
RANDOM_WITH_MANA = 4,
RANDOM_WITH_RAGE = 5,
RANDOM_WITH_ENERGY = 6,
RANDOM_NOT_MAINTANK= 7
I've also tried
:GetClosestPlayer()
:GetMainTank()
:GetAddTank()
But sadly still nothing. So if you can please help me I will +Rep when I can lol.