Code:
--[[ Azgalor.Lua - Author: Shorts
********************************
* *
* The LUA++ Scripting Project *
* *
********************************
This software is provided as free and open source by the
staff of The LUA++ Scripting Project, in accordance with
the AGPL license. This means we provide the software we have
created freely and it has been thoroughly tested to work for
the developers, but NO GUARANTEE is made it will work for you
as well. Please give credit where credit is due, if modifying,
redistributing and/or using this software. Thank you.
~~End of License Agreement
-- LUA++ staff, April 15, 2008. ]]
function AzOnCombat(pUnit, event)
pUnit:SendChatMessage(14, 0, "Abandon all hope! The legion has returned to finish what was begun so many years ago. This time there will be no escape!")
pUnit:PlaySoundToSet(10999)
pUnit:RegisterEvent("AzAttacks", 1000, 0)
pUnit:CastSpell(31344)
end
function AzOnLeaveCombat(pUnit, event)
pUnit:RemoveEvents()
end
function AzOnKilledTarget(pUnit, event)
local AzSpeech = math.random(1,3)
if (AzSpeech == 1) then
pUnit:SendChatMessage(14, 0, "Reesh, hokta!")
pUnit:PlaySoundToSet(11001)
elseif (AzSpeech == 2) then
pUnit:SendChatMessage(14, 0, "No one is going to save you!")
pUnit:PlaySoundToSet(11047)
elseif (AzSpeech == 3) then
pUnit:SendChatMessage(14, 0, "Don't fight it!")
pUnit:PlaySoundToSet(11048)
end
end
function AzOnDeath(pUnit, event)
pUnit:SendChatMessage(14, 0, "Your time is almost... up!")
pUnit:PlaySoundToSet(11002)
end
function AzAttacks(pUnit, event)
pUnit:RegisterEvent("AzCleave", math.random(30000, 60000), 0)
pUnit:RegisterEvent("AzRoF", math.random(30000, 60000), 0)
pUnit:RegisterEvent("AzHowl", math.random(15000, 20000), 0)
pUnit:RegisterEvent("AzDoom", math.random(45000, 50000), 0)
end
function AzCleave(pUnit, event)
pUnit:CastSpellOnTarget(31345, pUnit:GetMainTank())
end
function AzRoF(pUnit, event)
if (pUnit:GetRandomPlayer(0) ~= nil) then
local pUnit = pUnit:GetRandomPlayer(0)
local x = pUnit:GetX()
local y = pUnit:GetY()
local z = pUnit:GetZ()
pUnit:CastSpellAoF(x, y, z, 31340)
end
end
function AzHowl(pUnit, event)
pUnit:CastSpell(31344)
end
function AzDoom(pUnit, event)
pUnit:CastSpell(31347, pUnit:GetRandomTarget(7))
local AzDoomSpeech = math.random(1,2)
if (AzDoomSpeech == 1) then
pUnit:SendChatMessage(14, 0, "Just a taste... of what awaits you.")
pUnit:PlaySoundToSet()
if (AzDoomSpeech == 2) then
pUnit:SendChatMessage(14, 0, "Suffer you dispicable insect!")
pUnit:PlaySoundToSet()
end
end
end
RegisterUnitEvent(17842, 1, "AzOnCombat")
RegisterUnitEvent(17842, 2, "AzOnLeaveCombat")
RegisterUnitEvent(17842, 3, "AzOnKilledTarget")
RegisterUnitEvent(17842, 4, "AzOnDeath")
Code:
--[[ Sapphiron.lua
********************************
* *
* The LUA++ Scripting Project *
* *
********************************
This software is provided as free and open source by the
staff of The LUA++ Scripting Project, in accordance with
the AGPL license. This means we provide the software we have
created freely and it has been thoroughly tested to work for
the developers, but NO GUARANTEE is made it will work for you
as well. Please give credit where credit is due, if modifying,
redistributing and/or using this software. Thank you.
~~End of License Agreement
-- LUA++ staff, April 06, 2008. ]]
--OPTIMIZATIONS: Complete.
--CLEANING: Complete.
--SCRIPT STATUS: Complete.
function Sapphiron_OnCombat(Unit, event)
setvars(Unit,{
Waterfall = nil,
players = {},
Sapphiron = {pUnit = Unit,GUID = Sapphiron:GetGUID()},
IceBlock = nil,
WingBuffet = nil,
x = 0,
y = 0,
z = 0,
radius = 0,
radians = 0,
summoncount = 0,
clockwise = nil,
FrostTrigger = nil})
Unit:CastSpell(7940)
Unit:SpawnGameObject(181225,3536.852783, -5159.951172, 143.636139,Unit:GetO(),0)
Unit:RegisterEvent("Sapphiron_LifeDrain", 24000, 0)
Unit:RegisterEvent("Chill", 15000, 0)
Unit:RegisterEvent("Sapphiron_Cleave", 10000, 0)
Unit:RegisterEvent("Sapphiron_Enrage", 900000, 0)
Unit:RegisterEvent("Fly", 2000, 1)
Unit:RegisterEvent("Sapphiron_FrostAura", 2000, 0)
--TESTING AI TICK Unit:RegisterEvent("Sapphiron_CloseToDeath", 500, 0)
end
function Sapphiron_CloseToDeath(pUnit)
print "working xd"
local args = getvars(Unit)
args.Waterfall = Unit
setvars(Unit,args)
Unit:SetUInt32Value(GAMEOBJECT_STATE,1)
end
function Sapphiron_CloseToDeath(Unit, event)
print "works"
if Unit:GetHealthPct() <= 10 then
Unit:RemoveEvents()
Unit:RegisterEvent("Sapphiron_FrostAura", 2000, 0)
Unit:RegisterEvent("Sapphiron_LifeDrain", 24000, 0)
Unit:RegisterEvent("Sapphiron_Blizzard", 15000, 0)
Unit:RegisterEvent("Sapphiron_Cleave", 10000, 0)
Unit:RegisterEvent("Sapphiron_Enrage", 900000, 0)
end
if(Unit:IsFlying() == true) then
Sapphiron_LandAlt(Sapphiron,event)
end
end
function Sapphiron_LandAlt(Unit, event)
Unit:Land()
Unit:MoveTo(Unit:GetX(),Unit:GetY(),Unit:GetZ()-10,Unit:GetO())
Unit:RegisterEvent("Sapphiron_Normal", 8000, 1)
end
function Chill(Unit, event)
local args = getvars(Unit)
if math.random(0,1) < 0.5 then
args.clockwise = true
else
args.clockwise = false
end
local plr = Unit:GetRandomPlayer(0)
local newx,newy,newz,o = plr:GetX(),plr:GetY(),plr:GetZ(),Unit:GetO()
local newradius = Unit:CalcDistance(x,y,z)
--[[ This will overwrite the Units globals destroying all previous entries.
You must define these first in the 'args' class before setting them.
The only exception to this is when you first define your starting variables
in your Unit's onCombat or onSpawn events, or if you want to destroy all previous entries?
setvars(Unit,{x = newx,y = newy, z = newz,radius = newradius}) ]]
-- Define new variables
args.newx = x;
args.newy = y;
args.newz = z;
args.newradius = radius;
-- Then save them
setvars(Unit, args);
Unit:SpawnCreature(16082,args.x,args.y,args.z,o,Unit:GetFaction(),15000)
if args.summoncount <= 20 then
Unit:RegisterEvent("Circle",2000, 0)
else
--[[ same with here;
setvars(Unit,{summoncount= 0,x = 0,y = 0, z = 0, radians = 0,radius = 0}) ]]
args.summoncount = 0;
args.x = 0;
args.y = 0;
args.z = 0;
args.radians = 0;
args.radius = 0;
-- save them.
setvars(Unit, args);
end
end
function Circle(Unit,event)
local args = getvars(Unit)
if (args.clockwise == true) then
newradians = args.radians+0.314159
elseif (args.clockwise == false) then
newradians = args.radians-0.314159
end
local newsummoncount = args.summoncount + 1
local newx = math.cos(radians)+args.radius
local newy = math.sin(radians)+args.radius
--setvars(Unit,{x = newx,y = newy, summoncount = newsummoncount, radians = newradians})
args.x = newx;
args.y = newy;
args.summoncount = newsummoncount;
args.radians = newradians;
-- save them
setvars(Unit, args);
Unit:SpawnCreature(16082,args.x,args.y,args.z,args,Unit:GetO(),15000)
end
function Chill(Trigger, event)
print "Yes OnSpawn for Creature works xD"
local args = getvars(Unit)
Trigger:SetNameById(args.Sapphiron.pUnit:GetEntry())
Trigger:SetUInt32Value(UNIT_FIELD_FLAGS,UNIT_FLAG_NOT_SELECTABLE)
Trigger:SetUInt32Value(UNIT_FIELD_FLAGS,UNIT_FLAG_NOT_ATTACKABLE_2)
Trigger:SetCombatMeleeCapable(1)
Trigger:Root()
Trigger:CastSpell(28547)
end
function Icebolt(Unit, event)
local plr = Unit:GetRandomPlayer(0)
if (plr~= nil) then
Unit:FullCastSpellOnTarget(28522,plr)
Unit:RegisterEvent("ImmunityCheck", 100,1 )
end
end
function Sapphiron_FrostAura(Unit)
Unit:CastSpell(28531)
end
function Sapphiron_LifeDrain(Unit, event)
local tank = Unit:GetMainTank()
if tank~= nil then
Unit:FullCastSpellOnTarget(28542,tank)
end
end
function Sapphiron_Cleave(Unit, event)
if (Unit:GetMainTank() ~= nil) then
Unit:CastSpellOnTarget(31345, Unit:GetMainTank())
else
end
end
function Sapphiron_Enrage(Unit)
Unit:CastSpell(26662)
end
function Fly(Unit, event)
print "Fly intitiated"
Unit:RemoveEvents()
Unit:SetCombatMeleeCapable(1)
Unit:SetUInt32Value(UNIT_FIELD_FLAGS,UNIT_FLAG_NOT_ATTACKABLE_9)
Unit:MoveTo(Unit:GetSpawnX(),Unit:GetSpawnY(),Unit:GetSpawnZ(),Unit:GetSpawnO())
Unit:RegisterEvent("Fly2", 500, 1)
end
function Fly2(Unit,event)
print "Fly2 intitiated"
if Unit:IsCreatureMoving() == false then
Unit:SetFlying()
Unit:RegisterEvent("Fly3", 2000, 1)
else
Unit:RegisterEvent("Fly2", 500, 1)
end
end
function Fly3(Unit, event)
print "Fly3 intitiated"
Unit:MoveTo(Unit:GetX(),Unit:GetY(),Unit:GetZ()+10,Unit:GetO())
Unit:RegisterEvent("Fly4", 1000, 1)
end
function Fly4(Unit,event)
print "Fly4 intitiated"
if Unit:IsCreatureMoving() == false then
Unit:SpawnCreature(17025,Unit:GetSpawnX(),Unit:GetSpawnY(),Unit:GetSpawnZ(),Unit:GetSpawnO(),Unit:GetFaction(),0)
Unit:RegisterEvent("Icebolt", 2000, 5)
Unit:RegisterEvent("Sapphiron_CastFrostBreath", 10000, 1)
else
Unit:RegisterEvent("Fly4",1000, 1)
end
end
function WingBuffet(Unit,event)
print "WingBuffet initiated"
local args = getvars(Unit)
args.WingBuffet = Unit
setvars(Unit,args)
Unit:SetUInt32Value(UNIT_FIELD_FLAGS,UNIT_FLAG_NOT_SELECTABLE)
Unit:SetUInt32Value(UNIT_FIELD_FLAGS,UNIT_FLAG_NOT_ATTACKABLE_2)
Unit:CastSpell(29328)
end
function ImmunityCheck(Unit,event)
local args = getvars(Unit)
local tbl = Unit:GetInRangePlayers()
for k,v in pairs(tbl) do
if v:HasAura(28522) == true then
args.Sapphiron.pUnit:FullCastSpellOnTarget(7940,v)
args.IceBlock = Unit:SpawnGameObject(181247,v:GetX(),v:GetY(),v:GetZ(),v:GetO(),25000)
setvars(Unit,args)
end
end
--setvars(Unit,args); should be in the for loop to avoid unnecessary work
end
function LoS(Unit,event)
print "OnSpawn works"
local args = getvars(Unit)
for k,v in pairs(args) do print (k,v)
end
-- or -- table.foreach(args, print) - works the same as above just neater.
local tbl = Unit:GetInRangePlayers()
for k,v in pairs(tbl) do
print (k,v)
if Unit:IsInFront(v) then
local say = " is behind iceblock."
Unit:SendChatMessage(12,0,v:GetName()..say)
Unit:CastSpell(7940,v)
end
end
end
function Sapphiron_CastFrostBreath(Unit, event)
Unit:SendChatMessage(16, 0, "Sapphiron takes a deep breath...")
Unit:RemoveEvents()
Unit:SpawnCreature(15624,Unit:GetX(),Unit:GetY(),Unit:GetZ(),Unit:GetO(),Unit:GetFaction(),0)
Unit:RegisterEvent("Sapphiron_Land", 8000, 1)
end
---------------FROST BREATH DUMMY TRIGGER----------------
function Trigger(Unit,event)
local args = getvars(Unit)
args.FrostTrigger = Unit
setvars(Unit,args)
Unit:EnableMoveFly(1)
Unit:SetUInt32Value(UNIT_FLAG_NOT_SELECTABLE)
Unit:SetUInt32Value(UNIT_FLAG_NOT_ATTACKABLE_2)
Unit:SetMoveRunFlag(0)
Unit:MoveTo(args.Sapphiron.pUnit:GetSpawnX(),args.Sapphiron.pUnit:GetSpawnY(),args.Sapphiron.pUnit:GetSpawnZ(),args.Sapphiron.pUnit:GetSpawnO())
Unit:RegisterEvent("TriggerStopped", 1000, 1)
end
function TriggerStopped(Unit,event)
print "TriggerStopped initiated"
if(Unit:IsCreatureMoving() == false) then
Unit:FullCastSpell(29318)
Unit:RemoveFromWorld()
else
Unit:RegisterEvent("TriggerStopped",500,1)
end
end
----------------------------------------------------------------------------
function Sapphiron_Land(Unit, event)
local tbl = Unit:GetInRangeObjects()
local tbl2 = Unit:GetInRangePlayers()
for k,v in pairs(tbl) do
if v:GetEntry() == 181247 then
v:RemoveFromWorld()
end
end
for k,v in pairs(tbl2) do
if v:HasAura(7940) == true then
v:RemoveAura(7940)
end
if v:HasAura(28522) == true then
v:Remove(28522)
end
end
Unit:Land()
Unit:SetCombatMeleeCapable(1)
Unit:MoveTo(Unit:GetX(),Unit:GetY(),Unit:GetZ()-10,Unit:GetO())
Unit:RegisterEvent("Sapphiron_Normal", 3000, 1)
end
function Sapphiron_Normal(Unit, event)
Unit:SetCombatMeleeCapable(0)
Unit:GetMainTank()
Unit:RegisterEvent("Sapphiron_Fly", 67000, 0)
Unit:RegisterEvent("Sapphiron_FrostImmune", 0, 0)
Unit:RegisterEvent("Sapphiron_FrostAura", 2000, 0)
Unit:RegisterEvent("Sapphiron_LifeDrain", 24000, 0)
--Unit:RegisterEvent("Sapphiron_Blizzard", 15000, 0)
Unit:RegisterEvent("Sapphiron_Cleave", 10000, 0)
Unit:RegisterEvent("Sapphiron_Enrage", 900000, 0)
end
function Sapphiron_OnLeaveCombat(Unit)
local args = getvars(Unit)
if args.Waterfall ~= nil then
args.Waterfall:SetUInt32Value(GAMEOBJECT_STATE,0)
end
setvars(Unit,true)
--collectgarbage(); No longer needed as setvars will take care of garbage collection now.
Unit:RemoveEvents()
end
function Sapphiron_OnDied(Unit)
Unit:CastSpell(29357)
local args = getvars(Unit)
if args.Waterfall ~= nil then
args.Waterfall:SetUInt32Value(GAMEOBJECT_STATE,0)
end
--setvars(Unit,true) this will be taken care of in the OnLeaveCombat so no need to do it twice.
end
RegisterUnitEvent(15624,5,"Trigger")
RegisterGameObjectEvent(181247,2,"LoS")
RegisterUnitEvent(16082,5,"Chill")
RegisterUnitEvent(17025,5,"WingBuffet")
RegisterGameObjectEvent(181225, 2, "Sapphiron_CloseToDeath")
RegisterUnitEvent(15989,7,"Sapphiron_CloseToDeath")
RegisterUnitEvent(15989, 1, "Sapphiron_OnCombat")
RegisterUnitEvent(15989, 2, "Sapphiron_OnLeaveCombat")
RegisterUnitEvent(15989, 4, "Sapphiron_OnDied")
Code:
--[[ M'Uru.lua Author:Shorts
********************************
* *
* The LUA++ Scripting Project *
* *
********************************
This software is provided as free and open source by the
staff of The LUA++ Scripting Project, in accordance with
the AGPL license. This means we provide the software we have
created freely and it has been thoroughly tested to work for
the developers, but NO GUARANTEE is made it will work for you
as well. Please give credit where credit is due, if modifying,
redistributing and/or using this software. Thank you.
~~End of License Agreement
-- LUA++ staff, March 26, 2008. ]]
--[[ ~~NOTE~~ This script is untested and unfinished, add's have to be added/scripted, which I am unable to do because I do n
not have a server to get the positions for them]]--
---------------------------
-- M'uru AI Script
---------------------------
function MuruOnCombat(pUnit, event)
pUnit:StopMovement()
pUnit:RegisterEvent("MuruNegEn", 1000, 0)
pUnit:RegisterEvent("MuruDarkness", 45000, 0)
pUnit:RegisterEvent("VoidSentinel", 60000, 0)
pUnit:RegisterEvent("DarkFiendSummon", 45000, 0)
pUnit:RegisterEvent("SummonHumanoids", 10000, 1)
--pUnit:RegisterEvent("MuruEnrage", 600000, 0)
end
function MuruOnLeaveCombat(pUnit, event)
pUnit:RemoveEvents()
end
function MuruOnDeath(pUnit, event)
pUnit:RemoveEvents()
local X = GetX()
local Y = GetY()
local Z = GetZ()
pUnit:SpawnCreature(25840, X, Y, Z)
pUnit:Despawn()
end
function MuruNegEn(pUnit, event)
pUnit:CastSpellOnTarget(46008, pUnit:GetRandomTarget(0))
end
function MuruDarkness(pUnit, event)
local X = GetX()
local Y = GetY()
local Z = GetY()
pUnit:CastSpellAoF(x, y, z, 45996)
end
--function DarkFiendSummon(pUnit, event)
--
--end
function SummonHumanoids(pUnit, event)
pUnit:SpawnCreature()
pUnit:SpawnCreature()
pUnit:SpawnCreature()
pUnit:SpawnCreature()
pUnit:SpawnCreature()
pUnit:SpawnCreature()
end
function VoidSentinel(pUnit, event)
pUnit:SpawnCreature()
end
--function MuruEnrage(pUnit, event)
--pUnit:CastSpell()
--end
------------------------------
-- Entropius AI Script
------------------------------
function EntropiusOnCombat(pUnit, event)
pUnit:RegisterEvent("EntropiusNegEn", 1000)
pUnit:RegisterEvent("EntropiusBlackHole", 45000)
end
function EntropiusOnLeaveCombat(pUnit, event)
pUnit:RemoveEvents()
end
function EntropiusOnDeath(pUnit, event)
pUnit:RemoveEvents()
end
function EntropiusNegEn(pUnit, event)
pUnit:CastSpellOnTarget(46289, pUnit:GetRandomTarget(0))
end
function EntropiusBlakHole(pUnit, event)
local X = GetX()
local Y = GetY()
local Z = GetY()
pUnit:CastSpellAoF(x, y, z, 46282)
end
-----------------------------
-- M'uru Adds AI Scripts
-----------------------------
function ShadowBerserk(pUnit, event)
pUnit:RegisterEvent("Flurry", math.random(25000, 30000), 0)
end
RegisterUnitEvent(25798, 1, "ShadowBerserk")
function Flurry(pUnit, event)
pUnit:CastSpell(46160)
end
--------------------------------------
function ShadowFuryMage(pUnit, event)
pUnit:RegisterEvent("FelFireball", 0)
pUnit:RegisterEvent("SpellFury", 0)
end
function FelFireball(pUnit, event)
pUnit:FullCastSpellOnTarget(46101, pUnit:GetRandomTarget(0))
end
function SpellFury(pUnit, event)
pUnit:CastSpell(46102)
end
RegisterUnitEvent(25741, 1, "MuruOnCombat")
RegisterUnitEvent(25741, 2, "MuruOnLeaveCombat")
RegisterUnitEvent(25741, 4, "MuruOnDeath")
RegisterUnitEvent(25799, 1, "ShadowFuryMage")
RegisterUnitEvent(25840, 1, "EntropiusOnCombat")
RegisterUnitEvent(25840, 2, "EntropiusOnLeaveCombat")
RegisterUnitEvent(25840, 4, "EntropiusOnDeath")