insomnicide
03-09-08, 10:47 AM
Fist off, i suggest that you draw up a list of what you want your boss to do and all of the spells he will use. I also suggest that you sit down and write exactly how you want the fight to start off.
Now lets get to some code:
We need to start off by giving the boss some basic combat events:
--[[ Zaxis.lua Author: Insomnicide]]--
--Zaxis Script AI--
function Zaxis_OnCombat(pUnit, Event)
end
function Zaxis_OnLeaveCombat(pUnit, Event)
pUnit:RemoveEvents()
end
function Zaxis_OnDied(pUnit, Event)
end
function Zaxis_OnKilledTarget (pUnit, Event)
end
Next, we will give him some spells to use as script functions. Notice how i named my functions with 1 word names. you can name your functions any way you want as long as you copy them EXACTLY in the next few steps.
function Zaxis_OnCombat(pUnit, Event)
end
function Volley(pUnit, Event)
pUnit:FullCastSpellOnTarget(45031, pUnit:GetRandomPlayer(0))
end
function Flash(pUnit, Event)
local stomptarget=pUnit:GetMainTank();
pUnit:FullCastSpellOnTarget(46442, stomptarget)
end
function Nova(pUnit, Event)
pUnit:CastSpellOnTarget(30852, pUnit:GetRandomPlayer(0))
end
function Drain(pUnit, Event)
pUnit:CastSpellOnTarget(46466, pUnit:GetRandomPlayer(0))
end
function Beam(pUnit, Event)
pUnit:CastSpellOnTarget(40759, pUnit:GetRandomPlayer(0))
end
function Negative(pUnit, Event)
pUnit:CastSpellOnTarget(46285, pUnit:GetRandomPlayer(0))
end
function Zaxis_OnLeaveCombat(pUnit, Event)
pUnit:RemoveEvents()
end
function Zaxis_OnKilledTarget (pUnit, Event)
end
function Zaxis_OnDied(pUnit, Event)
end
Now, lets register all of our functions the our OnCombat events. in the parenthesis you want the name of the function in quotes, how often it will occur in milliseconds, and how many times it will happen (0 is infinite)
function Zaxis_OnCombat(pUnit, Event)
pUnit:RegisterEvent("Combat_Talk", 30000, 0)
pUnit:RegisterEvent("Nova", 45000, 0)
pUnit:RegisterEvent("Flash", 25000, 0)
pUnit:RegisterEvent("Volley", 27000, 0)
pUnit:RegisterEvent("Drain", 15000, 0)
pUnit:RegisterEvent("Beam", 30000, 0)
pUnit:RegisterEvent("Negative", 32000, 0)
end
function Volley(pUnit, Event)
pUnit:FullCastSpellOnTarget(45031, pUnit:GetRandomPlayer(0))
end
function Flash(pUnit, Event)
local stomptarget=pUnit:GetMainTank();
pUnit:FullCastSpellOnTarget(46442, stomptarget)
end
function Nova(pUnit, Event)
pUnit:CastSpellOnTarget(30852, pUnit:GetRandomPlayer(0))
end
function Drain(pUnit, Event)
pUnit:CastSpellOnTarget(46466, pUnit:GetRandomPlayer(0))
end
function Beam(pUnit, Event)
pUnit:CastSpellOnTarget(40759, pUnit:GetRandomPlayer(0))
end
function Negative(pUnit, Event)
pUnit:CastSpellOnTarget(46285, pUnit:GetRandomPlayer(0))
end
function Zaxis_OnLeaveCombat(pUnit, Event)
pUnit:RemoveEvents()
end
function Zaxis_OnKilledTarget (pUnit, Event)
end
function Zaxis_OnDied(pUnit, Event)
end Now, lets do the last thing to make the script complete. Lets register the Unit combat events to the DB.
function Zaxis_OnCombat(pUnit, Event)
pUnit:RegisterEvent("Combat_Talk", 30000, 0)
pUnit:RegisterEvent("Nova", 45000, 0)
pUnit:RegisterEvent("Flash", 25000, 0)
pUnit:RegisterEvent("Volley", 27000, 0)
pUnit:RegisterEvent("Drain", 15000, 0)
pUnit:RegisterEvent("Beam", 30000, 0)
pUnit:RegisterEvent("Negative", 32000, 0)
end
function Volley(pUnit, Event)
pUnit:FullCastSpellOnTarget(45031, pUnit:GetRandomPlayer(0))
end
function Flash(pUnit, Event)
local stomptarget=pUnit:GetMainTank();
pUnit:FullCastSpellOnTarget(46442, stomptarget)
end
function Nova(pUnit, Event)
pUnit:CastSpellOnTarget(30852, pUnit:GetRandomPlayer(0))
end
function Drain(pUnit, Event)
pUnit:CastSpellOnTarget(46466, pUnit:GetRandomPlayer(0))
end
function Beam(pUnit, Event)
pUnit:CastSpellOnTarget(40759, pUnit:GetRandomPlayer(0))
end
function Negative(pUnit, Event)
pUnit:CastSpellOnTarget(46285, pUnit:GetRandomPlayer(0))
end
function Zaxis_OnLeaveCombat(pUnit, Event)
pUnit:RemoveEvents()
end
function Zaxis_OnKilledTarget (pUnit, Event)
end
function Zaxis_OnDied(pUnit, Event)
RegisterUnitEvent(UnitID, 1, "Zaxis_OnCombat")
RegisterUnitEvent(UnitID, 2, "Zaxis_OnLeaveCombat")
RegisterUnitEvent(UnitID, 3, "Zaxis_OnKilledTarget")
RegisterUnitEvent(UnitID, 4, "Zaxis_OnDied")
Now, i will put my full shadow based boss script in here. My final product has a few more bells and whistles on it that i might create a guide on later on. My final script is in a different order, but it doesnt matter:
--[[ Zaxis.lua Author: Insomnicide]]--
--Zaxis Script AI--
function Zaxis_OnCombat(pUnit, Event)
pUnit:SendChatMessage(14, 0, "Your Lives have recently expired.")
pUnit:RegisterEvent("Combat_Talk", 30000, 0)
pUnit:RegisterEvent("Nova", 45000, 0)
pUnit:RegisterEvent("Flash", 25000, 0)
pUnit:RegisterEvent("Volley", 27000, 0)
pUnit:RegisterEvent("Drain", 15000, 0)
pUnit:RegisterEvent("Beam", 30000, 0)
pUnit:RegisterEvent("Negative", 32000, 0)
end
function Zaxis_OnLeaveCombat(pUnit, Event)
pUnit:RemoveEvents()
end
function Zaxis_OnKilledTarget (pUnit, Event)
local Choice=math.random(1, 3)
if Choice==1 then
pUnit:SendChatMessage(14, 0, "Perish, insect!")
pUnit:PlaySoundToSet(12464)
elseif Choice==2 then
pUnit:SendChatMessage(14, 0, "You are finished!")
elseif Choice==3 then
pUnit:SendChatMessage(14, 0, "Too easy!")
pUnit:PlaySoundToSet(12466)
end
end
function Zaxis_OnDied(pUnit, Event)
pUnit:SendChatMessage(14, 0, "Gah! This is not possible!")
pUnit:PlaySoundToSet(11706)
pUnit:RemoveEvents()
end
function Volley(pUnit, Event)
pUnit:FullCastSpellOnTarget(45031, pUnit:GetRandomPlayer(0))
end
function Flash(pUnit, Event)
local stomptarget=pUnit:GetMainTank();
pUnit:FullCastSpellOnTarget(46442, stomptarget)
end
function Nova(pUnit, Event)
pUnit:CastSpellOnTarget(30852, pUnit:GetRandomPlayer(0))
end
function Drain(pUnit, Event)
pUnit:CastSpellOnTarget(46466, pUnit:GetRandomPlayer(0))
end
function Beam(pUnit, Event)
pUnit:CastSpellOnTarget(40759, pUnit:GetRandomPlayer(0))
end
function Negative(pUnit, Event)
pUnit:CastSpellOnTarget(46285, pUnit:GetRandomPlayer(0))
end
function Combat_Talk(pUnit, Event)
local Choice=math.random(1, 3)
if Choice==1 then
pUnit:SendChatMessage(14, 0, "You cannot surive my wrath!")
elseif Choice==2 then
pUnit:SendChatMessage(14, 0, "You shall burn in eternity!")
elseif Choice==3 then
pUnit:SendChatMessage(14, 0, "I live for this!")
end
end
RegisterUnitEvent(UnitID, 1, "Zaxis_OnCombat")
RegisterUnitEvent(UnitID, 2, "Zaxis_OnLeaveCombat")
RegisterUnitEvent(UnitID, 3, "Zaxis_OnKilledTarget")
RegisterUnitEvent(UnitID, 4, "Zaxis_OnDied")
Now lets get to some code:
We need to start off by giving the boss some basic combat events:
--[[ Zaxis.lua Author: Insomnicide]]--
--Zaxis Script AI--
function Zaxis_OnCombat(pUnit, Event)
end
function Zaxis_OnLeaveCombat(pUnit, Event)
pUnit:RemoveEvents()
end
function Zaxis_OnDied(pUnit, Event)
end
function Zaxis_OnKilledTarget (pUnit, Event)
end
Next, we will give him some spells to use as script functions. Notice how i named my functions with 1 word names. you can name your functions any way you want as long as you copy them EXACTLY in the next few steps.
function Zaxis_OnCombat(pUnit, Event)
end
function Volley(pUnit, Event)
pUnit:FullCastSpellOnTarget(45031, pUnit:GetRandomPlayer(0))
end
function Flash(pUnit, Event)
local stomptarget=pUnit:GetMainTank();
pUnit:FullCastSpellOnTarget(46442, stomptarget)
end
function Nova(pUnit, Event)
pUnit:CastSpellOnTarget(30852, pUnit:GetRandomPlayer(0))
end
function Drain(pUnit, Event)
pUnit:CastSpellOnTarget(46466, pUnit:GetRandomPlayer(0))
end
function Beam(pUnit, Event)
pUnit:CastSpellOnTarget(40759, pUnit:GetRandomPlayer(0))
end
function Negative(pUnit, Event)
pUnit:CastSpellOnTarget(46285, pUnit:GetRandomPlayer(0))
end
function Zaxis_OnLeaveCombat(pUnit, Event)
pUnit:RemoveEvents()
end
function Zaxis_OnKilledTarget (pUnit, Event)
end
function Zaxis_OnDied(pUnit, Event)
end
Now, lets register all of our functions the our OnCombat events. in the parenthesis you want the name of the function in quotes, how often it will occur in milliseconds, and how many times it will happen (0 is infinite)
function Zaxis_OnCombat(pUnit, Event)
pUnit:RegisterEvent("Combat_Talk", 30000, 0)
pUnit:RegisterEvent("Nova", 45000, 0)
pUnit:RegisterEvent("Flash", 25000, 0)
pUnit:RegisterEvent("Volley", 27000, 0)
pUnit:RegisterEvent("Drain", 15000, 0)
pUnit:RegisterEvent("Beam", 30000, 0)
pUnit:RegisterEvent("Negative", 32000, 0)
end
function Volley(pUnit, Event)
pUnit:FullCastSpellOnTarget(45031, pUnit:GetRandomPlayer(0))
end
function Flash(pUnit, Event)
local stomptarget=pUnit:GetMainTank();
pUnit:FullCastSpellOnTarget(46442, stomptarget)
end
function Nova(pUnit, Event)
pUnit:CastSpellOnTarget(30852, pUnit:GetRandomPlayer(0))
end
function Drain(pUnit, Event)
pUnit:CastSpellOnTarget(46466, pUnit:GetRandomPlayer(0))
end
function Beam(pUnit, Event)
pUnit:CastSpellOnTarget(40759, pUnit:GetRandomPlayer(0))
end
function Negative(pUnit, Event)
pUnit:CastSpellOnTarget(46285, pUnit:GetRandomPlayer(0))
end
function Zaxis_OnLeaveCombat(pUnit, Event)
pUnit:RemoveEvents()
end
function Zaxis_OnKilledTarget (pUnit, Event)
end
function Zaxis_OnDied(pUnit, Event)
end Now, lets do the last thing to make the script complete. Lets register the Unit combat events to the DB.
function Zaxis_OnCombat(pUnit, Event)
pUnit:RegisterEvent("Combat_Talk", 30000, 0)
pUnit:RegisterEvent("Nova", 45000, 0)
pUnit:RegisterEvent("Flash", 25000, 0)
pUnit:RegisterEvent("Volley", 27000, 0)
pUnit:RegisterEvent("Drain", 15000, 0)
pUnit:RegisterEvent("Beam", 30000, 0)
pUnit:RegisterEvent("Negative", 32000, 0)
end
function Volley(pUnit, Event)
pUnit:FullCastSpellOnTarget(45031, pUnit:GetRandomPlayer(0))
end
function Flash(pUnit, Event)
local stomptarget=pUnit:GetMainTank();
pUnit:FullCastSpellOnTarget(46442, stomptarget)
end
function Nova(pUnit, Event)
pUnit:CastSpellOnTarget(30852, pUnit:GetRandomPlayer(0))
end
function Drain(pUnit, Event)
pUnit:CastSpellOnTarget(46466, pUnit:GetRandomPlayer(0))
end
function Beam(pUnit, Event)
pUnit:CastSpellOnTarget(40759, pUnit:GetRandomPlayer(0))
end
function Negative(pUnit, Event)
pUnit:CastSpellOnTarget(46285, pUnit:GetRandomPlayer(0))
end
function Zaxis_OnLeaveCombat(pUnit, Event)
pUnit:RemoveEvents()
end
function Zaxis_OnKilledTarget (pUnit, Event)
end
function Zaxis_OnDied(pUnit, Event)
RegisterUnitEvent(UnitID, 1, "Zaxis_OnCombat")
RegisterUnitEvent(UnitID, 2, "Zaxis_OnLeaveCombat")
RegisterUnitEvent(UnitID, 3, "Zaxis_OnKilledTarget")
RegisterUnitEvent(UnitID, 4, "Zaxis_OnDied")
Now, i will put my full shadow based boss script in here. My final product has a few more bells and whistles on it that i might create a guide on later on. My final script is in a different order, but it doesnt matter:
--[[ Zaxis.lua Author: Insomnicide]]--
--Zaxis Script AI--
function Zaxis_OnCombat(pUnit, Event)
pUnit:SendChatMessage(14, 0, "Your Lives have recently expired.")
pUnit:RegisterEvent("Combat_Talk", 30000, 0)
pUnit:RegisterEvent("Nova", 45000, 0)
pUnit:RegisterEvent("Flash", 25000, 0)
pUnit:RegisterEvent("Volley", 27000, 0)
pUnit:RegisterEvent("Drain", 15000, 0)
pUnit:RegisterEvent("Beam", 30000, 0)
pUnit:RegisterEvent("Negative", 32000, 0)
end
function Zaxis_OnLeaveCombat(pUnit, Event)
pUnit:RemoveEvents()
end
function Zaxis_OnKilledTarget (pUnit, Event)
local Choice=math.random(1, 3)
if Choice==1 then
pUnit:SendChatMessage(14, 0, "Perish, insect!")
pUnit:PlaySoundToSet(12464)
elseif Choice==2 then
pUnit:SendChatMessage(14, 0, "You are finished!")
elseif Choice==3 then
pUnit:SendChatMessage(14, 0, "Too easy!")
pUnit:PlaySoundToSet(12466)
end
end
function Zaxis_OnDied(pUnit, Event)
pUnit:SendChatMessage(14, 0, "Gah! This is not possible!")
pUnit:PlaySoundToSet(11706)
pUnit:RemoveEvents()
end
function Volley(pUnit, Event)
pUnit:FullCastSpellOnTarget(45031, pUnit:GetRandomPlayer(0))
end
function Flash(pUnit, Event)
local stomptarget=pUnit:GetMainTank();
pUnit:FullCastSpellOnTarget(46442, stomptarget)
end
function Nova(pUnit, Event)
pUnit:CastSpellOnTarget(30852, pUnit:GetRandomPlayer(0))
end
function Drain(pUnit, Event)
pUnit:CastSpellOnTarget(46466, pUnit:GetRandomPlayer(0))
end
function Beam(pUnit, Event)
pUnit:CastSpellOnTarget(40759, pUnit:GetRandomPlayer(0))
end
function Negative(pUnit, Event)
pUnit:CastSpellOnTarget(46285, pUnit:GetRandomPlayer(0))
end
function Combat_Talk(pUnit, Event)
local Choice=math.random(1, 3)
if Choice==1 then
pUnit:SendChatMessage(14, 0, "You cannot surive my wrath!")
elseif Choice==2 then
pUnit:SendChatMessage(14, 0, "You shall burn in eternity!")
elseif Choice==3 then
pUnit:SendChatMessage(14, 0, "I live for this!")
end
end
RegisterUnitEvent(UnitID, 1, "Zaxis_OnCombat")
RegisterUnitEvent(UnitID, 2, "Zaxis_OnLeaveCombat")
RegisterUnitEvent(UnitID, 3, "Zaxis_OnKilledTarget")
RegisterUnitEvent(UnitID, 4, "Zaxis_OnDied")