Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- by Mordred
- local SM = {{Flag = {[0] = 0.39, [1] = 0.172, [2] = 0.13}},
- traineeid = 38000,
- dogid = 38001,
- armoredtraineeid = 38002,
- houndmasterrokyrid = 38003,
- commandermarladecoyid = 38004,
- commandermarlaburnedid = 38005,
- commadermarlafirewaveid = 38006,
- commandermarlafireballid = 38007,
- commandermarladummyid = 38008,
- scarletcommandermarlaid = 38009,
- herod = #####}
- ------------------------ NPC CHAT FUNCTION --------------------------
- --[[
- Pattern:
- tablename = {"dummy text",12, -> at first the string, then the type (language is always 0(general))
- "dummy text",12,
- "dummy text",14, -> length of the string for time until next chat bubble (min. time of 3sec and max time of 10sec)
- "dummy text",14,
- "dummy text",12}
- local time = SM.NPCTalkSequence(Unit,tablename) -> returns total length of the sequence
- --]]
- function SM.NPCTalkSequence(Unit, Table)
- if not Unit then return; end
- if not Table then return; end
- local maxtentrys = table.getn(Table)
- if maxtentrys < 4 then print("Must be at least 2 strings and 2 numbers in the table!") return end
- local maxtime = 0
- Unit:SendChatMessage(Table[2],0,Table[1])
- for i=3,maxtentrys,2 do
- local timecoef = 0
- local checktime = string.len(Table[i-2])*100-string.len(Table[i-2])*50
- if checktime < 3000 then timecoef = 3000; else timecoef = checktime; end if (timecoef) > 10000 then timecoef = 10000; end
- maxtime = maxtime + timecoef
- Unit:RegisterEvent(function() Unit:SendChatMessage(Table[i+1],0,Table[i]) end, maxtime, 1)
- end
- local timecoef = 0
- local checktime = string.len(Table[maxtentrys-1])*100-string.len(Table[maxtentrys-1])*50
- if checktime < 3000 then timecoef = 3000; else timecoef = checktime; end if (timecoef) > 10000 then timecoef = 10000; end
- maxtime = maxtime + timecoef
- return maxtime
- end
- ------------------------- NPC MOVE FUNCTION -------------------------
- --[[ How to register with MovePath
- local PathIDs = {
- {x,y,z,delay,flag[,function called, delayed function]},
- {...},
- ...
- {...},
- {x,y,z,delay,flag[,function called, delayed function]},
- {x,y,z,delay,Restartflag[,function called, delayed function]}}
- SM.StartPath(Unit, PathIDs)
- --MovePath commands--
- StartPath(unit, path table) -> Starts the Path with the unit and the table with the containing informations.
- ChangePathNode(path table, PathNode, [X],[Y],[Z],[Delay],[Flag],[function called],[delayed function]) -> Changes the properties of the PathNode, but only the given ones and returns true if successfully changed or false if failed.
- SetRestartFlag(path table, true/false) -> Changes the RestartFlag of the last PathNode to true/false and returns true if successfully changed or false if failed.
- AddPathNode(path table, PathNode, X, Y, Z, Delay, Flag, function called, delayed function) -> Adds a new PathNode to the table with the given informations and returns true if successfully added or false if failed.
- RemovePathNode(path table, PathNode) -> Removes a PathNode from the table and returns true if successfully removed or false if failed.
- --]]
- -- Flags: 0=Walk; 1=Run; (2=Fly bugged, never lands again)
- -- Restartflag: false/true
- function SM.StartPath(Unit, Table)
- local x = Table[1][1]; local y = Table[1][2]; local z = Table[1][3]
- Unit:SetMovementFlags(Table[1][5])
- local rTime = ((Unit:CalcToDistance(x,y,z)*SM.Flag[Table[1][5]])*1000) - ((Unit:CalcToDistance(x,y,z)*80) - (Unit:CalcToDistance(x,y,z)*5))
- if rTime < 100 then
- SM.PathPoints(Unit, Table, 1)
- else
- Unit:RegisterEvent(function() SM.PathPoints( Unit, Table, 1 ) end,rTime,1)
- end
- Unit:MoveTo(x,y,z,0)
- end
- function SM.PathPoints(Unit, Table, PathNum)
- local x = Table[PathNum][1]; local y = Table[PathNum][2]; local z = Table[PathNum][3]
- local rTime = ((Unit:CalcToDistance(x,y,z)*SM.Flag[Table[PathNum][5]])*1000) - ((Unit:CalcToDistance(x,y,z)*80) - (Unit:CalcToDistance(x,y,z)*5))
- if rTime < 150 then
- if (Table[PathNum][6]~=nil) then
- _G[Table[PathNum][6]](Unit, PathNum)
- end
- if (PathNum<table.getn(Table)) and Unit:IsInWorld() then
- if (Table[PathNum][4]~=0) then
- Unit:RegisterEvent(function() SM.DelayMove( Unit, Table, PathNum ) end,Table[PathNum][4],1)
- else
- Unit:SetMovementFlags(Table[PathNum][5])
- local x = Table[PathNum+1][1]; local y = Table[PathNum+1][2]; local z = Table[PathNum+1][3]
- local rTime = ((Unit:CalcToDistance(x,y,z)*SM.Flag[Table[PathNum][5]])*1000) - ((Unit:CalcToDistance(x,y,z)*80) - (Unit:CalcToDistance(x,y,z)*5))
- if rTime < 100 then
- SM.PathPoints(Unit, Table, PathNum+1)
- else
- Unit:RegisterEvent(function() SM.PathPoints( Unit, Table, PathNum+1 ) end,rTime,1)
- end
- Unit:MoveTo(x,y,z,0)
- end
- elseif Table[PathNum][5] then
- SM.StartPath(Unit, Table)
- end
- else
- Unit:RegisterEvent(function() SM.PathPoints( Unit, Table, PathNum ) end,rTime,1)
- if not Unit:IsCreatureMoving() then Unit:MoveTo(x,y,z,0) end
- end
- end
- function SM.DelayMove(Unit, Table, PathNum)
- if (Table[PathNum][7]~=nil) then
- _G[Table[PathNum][7]](Unit, PathNum)
- end
- Unit:SetMovementFlags(Table[PathNum][5])
- local x = Table[PathNum+1][1]; local y = Table[PathNum+1][2]; local z = Table[PathNum+1][3]
- Unit:MoveTo(x,y,z,0)
- local rTime = ((Unit:CalcToDistance(x,y,z)*SM.Flag[Table[PathNum][5]])*1000) - ((Unit:CalcToDistance(x,y,z)*80) - (Unit:CalcToDistance(x,y,z)*5))
- if rTime < 100 then
- SM.PathPoints(Unit, Table, PathNum+1)
- else
- Unit:RegisterEvent(function() SM.PathPoints( Unit, Table, PathNum+1 ) end,rTime,1)
- end
- end
- function SM.ChangePathNode(Table, PathNum, X,Y,Z,Delay,Flag,FuncCalled,DelayFunc)
- if Table and PathNum then
- if X then if type(X)~="number" then return false, type(X); end
- Table[PathNum][1] = X
- end if Y then if type(Y)~="number" then return false, type(Y); end
- Table[PathNum][2] = Y
- end if Z then if type(Z)~="number" then return false, type(Z); end
- Table[PathNum][3] = Z
- end if Delay then if type(Delay)~="number" then return false, type(Delay); end
- Table[PathNum][4] = Delay
- end if Flag and PathNum~=getn(Table) then if type(Flag)~="number" then return false type(Flag); end
- Table[PathNum][5] = Flag
- end if FuncCalled then if type(FuncCalled)~="string" then return false, type(FuncCalled); end
- Table[PathNum][6] = FuncCalled
- end if DelayFunc then if type(DelayFunc)~="string" then return false, type(DelayFunc); end
- Table[PathNum][7] = DelayFunc
- end
- return true;
- else return false, false; end
- end
- function SM.SetRestartFlag(Table, Boolean)
- if Table~=nil then
- if type(Boolean)=="boolean" then
- Table[getn[Table]][5] = Boolean
- return true;
- else return false, type(Boolean); end
- else return false, false; end
- end
- function SM.AddPathNode(Table, PathNum, X,Y,Z,Delay,Flag,FuncCalled,DelayFunc)
- if Table~=nil then
- if PathNum<=getn(Table) then
- table.insert(Table, PathNum, {X,Y,Z,Delay,Flag,FuncCalled,DelayFunc})
- return true;
- else return false, getn(Table); end
- else return false, false; end
- end
- function SM.RemovePathNode(Table, PathNum)
- if Table~=nil then
- if type(PathNum)=="number" then
- table.remove(Table, PathNum)
- return true;
- else return false; end
- else return false; end
- end
- ----------------------------Entering Event----------------------------
- function SM.Trainees_OnSpawn(Unit)
- local iID = Unit:GetInstanceID()
- if not iID then error("This NPC is not in an instance!") end
- Unit:DisableCombat(true)
- Unit:DisableMelee(true)
- Unit:DisableTargeting(true)
- Unit:SetUInt32Value(59,256)
- Unit:SetMovementFlags(1)
- Unit:Emote(431, 3000)
- Unit:RegisterEvent(function()
- Unit:MoveTo(151.179,-1.87,18.01,3.173)
- local rnd = math.random(4)
- if rnd==1 then
- local rnd = math.random(4)
- if rnd==1 then
- Unit:MonsterYell("Quick! Get to the commanders! Intruders entered our monastery!")
- elseif rnd==2 then
- Unit:MonsterYell("Intruders entered our monastery! Run!")
- elseif rnd==3 then
- Unit:MonsterYell("Watch out! He has a weapon!")
- else
- Unit:MonsterSay("They don't look friendly, we better get help here quickly.")
- end
- end
- local diff = IS.Spawned[iID].diff
- if diff==2 then
- Unit:RegisterEvent(function()
- if Unit:IsAlive() then
- local dog = Unit:SpawnCreature(SM.dogid, Unit:GetSpawnX(),Unit:GetSpawnY(),Unit:GetSpawnZ(),Unit:GetSpawnO(), 14, 0, 0,0,0,1,0)
- dog:TeleportCreature(Unit:GetX(),Unit:GetY(),Unit:GetZ())
- Unit:RegisterEvent(function()
- dog:MoveTo(Unit:GetSpawnX(),Unit:GetSpawnY(),Unit:GetSpawnZ(),Unit:GetSpawnO())
- end, 1000, 1)
- end end, 8000, 1)
- elseif diff==4 then
- Unit:RegisterEvent(function()
- if Unit:IsAlive() then
- local dog = Unit:SpawnCreature(SM.armoredtraineeid, Unit:GetSpawnX(),Unit:GetSpawnY(),Unit:GetSpawnZ(),Unit:GetSpawnO(), 14, 0, 0,0,0,1,0)
- dog:TeleportCreature(Unit:GetX(),Unit:GetY(),Unit:GetZ())
- dog:SetMovementFlags(1)
- Unit:RegisterEvent(function()
- dog:MoveTo(Unit:GetSpawnX(),Unit:GetSpawnY(),Unit:GetSpawnZ(),Unit:GetSpawnO())
- end, 1000, 1)
- end end, 8500, 1)
- end
- Unit:Despawn(10000,0)
- end, 1000, 1)
- end
- RegisterUnitEvent(SM.traineeid, 18, SM.Trainees_OnSpawn)
- ----------------------------------------------------------------------
- -- --
- -- --
- -------------<sideboss>-----1st Boss-----Houndmaster Rokyr------------
- SM.HR = {dogs = {},
- Spells = {
- -- Spells which the boss and his minions will use
- revive = 51920,
- mendpettrigger = 60957,
- mendpet = 15870,
- freepettrigger = 54350,
- freepet = 59752,
- freezingtrap = 60192,
- freezingtrigger = 60888,
- petenragetrigger = 46731,
- petenrage = 15061,
- invincible = 52075}}
- function SM.HR.OnSpawn(Unit)
- Unit:DisableCombat(true)
- Unit:DisableMelee(true)
- Unit:DisableTargeting(true)
- Unit:CastSpell(SM.HR.Spells.invincible)
- Unit:RegisterEvent(SM.HR.AreaBossTrigger, 2000, 0)
- end
- function SM.HR.AreaBossTrigger(Unit)
- local iID = Unit:GetInstanceID()
- if not iID then error("This NPC is not in an instance!") end
- local plrs = GetPlayersInInstance(44, iID)
- if plrs then
- local AreaCheck = true
- for num,plr in pairs(plrs) do
- if not ( plr:GetX()>171 and plr:GetX()<190 and plr:GetY()<-109 and plr:GetY()>-141 ) then
- AreaCheck = false
- end
- end
- if AreaCheck then
- Unit:RemoveEvents()
- local RokyrTalk = {"Who are you?",12,
- "What are you doing here?",12,
- "Oh, I see. We got some intruders here.",12,
- "Why has no one informed me yet!?", 14,
- "It's time to play, my babies!",14}
- local timer = SM.NPCTalkSequence(Unit,RokyrTalk)
- Unit:Emote(27,timer+2000)
- Unit:RegisterEvent(function()
- SM.HR.dogs[iID] = {}
- local diff = IS.Spawned[iID].diff
- for i=1, diff, 1 do
- local dog = Unit:SpawnCreature(SM.dogid,189.702,-103.948,18.677,3.1289,14,0, 0,0,0,1,0)
- dog:SetMovementFlags(1)
- LCF:RegisterLuaEvent(tostring(dog), function()
- dog:MoveTo((Unit:GetX()-2)+math.random(4),(Unit:GetY()+2)-math.random(4),Unit:GetZ(), Unit:GetO())
- end, 1000, 1)
- table.insert(SM.HR.dogs[iID], dog)
- end
- Unit:RegisterEvent(SM.HR.DogAlive_and_Area_Check, 3000, 1)
- Unit:RegisterEvent(SM.HR.RandomSpellTrigger, 6000, 1)
- if diff~=4 then
- Unit:RemoveAura(SM.HR.Spells.invincible)
- end
- end, timer, 1)
- end
- end
- end
- function SM.HR.RandomSpellTrigger(Unit)
- local srnd = math.random(3)
- if srnd==1 then
- Unit:FullCastSpell(SM.HR.Spells.mendpettrigger)
- elseif srnd==2 then
- Unit:CastSpell(SM.HR.Spells.petenragetrigger)
- else
- Unit:CastSpell(SM.HR.Spells.freepettrigger)
- end
- end
- function SM.HR.RandomDogSelectionCast(Unit, Spell)
- local iID = Unit:GetInstanceID()
- if not iID then error("This NPC is not in an instance!") end
- local drnd = math.random(table.getn(SM.HR.dogs[iID]))
- if type(SM.HR.dogs[iID][drnd])=="table" then
- for num,unt in pairs(SM.HR.dogs[iID]) do
- if type(unt)~="table" then
- drnd = num
- break;
- end
- end
- end
- Unit:RegisterEvent(SM.HR.RandomSpellTrigger, 5000, 1)
- if SM.HR.dogs[iID][drnd]~="table" then
- SM.HR.dogs[iID][drnd]:CastSpell(Spell)
- end
- end
- function SM.HR.EnragePetTriggerSpell(index, Spell)
- local Unit = Spell:GetCaster()
- if Unit:IsPlayer() then return; end
- if Unit:GetEntry()~=SM.houndmasterrokyrid then return; end
- SM.HR.RandomDogSelectionCast(Unit, SM.HR.Spells.petenrage)
- end
- function SM.HR.MendPetTriggerSpell(index, Spell)
- local Unit = Spell:GetCaster()
- if Unit:IsPlayer() then return; end
- if Unit:GetEntry()~=SM.houndmasterrokyrid then return; end
- SM.HR.RandomDogSelectionCast(Unit, SM.HR.Spells.mendpet)
- end
- function SM.HR.FreePetTriggerSpell(index, Spell)
- local Unit = Spell:GetCaster()
- if Unit:IsPlayer() then return; end
- if Unit:GetEntry()~=SM.houndmasterrokyrid then return; end
- SM.HR.RandomDogSelectionCast(Unit, SM.HR.Spells.freepet)
- end
- RegisterDummySpell(SM.HR.Spells.mendpettrigger, SM.HR.MendPetTriggerSpell)
- RegisterDummySpell(SM.HR.Spells.freepettrigger, SM.HR.FreePetTriggerSpell)
- RegisterDummySpell(SM.HR.Spells.petenragetrigger, SM.HR.EnragePetTriggerSpell)
- function SM.HR.DogAlive_and_Area_Check(Unit)
- local iID = Unit:GetInstanceID()
- if not iID then error("This NPC is not in an instance!") end
- local plrs = GetPlayersInInstance(44, iID)
- local diff = IS.Spawned[iID].diff
- if plrs then
- local AreaCheck = false
- for num,plr in pairs(plrs) do
- if not ( plr:GetX()>171 and plr:GetX()<190 and plr:GetY()<-109 and plr:GetY()>-141 ) then
- AreaCheck = true
- end
- end
- if AreaCheck then
- Unit:RemoveEvents()
- Unit:Despawn(0,10000)
- if SM.HR.dogs[iID] then
- for num,dog in pairs(SM.HR.dogs[iID]) do
- dog:Despawn(0,0)
- end
- end
- return;
- end
- end
- --
- local deadcheck = true
- if SM.HR.dogs[iID] then
- for num,dog in pairs(SM.HR.dogs[iID]) do
- if type(dog)~="table" then
- if dog:IsAlive() then
- deadcheck = false
- else
- local x = dog:GetX(); local y = dog:GetY(); local z = dog:GetZ(); local o = dog:GetO();
- dog:Despawn(2000,0)
- SM.HR.dogs[iID][num] = {x,y,z,o}
- end
- end
- end
- end
- if deadcheck then
- Unit:RemoveEvents()
- Unit:FullCastSpell(SM.HR.Spells.revive)
- if diff==4 then
- Unit:RemoveAura(SM.HR.Spells.invincible)
- end
- else
- if diff==2 or diff==4 then
- local frnd = math.random(100)
- if frnd<=5 then
- Unit:RemoveEvents()
- Unit:FullCastSpell(SM.HR.Spells.freezingtrigger)
- else
- Unit:RegisterEvent(SM.HR.DogAlive_and_Area_Check, 2000, 1)
- end
- end
- end
- end
- function SM.HR.ReviveSpell(index, Spell)
- local Unit = Spell:GetCaster()
- if Unit:IsPlayer() then return; end
- if Unit:GetEntry()~=SM.houndmasterrokyrid then return; end
- local iID = Unit:GetInstanceID()
- if not iID then error("This NPC is not in an instance!") end
- local diff = IS.Spawned[iID].diff
- if SM.HR.dogs[iID] then
- local new = {}
- for num,dog in pairs(SM.HR.dogs[iID]) do
- if type(dog)=="table" then
- local dawg = Unit:SpawnCreature(SM.dogid,dog[1],dog[2],dog[3],dog[4],14,0, 0,0,0,1,0)
- dawg:CastSpell(51920)
- table.insert(new, dawg)
- end
- end
- SM.HR.dogs[iID] = new
- end
- if diff==4 then
- Unit:CastSpell(SM.HR.Spells.invincible)
- end
- Unit:RegisterEvent(SM.HR.DogAlive_and_Area_Check, 2000, 1)
- Unit:RegisterEvent(SM.HR.RandomSpellTrigger, 5000, 1)
- end
- RegisterDummySpell(SM.HR.Spells.revive, SM.HR.ReviveSpell)
- function SM.HR.FreezingTrap(index, Spell)
- local Unit = Spell:GetCaster()
- if Unit:IsPlayer() then return; end
- if Unit:GetEntry()~=SM.houndmasterrokyrid then return; end
- local iID = Unit:GetInstanceID()
- if not iID then error("This NPC is not in an instance!") end
- local plrs = GetPlayersInInstance(44, iID)
- if plrs then
- local prnd = math.random(table.getn(plrs))
- Unit:CastSpellAoF(plrs[prnd]:GetX(), plrs[prnd]:GetY(), plrs[prnd]:GetZ(), SM.HR.Spells.freezingtrap)
- end
- Unit:RegisterEvent(SM.HR.DogAlive_and_Area_Check, 2000, 1)
- Unit:RegisterEvent(SM.HR.RandomSpellTrigger, 5000, 1)
- end
- RegisterDummySpell(SM.HR.Spells.freezingtrigger, SM.HR.FreezingTrap)
- function SM.HR.OnLeave(Unit)
- local iID = Unit:GetInstanceID()
- if not iID then error("This NPC is not in an instance!") end
- Unit:RemoveEvents()
- if SM.HR.dogs[iID] then
- for num,dog in pairs(SM.HR.dogs[iID]) do
- if type(dog)~="table" then
- dog:Despawn(0,0)
- end
- end
- end
- SM.HR.OnSpawn(Unit)
- end
- function SM.HR.OnDied(Unit)
- local iID = Unit:GetInstanceID()
- if not iID then error("This NPC is not in an instance!") end
- local diff = IS.Spawned[iID].diff
- Unit:RemoveEvents()
- if SM.HR.dogs[iID] then
- for num,dog in pairs(SM.HR.dogs[iID]) do
- if type(dog)=="table" then
- local dawg = Unit:SpawnCreature(SM.dogid,dog[1],dog[2],dog[3],dog[4],14,0, 0,0,0,1,0)
- dawg:CastSpell(51920)
- if diff~=4 then
- dawg:DisableCombat(true)
- dawg:DisableTargeting(true)
- dawg:DisableMelee(true)
- LCF:RegisterLuaEvent(tostring(dawg), function()
- dawg:MoveTo(189.702,-103.948,18.677,3.1289)
- end, 1000, 1)
- dawg:Despawn(6000,0)
- else
- LCF:RegisterLuaEvent(tostring(dawg), function()
- dawg:CastSpell(SM.HR.Spells.petenrage)
- end, 1000, 1)
- end
- else
- local dawg = dog:SpawnCreature(SM.dogid,dog:GetX(),dog:GetY(),dog:GetZ(),dog:GetO(),14,0, 0,0,0,1,0)
- if diff~=4 then
- dawg:SetMovementFlags(1)
- dawg:DisableCombat(true)
- dawg:DisableTargeting(true)
- dawg:DisableMelee(true)
- LCF:RegisterLuaEvent(tostring(dawg), function()
- dawg:MoveTo(189.702,-103.948,18.677,3.1289)
- end, 1000, 1)
- dawg:Despawn(6000,0)
- else
- LCF:RegisterLuaEvent(tostring(dawg), function()
- dawg:CastSpell(SM.HR.Spells.petenrage)
- end, 1000, 1)
- end
- end
- end
- end
- local RokyrTalk = {"Damn it!",12,
- "Maybe you've defeated me, but don't think it will get any easier...",12,
- "The scarlet monastery will be ready!",14,
- "The commanders... are... ready!",14}
- local timer = SM.NPCTalkSequence(Unit,RokyrTalk)
- LCF:RegisterLuaEvent(tostring(Unit), function()
- local iID = Unit:GetInstanceID()
- if not iID then error("This NPC is not in an instance!") end
- local dogs = IS.Spawned[iID][3]
- if dogs then
- for num,dog in pairs(dogs) do
- dog:Despawn(1000,0)
- end
- end
- end,timer,1,Unit)
- end
- RegisterUnitEvent(SM.houndmasterrokyrid, 2, SM.HR.OnLeave)
- RegisterUnitEvent(SM.houndmasterrokyrid, 4, SM.HR.OnDied)
- RegisterUnitEvent(SM.houndmasterrokyrid, 18, SM.HR.OnSpawn)
- ----------------------------------------------------------------------
- -- --
- -- --
- -----------------2nd Boss-----Scarlet Commander Marla-----------------
- SM.SCM = {decoys = {},
- firewall = {},
- flames = {},
- target = {},
- healthcheck = {},
- Spells = {
- -- Spells which the boss and his minions will use
- decoydestroy = 34602,
- firewave = 43113,
- fireballtrigger = 60958,
- fireball = 29473,
- fireballtarget = 43313,
- fireballexplosion = 52146,
- fireballdamage = 47721,
- whirlwind = 54797,
- lightfirechannel = 45576,
- lightfirepath = 42344,
- burningaura = 59216,
- invincible = 52075},
- Objects = {
- -- Gameobjects which are used while the boss
- wall = 180322,
- firewall = 186859}}
- function SM.SCM.OnSpawn(Unit)
- local iID = Unit:GetInstanceID()
- if not iID then error("This NPC is not in an instance!") end
- Unit:DisableCombat(true)
- Unit:DisableMelee(true)
- Unit:DisableTargeting(true)
- Unit:CastSpell(SM.SCM.Spells.invincible)
- SM.SCM.decoys[iID] = {}
- table.insert(SM.SCM.decoys[iID], Unit:SpawnCreature(SM.commandermarladecoyid,222,-101.97,18.5,1.53,14,0, 0,0,0,1,0))
- table.insert(SM.SCM.decoys[iID], Unit:SpawnCreature(SM.commandermarladecoyid,228,-101.97,18.5,1.53,14,0, 0,0,0,1,0))
- table.insert(SM.SCM.decoys[iID], Unit:SpawnCreature(SM.commandermarladecoyid,225,-104.97,18.5,1.53,14,0, 0,0,0,1,0))
- table.insert(SM.SCM.decoys[iID], Unit:SpawnCreature(SM.commandermarladecoyid,225,-98.97,18.5,1.53,14,0, 0,0,0,1,0))
- for num,dec in pairs(SM.SCM.decoys[iID]) do
- dec:DisableCombat(true)
- dec:DisableMelee(true)
- dec:DisableTargeting(true)
- dec:SetUInt32Value(59,256)
- dec:SetMovementFlags(1)
- end
- Unit:RegisterEvent(SM.SCM.AreaBossTrigger, 2000, 0)
- end
- function SM.SCM.AreaBossTrigger(Unit)
- local iID = Unit:GetInstanceID()
- if not iID then error("This NPC is not in an instance!") end
- local plrs = GetPlayersInInstance(44, iID)
- Unit:MoveTo(267.445-math.random(4), -98.08+math.random(4), 18.67938, 3.145)
- if plrs then
- local AreaCheck = false
- for num,plr in pairs(plrs) do
- if plr:GetX()>216 and plr:GetY()<-90 and plr:GetY()>-116 then
- AreaCheck = true
- end
- end
- if AreaCheck then
- Unit:RemoveEvents()
- Unit:ReturnToSpawnPoint()
- local plrsForBoss = {}
- for num,plr in pairs(plrs) do
- if plr:IsAlive() then
- if plr:GetX()>216 and plr:GetX()<233 and plr:GetY()<-68 and plr:GetY()>-116 then
- table.insert(plrsForBoss, plr)
- end
- else
- table.remove(plrs, num)
- end
- end
- for num,plr in pairs(plrsForBoss) do
- plr:MovePlayerTo(223.198+math.random(4),-98-math.random(4),18.578,0,4096)
- end
- for num,unt in pairs(SM.SCM.decoys[iID]) do
- unt:MoveTo(261.398+math.random(2), -99-math.random(2), 18.678, 0)
- end
- Unit:RegisterEvent(function()
- for num,plr in pairs(plrsForBoss) do
- plr:MovePlayerTo(247.52+math.random(4),-98-math.random(4),18.578,0,4096)
- end
- end, 2000, 1)
- local MarlaTalk = {"What!? Intruders!? In my chamber!?", 14,
- "I will crush them with my mace!", 14,
- "You traitorous pack can die now.", 12}
- local timer = SM.NPCTalkSequence(Unit,MarlaTalk)
- SM.SCM.firewall[iID] = {}
- Unit:RegisterEvent(function()
- table.insert(SM.SCM.firewall[iID], Unit:SpawnGameObject(SM.SCM.Objects.firewall, 232.89,-100.1,18.678,3.149,0,_, 1,0))
- table.insert(SM.SCM.firewall[iID], Unit:SpawnGameObject(SM.SCM.Objects.firewall, 286.56,-99.95,31.495,0,0,_, 1,0))
- for i=1, 2, 1 do
- SM.SCM.firewall[iID][i]:SetUnclickable()
- end
- Unit:CastSpell(SM.SCM.Spells.decoydestroy)
- Unit:RegisterEvent(function()
- Unit:DisableCombat(false)
- Unit:DisableTargeting(false)
- Unit:DisableMelee(false)
- Unit:RemoveAura(SM.SCM.Spells.invincible)
- Unit:RegisterEvent(SM.SCM.EventChoosing, 5000, 1)
- end, 2500, 1)
- end, timer-2000, 1)
- end
- end
- end
- function SM.SCM.DecoyDestroyOpeningEvent(index, Spell)
- local Unit = Spell:GetCaster()
- if Unit:IsPlayer() then return; end
- if Unit:GetEntry()~=SM.scarletcommandermarlaid then return; end
- local iID = Unit:GetInstanceID()
- if not iID then error("This NPC is not in an instance!") end
- local diff = IS.Spawned[iID].diff
- for num,unt in pairs(SM.SCM.decoys[iID]) do
- Unit:Kill(unt)
- if diff==4 then
- unt:SpawnCreature(SM.commandermarlaburnedid, Unit:GetX(), Unit:GetY(), Unit:GetZ(), Unit:GetO(),14,0, 0,0,0,1,0)
- end
- unt:Despawn(0,0)
- end
- if diff~=1 then
- Unit:SpawnCreature(SM.commadermarlafirewaveid, Unit:GetX(), Unit:GetY(), Unit:GetZ(), Unit:GetO(),35,0, 0,0,0,1,0)
- end
- end
- function SM.SCM.BurnedOnSpawn(Unit)
- Unit:CastSpell(SM.SCM.Spells.burningaura)
- end
- RegisterUnitEvent(SM.commandermarlaburnedid, 18, SM.SCM.BurnedOnSpawn)
- function SM.SCM.FireWaveOnSpawn(Unit)
- local iID = Unit:GetInstanceID()
- if not iID then error("This NPC is not in an instance!") end
- local plrs = GetPlayersInInstance(44, iID)
- Unit:SetUInt32Value(59, 33554432)
- Unit:RegisterEvent(function()
- Unit:CastSpell(SM.SCM.Spells.firewave)
- end, 200, 1)
- Unit:RegisterEvent(function()
- Unit:MoveTo(223.82,-100.1,18.01,0)
- Unit:RegisterEvent(function()
- if not plrs then return; end
- for num,plr in pairs(plrs) do
- if plr:GetX()>Unit:GetX() and plr:GetX()<255 and plr:GetY()>-96 and plr:GetY()<-104 then
- if diff==2 and plr:GetHealthPct()>30 then
- plr:SetHealthPct(plr:GetHealthPct()/2)
- else
- Unit:Kill(plr)
- end
- end
- end
- end, 200, 10)
- Unit:Despawn(2100,0)
- end, 1000, 1)
- end
- RegisterUnitEvent(SM.commadermarlafirewaveid, 18, SM.SCM.FireWaveOnSpawn)
- RegisterDummySpell(SM.SCM.Spells.decoydestroy, SM.SCM.DecoyDestroyOpeningEvent)
- function SM.SCM.OnLeave(Unit)
- local iID = Unit:GetInstanceID()
- if not iID then error("This NPC is not in an instance!") end
- SM.SCM.healthcheck[iID] = nil
- Unit:RemoveAura(SM.SCM.Spells.burningaura)
- Unit:ModifyRunSpeed(6)
- Unit:RemoveEvents()
- for num, wall in pairs(SM.SCM.firewall[iID]) do
- wall:Despawn(0,0)
- end
- SM.SCM.OnSpawn(Unit)
- end
- function SM.SCM.EventChoosing(Unit)
- local iID = Unit:GetInstanceID()
- if not iID then error("This NPC is not in an instance!") end
- local diff = IS.Spawned[iID].diff
- if Unit:GetHealthPct()<50 and not SM.SCM.healthcheck[iID] then
- Unit:DisableMelee(true)
- SM.SCM.healthcheck[iID] = true
- Unit:CastSpell(SM.SCM.Spells.burningaura)
- local MarlaTalk = {"Argh! It burns!", 14,
- "Make it stop!", 14}
- local timer = SM.NPCTalkSequence(Unit,MarlaTalk)
- Unit:RegisterEvent(function() Unit:SetScale(1.5) end, 2000, 1)
- Unit:RegisterEvent(function()
- Unit:DisableMelee(false)
- Unit:ModifyRunSpeed(5)
- Unit:RegisterEvent(SM.SCM.EventChoosing, 5000, 1)
- end, timer, 1)
- Unit:RegisterEvent(SM.SCM.HealthCheckEnding, 2000, 0)
- return;
- end
- local rnd = 1
- if not (diff~=2 and diff~=4) then
- rnd = math.random(100)
- end
- if rnd<95 then
- rnd = 1
- if SM.SCM.healthcheck[iID] then
- rnd = math.random(2)
- end
- local plrs = Unit:GetInRangePlayers()
- for num,plr in pairs(plrs) do if plr:IsDead() then table.remove(plrs, num) end end
- if not plrs then Unit:RemoveEvents() Unit:Despawn(0,10000) end
- local rPlr = math.random(table.getn(plrs))
- if rnd==1 then
- SM.SCM.target[iID] = plrs[rPlr]:SpawnCreature(SM.commandermarlafireballid, plrs[rPlr]:GetX(), plrs[rPlr]:GetY(), plrs[rPlr]:GetZ(), plrs[rPlr]:GetO(),35,0, 0,0,0,1,0)
- Unit:DisableMelee(true)
- Unit:FullCastSpell(SM.SCM.Spells.fireballtrigger)
- else
- Unit:MoveJump(plrs[rPlr]:GetX(), plrs[rPlr]:GetY()+1, plrs[rPlr]:GetZ())
- Unit:RegisterEvent(function()
- Unit:DisableMelee(true)
- Unit:CastSpell(SM.SCM.Spells.whirlwind)
- Unit:RegisterEvent(function()
- Unit:DisableMelee(false)
- end, 2000, 1)
- Unit:RegisterEvent(SM.SCM.EventChoosing, 5000, 1)
- end, ((Unit:GetDistance(plrs[rPlr])*3.2-(Unit:GetDistance(plrs[rPlr])-210))+1000), 1)
- end
- else
- SM.SCM.flames[iID] = {}
- Unit:MoveJump(255.135,-100.03,18.678)
- Unit:DisableMelee(true)
- local rnd = math.random(3)
- if rnd==1 then
- Unit:MonsterYell("Now feel the heat of the light that burns in me!")
- elseif rnd==2 then
- Unit:MonsterYell("Feel the burning light!")
- else
- Unit:MonsterYell("Fire burn my foes!")
- end
- Unit:RegisterEvent(function()
- local plrs = Unit:GetInRangePlayers()
- for num,plr in pairs(plrs) do if plr:IsDead() then table.remove(plrs, num) end end
- if not plrs then Unit:RemoveEvents() Unit:Despawn(0,10000) end
- for num,plr in pairs(plrs) do
- plr:MoveKnockback(Unit:GetX(), Unit:GetY(), Unit:GetZ(), 1, 3)
- end
- Unit:RegisterEvent(function()
- Unit:CastSpell(SM.SCM.Spells.lightfirechannel)
- local tick = 1
- Unit:RegisterEvent(function()
- for num,plr in pairs(plrs) do
- if plr:GetZ()<21 and plr:GetDistanceYards(Unit)<tick then
- Unit:Kill(plr)
- end
- end
- if tick==1 then
- table.insert(SM.SCM.flames[iID], Unit:SpawnCreature(SM.commandermarladummyid, Unit:GetX(), Unit:GetY(), Unit:GetZ(), Unit:GetO(),35,0, 0,0,0,1,0))
- SM.SCM.flames[iID][1]:SetUInt32Value(59, 33554432)
- elseif tick<15 then
- SM.SCM.flames[iID][1]:SetScale(tick*0.1667)
- end
- if tick==15 then
- SM.SCM.flames[iID][1]:SetScale(tick)
- tick = 1
- Unit:EnableMoveFly()
- table.insert(SM.SCM.flames[iID], Unit:SpawnCreature(SM.commandermarladummyid, Unit:GetX()+15, Unit:GetY(), Unit:GetZ(), 0, 35, 0, 0,0,0,1,0))
- table.insert(SM.SCM.flames[iID], Unit:SpawnCreature(SM.commandermarladummyid, Unit:GetX()-15, Unit:GetY(), Unit:GetZ(), 0, 35, 0, 0,0,0,1,0))
- table.insert(SM.SCM.flames[iID], Unit:SpawnCreature(SM.commandermarladummyid, Unit:GetX(), Unit:GetY()+15, Unit:GetZ(), 0, 35, 0, 0,0,0,1,0))
- table.insert(SM.SCM.flames[iID], Unit:SpawnCreature(SM.commandermarladummyid, Unit:GetX(), Unit:GetY()-15, Unit:GetZ(), 0, 35, 0, 0,0,0,1,0))
- for i=2, 5, 1 do
- SM.SCM.flames[iID][i]:SetUInt32Value(59, 33554432)
- end
- Unit:RegisterEvent(function()
- for num,plr in pairs(plrs) do
- if plr:GetZ()<(21+tick) then
- Unit:Kill(plr)
- end
- end
- if tick<6 then
- for i=6, 9, 1 do
- SM.SCM.flames[iID][i]:SetScale(tick/2)
- end
- elseif tick==7 and diff==4 and Unit:GetHealthPct()<50 then
- local rPlr = math.random(table.getn(plrs))
- SM.SCM.target[iID] = plrs[rPlr]:SpawnCreature(SM.commandermarlafireballid, plrs[rPlr]:GetX(), plrs[rPlr]:GetY(), plrs[rPlr]:GetZ(), plrs[rPlr]:GetO(),35,0, 0,0,0,1,0)
- Unit:FullCastSpell(SM.SCM.Spells.fireballtrigger)
- end
- Unit:MoveKnockback(Unit:GetX(), Unit:GetY(), Unit:GetZ()+1, 1, 1)
- if tick==7 then
- Unit:RemoveAura(SM.SCM.Spells.lightfirechannel)
- Unit:DisableMelee(false)
- Unit:Land()
- Unit:MoveKnockback(Unit:GetX(), Unit:GetY(), Unit:GetZ()-6, 1, 1)
- for num,unt in pairs(SM.SCM.flames[iID]) do
- unt:Despawn(0,0)
- end
- SM.SCM.flames[iID] = nil
- Unit:RegisterEvent(SM.SCM.EventChoosing, 5000, 1)
- end
- tick = tick + 1
- end, 1000, 7)
- end
- tick = tick + 1
- end, 200, 15)
- end, 3000, 1)
- end, (Unit:CalcToDistance(255.135,-100.03,18.678)*100), 1)
- end
- end
- function SM.SCM.FireballSpellTrigger(index, Spell)
- local Unit = Spell:GetCaster()
- if Unit:IsPlayer() then return; end
- if Unit:GetEntry()~=SM.scarletcommandermarlaid then return; end
- local iID = Unit:GetInstanceID()
- if not iID then error("This NPC is not in an instance!") end
- local diff = IS.Spawned[iID].diff
- local target = SM.SCM.target[iID]
- if not target then return; end
- local plrs = target:GetInRangePlayers()
- for num,plr in pairs(plrs) do if plr:IsDead() then table.remove(plrs, num) end end
- if not plrs then target:Despawn(0,0) end
- Unit:CastSpellOnTarget(SM.SCM.Spells.fireball, target)
- Unit:RegisterEvent(function()
- if target then
- target:RemoveAura(SM.SCM.Spells.fireballtarget)
- target:CastSpell(SM.SCM.Spells.fireballexplosion)
- for num,plr in pairs(plrs) do
- if plr:GetDistanceYards(target)<=3 then
- Unit:Kill(plr)
- end
- end
- target:RegisterEvent(function() target:Despawn(0,0) SM.SCM.target[iID] = nil; end, 3000, 1)
- end
- Unit:RegisterEvent(SM.SCM.EventChoosing, 5000, 1)
- end, (Unit:GetDistance(target)*1.5), 1)
- Unit:DisableMelee(false)
- end
- RegisterDummySpell(SM.SCM.Spells.fireballtrigger, SM.SCM.FireballSpellTrigger)
- RegisterUnitEvent(SM.commandermarladummyid, 18, function(Unit) Unit:CastSpell(SM.SCM.Spells.lightfirepath) end)
- RegisterUnitEvent(SM.commandermarlafireballid, 18, function(Unit) Unit:CastSpell(SM.SCM.Spells.fireballtarget) Unit:SetUInt32Value(59, 33554432) end)
- function SM.SCM.HealthCheckEnding(Unit)
- local iID = Unit:GetInstanceID()
- if not iID then error("This NPC is not in an instance!") end
- if Unit:GetHealthPct()<=5 then
- Unit:RemoveEvents()
- Unit:CancelSpell()
- Unit:CastSpell(SM.SCM.Spells.invincible)
- Unit:Emote(68, 15000)
- if SM.SCM.target[iID] then
- SM.SCM.target[iID]:Despawn(0,0)
- end
- Unit:DisableMelee(true)
- local MarlaTalk = {"It hurts so much!", 14,
- "I can't take it anymore!", 14}
- local timer = SM.NPCTalkSequence(Unit,MarlaTalk)
- Unit:RegisterEvent(function() Unit:Emote(391,1000) end, timer-1000, 1)
- Unit:RegisterEvent(function()
- local plrs = Unit:GetInRangePlayers()
- if not plrs then Unit:Despawn(0,0) end
- plrs[1]:Kill(Unit)
- for num,wall in pairs(SM.SCM.firewall[iID]) do
- wall:Despawn(0,0)
- end
- SM.SCM.firewall[iID] = nil
- if SM.SCM.flames[iID] then
- for num,flame in pairs(SM.SCM.flames[iID]) do
- flame:Despawn(0,0)
- end
- SM.SCM.flames[iID] = nil
- end
- SM.SCM.healthcheck[iID] = nil
- end, timer, 1)
- else
- Unit:SetHealthPct(Unit:GetHealthPct()-1)
- end
- end
- function SM.SCM.BurnedKnightOnSpawn(Unit)
- Unit:CastSpell(SM.SCM.Spells.burningaura)
- Unit:SetHealthPct(75)
- end
- RegisterUnitEvent(SM.commandermarlaburnedid, 18, SM.SCM.BurnedKnightOnSpawn)
- function SM.SCM.OnDied(Unit)
- Unit:RemoveEvents()
- Unit:RegisterEvent(function()
- local herod = Unit:SpawnCreature(SM.herod, X###, Y###, Z###, O###, 14, 0, 0,0,0,1,0)
- end, 10000, 1)
- end
- RegisterUnitEvent(SM.scarletcommandermarlaid, 2, SM.SCM.OnLeave)
- RegisterUnitEvent(SM.scarletcommandermarlaid, 4, SM.SCM.OnDied)
- RegisterUnitEvent(SM.scarletcommandermarlaid, 18, SM.SCM.OnSpawn)
- ----------------------------------------------------------------------
- -- --
- -- --
- --------------------------3rd Boss-----Herod--------------------------
- SM.SCM = {firewall = {},
- Spells = {
- -- Spells which the boss and his minions will use
- invincible = 52075},
- Objects = {
- -- Gameobjects which are used while the boss
- }}
- function SM.H.OnSpawn(Unit)
- Unit:DisableCombat(true)
- Unit:DisableMelee(true)
- Unit:DisableTargeting(true)
- Unit:CastSpell(SM.H.Spells.invincible)
- Unit:SetMovementFlags(1)
- Unit:RegisterEvent(SM.H.AreaBossTrigger, 2000, 0)
- end
- function SM.H.AreaBossTrigger(Unit)
- local iID = Unit:GetInstanceID()
- if not iID then error("This NPC is not in an instance!") end
- local plrs = GetPlayersInInstance(44, iID)
- if plrs then
- local AreaCheck = false
- for num,plr in pairs(plrs) do
- if plr:GetX()>X### and plr:GetX()<X### and plr:GetY()<-Y### and plr:GetY()>-Y### then
- AreaCheck = true
- break;
- end
- end
- if AreaCheck then
- Unit:RemoveEvents()
- local HerodTalk = {"What's the meaning of this noise?",12,
- "Marla!",14,
- "You will pay for what you've done to my Marla!",14,
- "Burn in righteous fire!", 14}
- local timer = SM.NPCTalkSequence(Unit,HerodTalk)
- Unit:Emote(27,timer)
- Unit:RegisterEvent(SM.H.OpeningScene, timer, 1)
- end
- end
- end
- function SM.H.OpeningScene(Unit)
- end
- function SM.H.OnLeave(Unit)
- end
- RegisterUnitEvent(SM.herod, 2, SM.H.OnLeave)
- RegisterUnitEvent(SM.herod, 4, function(Unit) Unit:RemoveEvents() end)
- RegisterUnitEvent(SM.herod, 18, SM.H.OnSpawn)
- ----------------------------------------------------------------------
- -- --
- -- --
- ----------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement