NoobxGenesis
Enthusiast
Introduction:
Basically, I have been on hiatus from modding for a while (almost 2 years) after getting rather burnt out on it. I have wanted to come back after a while but most stuff is too tedious to enjoy, until I heard about Eluna. While I can do C++ and multiple other languages, Lua is just simple and relaxing to me. On top of that, rather than just picking up where I left off, I would start from scratch and relearn a lot of stuff I have forgotten. That said I thought I would start with a boss script, loosely based off the League of Legends character Kayle. Took about 8 hours and is still a work in progress, as it was my first attempt at Eluna and I am not familiar with the API yet.
Keep in mind this is a WiP (Work in Progress)
To Do:
- Optimize and clean the script.
- Add mob spawns stage.
- Change certain spell functions to utilize loops rather than singular calls.
- Add death sequence
- Upload video example
- LEARN MORE!
Script:
I tried to keep it modular and clean for others to modify and use if they so choose, but again most of it is written for me to simply relearn things I forgot as well as learn the Eluna API. It isn't fully optimized yet, so if you have suggestions feel free to post them.
As mentioned I don't want to get back into spell modding for a while, so I just went with player spells, meaning the boss is not balanced at all, it is merely a script.
Basically, I have been on hiatus from modding for a while (almost 2 years) after getting rather burnt out on it. I have wanted to come back after a while but most stuff is too tedious to enjoy, until I heard about Eluna. While I can do C++ and multiple other languages, Lua is just simple and relaxing to me. On top of that, rather than just picking up where I left off, I would start from scratch and relearn a lot of stuff I have forgotten. That said I thought I would start with a boss script, loosely based off the League of Legends character Kayle. Took about 8 hours and is still a work in progress, as it was my first attempt at Eluna and I am not familiar with the API yet.
Keep in mind this is a WiP (Work in Progress)
To Do:
- Optimize and clean the script.
- Add mob spawns stage.
- Change certain spell functions to utilize loops rather than singular calls.
- Add death sequence
- Upload video example
- LEARN MORE!
Script:
I tried to keep it modular and clean for others to modify and use if they so choose, but again most of it is written for me to simply relearn things I forgot as well as learn the Eluna API. It isn't fully optimized yet, so if you have suggestions feel free to post them.
As mentioned I don't want to get back into spell modding for a while, so I just went with player spells, meaning the boss is not balanced at all, it is merely a script.
Code:
--------------------------
-- --
-- Overview --
-- --
--------------------------
-- Author: NoobxGenesis/XxXGenesisXxX
-- YouTube: youtube.com/NoobxGenesis
--------------------------
-- --
-- Locals --
-- --
--------------------------
-----------
-- Stage --
-----------
stage = 0
-- These are the percentages of health required to progress to the numbered stage.
stage2 = 95 -- Stage 1 --> Stage 2
stage3 = 90 -- Stage 2 --> Stage 3
stage4 = 85 -- Stage 3 --> Stage 4
stage5 = 80 -- Stage 4 --> Stage 5
-----------
-- State --
-----------
cast_state = 0 -- Required to prevent cast interruptions.
cast_state_time = 0 -- To allow dynamic use of cast states, the spell functions themselves can adjust this number as required by the spells cast time.
------------
-- Spoken --
------------
yell_test = "TESTING" -- Simply to do checks during development.
yell_burn = "May you burn in the fires of the righteous!"
yell_spiritform = "Only the truly righteous shall be spared my wrath!"
yell_holyexplosion = "I will cleanse the world if I have to!"
------------
-- Spells --
------------
spell_divineshield = 642 -- Divine Shield
-- Stage 1 --
spell_smite = 48123 -- Smite Rank 12
spell_powershield = 48066 -- Power Word: Shield Rank 14
spell_consecration = 48819 -- Consecration Rank 8 (AoE)
-- Stage 2 --
spell_holyshock = 48825 -- Holy Shock Rank 7
spell_flashheal = 48071 -- Flash Heal Rank 11
--spell_greaterheal = 48063 -- Greater Heal Rank 9
-- Stage 3 --
spell_sanctuary = 20911 -- Blessing of Sanctuary (Buff)
--spell_holyfire = 48135 -- Holy Fire Rank 11
spell_massdispel = 32375 -- Mass Dispel (AoE)
spell_renew = 48068 -- Renew Rank 14
spell_holynova = 48078 -- Holy Nova Rank 9 (AoE)
-- Stage 4 --
spell_manaburn = 8129 -- Mana Burn
spell_psychicscream = 10890 -- Psychic Scream Rank 4 (AoE)
spell_holylight = 48782 -- Holy Light Rank 13
-- Stage 5 --
spell_desperateprayer = 48173 -- Desperate Prayer Rank 9
spell_holywrath = 48817 -- Holy Wrath Rank 5 (AoE)
----------------
-- Model ID's --
----------------
model_normalform = 28894
model_spiritform = 26077
-------------
-- Summons --
-------------
--------------------------
-- --
-- Functions --
-- --
--------------------------
----------------
-- Dependency --
----------------
-- Stage check and progression
function stage_check(event, delay, pCall, creature)
if stage == 1 then
if (creature:HealthBelowPct(stage2)) then
stage = 2
creature:RegisterEvent(Kayle_S2, 1, 1)
end
end
if stage == 2 then
if (creature:HealthBelowPct(stage3)) then
creature:RegisterEvent(Kayle_Transform, 1, 1)
end
end
if stage == 3 then
if (creature:HealthBelowPct(stage4)) then
stage = 4
creature:RegisterEvent(Kayle_S4, 1, 1)
end
end
if stage == 4 then
if (creature:HealthBelowPct(stage5)) then
stage = 5
creature:RegisterEvent(Kayle_S5, 1, 1)
end
end
end
-- These are to prevent cast interruptions
function add_cast_state(event, delay, pCall, creature)
cast_state = 1
CreateLuaEvent(remove_cast_state, cast_state_time, 1)
end
function remove_cast_state(event, delay, pCall, creature)
cast_state = 0
end
-------------------
-- Spell Chances --
-------------------
function spell_chance(event, delay, pCall, creature)
chance = math.random(1,100)
-- creature:SendUnitSay(chance, 1) -- For testing only.
-- Stage 1 Chances --
if stage == 1 then
if chance <= 15 then -- Continues auto-attacking (15%)
elseif chance <= 45 then -- Casts Smite (30%)
creature:RegisterEvent(Kayle_Smite, 1, 1)
elseif chance <= 70 then -- Casts Powershield (25%)
creature:RegisterEvent(Kayle_Powershield, 1, 1)
elseif chance <= 100 then -- Casts Consecration (30%)
creature:RegisterEvent(Kayle_Consecration, 1, 1)
end
creature:RegisterEvent(Kayle_S1, 1, 1)
-- Stage 2 Chances --
elseif stage == 2 then
if chance <= 10 then -- Continues auto-attacking (10%)
elseif chance <= 25 then -- Casts Smite (15%)
creature:RegisterEvent(Kayle_Smite, 1, 1)
elseif chance <= 45 then -- Casts Powershield (20%)
creature:RegisterEvent(Kayle_Powershield, 1, 1)
elseif chance <= 65 then -- Casts Consecration (20%)
creature:RegisterEvent(Kayle_Consecration, 1, 1)
elseif chance <= 90 then -- Casts Holy Shock (25%)
creature:RegisterEvent(Kayle_HolyShock, 1, 1)
elseif chance <= 100 then -- Flash Heal (10%)
creature:RegisterEvent(Kayle_FlashHeal, 1, 1)
end
creature:RegisterEvent(Kayle_S2, 1, 1)
-- Stage 3 Chances --
elseif stage == 3 then
if chance <= 5 then -- Continues auto-attacking (5%)
elseif chance <= 15 then -- Casts Powershield/Holy Nova (10%)
creature:RegisterEvent(Kayle_Powershield, 1, 1)
elseif chance <= 35 then -- Casts Consecration (20%)
creature:RegisterEvent(Kayle_Consecration, 1, 1)
elseif chance <= 65 then -- Casts Holy Shock (30%)
creature:RegisterEvent(Kayle_HolyShock, 1, 1)
elseif chance <= 80 then -- Casts Flash Heal (15%)
creature:RegisterEvent(Kayle_FlashHeal, 1, 1)
elseif chance <= 90 then -- Casts Renew (10%)
creature:RegisterEvent(Kayle_Renew, 1, 1)
elseif chance <= 100 then -- Casts Mass Dispel (10%)
creature:RegisterEvent(Kayle_MassDispel, 1, 1)
end
creature:RegisterEvent(Kayle_S3, 1, 1)
-- Stage 4 Chances --
elseif stage == 4 then
if chance <= 5 then -- Continues auto-attacking (5%)
elseif chance <= 30 then -- Casts Powershield/Holy Nova (25%)
creature:RegisterEvent(Kayle_Powershield, 1, 1)
elseif chance <= 65 then -- Casts Holy Shock (35%)
creature:RegisterEvent(Kayle_HolyShock, 1, 1)
elseif chance <= 75 then -- Casts Mass Dispel (10%)
creature:RegisterEvent(Kayle_MassDispel, 1, 1)
elseif chance <= 85 then -- Casts Mana Burn (10%)
creature:RegisterEvent(Kayle_ManaBurn, 1, 1)
elseif chance <= 90 then -- Casts Psychic Scream (5%)
creature:RegisterEvent(Kayle_PsychicScream, 1, 1)
elseif chance <= 100 then -- Casts Holy Light (10%)
creature:RegisterEvent(Kayle_HolyLight, 1, 1)
end
creature:RegisterEvent(Kayle_S4, 1, 1)
-- Stage 5 Chances --
elseif stage == 5 then
if chance <= 35 then -- Casts Holy Shock (35%)
creature:RegisterEvent(Kayle_HolyShock, 1, 1)
elseif chance <= 45 then -- Casts Mass Dispel (10%)
creature:RegisterEvent(Kayle_MassDispel, 1, 1)
elseif chance <= 55 then -- Casts Mana Burn (10%)
creature:RegisterEvent(Kayle_ManaBurn, 1, 1)
elseif chance <= 60 then -- Casts Psychic Scream (5%)
creature:RegisterEvent(Kayle_PsychicScream, 1, 1)
elseif chance <= 70 then -- Casts Desperate Prayer (10%)
creature:RegisterEvent(Kayle_DesperatePrayer, 1, 1)
elseif chance <= 90 then -- Casts Holy Nova (20%)
creature:RegisterEvent(Kayle_HolyNova, 1, 1)
elseif chance <= 100 then -- Casts Holy Explosion (10%)
creature:RegisterEvent(Kayle_HolyExplosion, 1, 1)
end
creature:RegisterEvent(Kayle_S5, 1, 1)
end
end
-------------
-- Initial --
-------------
function Kayle_Spawn(event, creature)
end
function Kayle_OnDeath(event, creature, killer)
creature:SetDisplayId(model_normalform)
stage = 0
end
function Kayle_LeaveCombat(event, creature)
creature:SetDisplayId(model_normalform)
stage = 0
end
function Kayle_EnterCombat(event, creature, target)
creature:SendUnitYell(yell_burn, 0)
creature:RegisterEvent(Kayle_S1, 1, 0)
creature:RegisterEvent(stage_check, 1000, 0)
stage = 1
end
-------------
-- Stage 1 --
-------------
function Kayle_S1(event, delay, pCall, creature)
creature:RemoveEventById(event) -- Not sure if needed
if stage == 1 then
creature:RegisterEvent(spell_chance, 3000, 1)
end
end
-- Spells --
function Kayle_Smite(event, delay, pCall, creature)
if cast_state == 0 then
CreateLuaEvent(add_cast_state, 1, 1)
cast_state_time = 2500
creature:CastSpell(creature:GetVictim(), spell_smite)
end
end
function Kayle_Powershield(event, delay, pCall, creature)
if cast_state == 0 then
if stage == 1 then
creature:CastSpell(creature, spell_powershield)
elseif stage == 3 then
creature:CastSpell(creature, spell_powershield)
creature:CastSpell(creature, spell_holynova)
elseif stage == 4 then
creature:CastSpell(creature, spell_powershield)
creature:CastSpell(creature, spell_holynova)
end
end
end
function Kayle_Consecration(event, delay, pCall, creature)
if cast_state == 0 then
creature:CastSpell(creature:GetVictim(), spell_consecration)
end
end
-------------
-- Stage 2 --
-------------
function Kayle_S2(event, delay, pCall, creature)
creature:RemoveEventById(event) -- Not sure if needed
if stage == 2 then
creature:RegisterEvent(spell_chance, 2500, 1)
end
end
-- Spells --
function Kayle_HolyShock(event, delay, pCall, creature)
if cast_state == 0 then
if stage == 2 then
creature:CastSpell(creature:GetVictim(), spell_holyshock)
elseif stage == 4 then
target = creature:GetVictim()
creature:CastSpell(target, spell_holyshock)
creature:CastSpell(target, spell_holyshock)
creature:CastSpell(target, spell_holyshock)
elseif stage == 5 then
target = creature:GetVictim()
creature:CastSpell(target, spell_holyshock)
creature:CastSpell(target, spell_holyshock)
creature:CastSpell(target, spell_holyshock)
creature:CastSpell(target, spell_holyshock)
creature:CastSpell(target, spell_holyshock)
end
end
end
function Kayle_FlashHeal(event, delay, pCall, creature)
if cast_state == 0 then
CreateLuaEvent(add_cast_state, 1, 1)
cast_state_time = 1500
creature:CastSpell(creature, spell_flashheal)
end
end
function Kayle_Transform(event, delay, pCall, creature) -- Transformation between stage 1 & 2
-- Cast Spell to stop all players interacting.
creature:SendUnitYell(yell_spiritform, 0)
-- Short channelled spell to transform
CreateLuaEvent(add_cast_state, 1, 1)
cast_state_time = 0
creature:SetDisplayId(model_spiritform)
creature:RegisterEvent(Kayle_Sanctuary, 1, 1)
creature:RegisterEvent(Kayle_Consecration, 1, 1)
creature:RegisterEvent(Kayle_S3, 1, 1)
stage = 3
end
-------------
-- Stage 3 --
-------------
function Kayle_S3(event, delay, pCall, creature)
creature:RemoveEventById(event) -- Not sure if needed
if stage == 3 then
creature:RegisterEvent(spell_chance, 2500, 1)
end
-- creature:SendUnitYell("test2", 0)
end
function Kayle_Sanctuary(event, delay, pCall, creature)
creature:CastSpell(creature, spell_sanctuary)
end
-- Spells --
function Kayle_Renew(event, delay, pCall, creature)
if cast_state == 0 then
creature:CastSpell(creature, spell_renew)
end
end
function Kayle_MassDispel(event, delay, pCall, creature)
if cast_state == 0 then
CreateLuaEvent(add_cast_state, 1, 1)
cast_state_time = 1500
creature:CastSpell(creature:GetVictim(), spell_massdispel)
end
end
-------------
-- Stage 4 --
-------------
function Kayle_S4(event, delay, pCall, creature)
creature:RemoveEventById(event) -- Not sure if needed
if stage == 4 then
creature:RegisterEvent(spell_chance, 2500, 1)
end
--creature:SendUnitYell("test3", 0)
end
-- Spells --
function Kayle_ManaBurn(event, delay, pCall, creature)
if cast_state == 0 then
CreateLuaEvent(add_cast_state, 1, 1)
cast_state_time = 3000
creature:CastSpell(creature:GetVictim(), spell_manaburn)
end
end
function Kayle_PsychicScream(event, delay, pCall, creature)
if cast_state == 0 then
creature:CastSpell(creature, spell_psychicscream)
end
end
function Kayle_HolyLight(event, delay, pCall, creature)
if cast_state == 0 then
CreateLuaEvent(add_cast_state, 1, 1)
cast_state_time = 2500
creature:CastSpell(creature, spell_holylight)
end
end
-------------
-- Stage 5 --
-------------
function Kayle_S5(event, delay, pCall, creature)
creature:RemoveEventById(event) -- Not sure if needed
if stage == 5 then
creature:RegisterEvent(spell_chance, 2500, 1)
end
-- creature:SendUnitYell("test4", 0)
end
-- Spells --
function Kayle_DesperatePrayer(event, delay, pCall, creature)
if cast_state == 0 then
creature:CastSpell(creature, spell_desperateprayer)
end
end
function Kayle_HolyNova(event, delay, pCall, creature) -- Need new spell
if cast_state == 0 then
creature:CastSpell(creature:GetVictim(), spell_holynova)
creature:CastSpell(creature:GetVictim(), spell_consecration)
end
end
function Kayle_HolyExplosion(event, delay, pCall, creature) --need new spell
if cast_state == 0 then
creature:SendUnitYell(yell_holyexplosion, 0)
creature:CastSpell(creature:GetVictim(), spell_holywrath)
creature:CastSpell(creature:GetVictim(), spell_holywrath)
creature:CastSpell(creature:GetVictim(), spell_holywrath)
creature:CastSpell(creature:GetVictim(), spell_holywrath)
creature:CastSpell(creature:GetVictim(), spell_holywrath)
end
end
---------------------
-- Register Events --
---------------------
RegisterCreatureEvent(100000, 5, Kayle_Spawn)
RegisterCreatureEvent(100000, 4, Kayle_OnDeath)
RegisterCreatureEvent(100000, 2, Kayle_LeaveCombat)
RegisterCreatureEvent(100000, 1, Kayle_EnterCombat)