View Full Version : Dynamically Scripted Spells

01-02-2015, 10:58 AM
https://github.com/NotHawthorne/Shard/blob/master/Server/lua_scripts/Player/dynamic_spell_system.lua <- Code

It may take some working with, but I had this working pretty well. Basically you could script spells to deal custom amounts of damage and have custom effects (defined in an SQL table) and the spell was made more powerful by your level in a particular skill that you defined as well. I'm not working on WoW code anymore, but someone might be able to find use for this. Here are the custom functions to add to playermethods.h if you want this to work --

int SendDamage(lua_State* L, Player* player)
Unit* target = Eluna::CHECKOBJ<Unit>(L, 2);
uint32 amount = Eluna::CHECKVAL<uint32>(L, 3);
uint32 spellid = Eluna::CHECKVAL<uint32>(L, 4);
uint32 school = Eluna::CHECKVAL<uint32>(L, 5);
bool durabilityloss = Eluna::CHECKVAL<bool>(L, 6, true);

SpellSchoolMask schoolmask = SpellSchoolMask(1 << school);

player->SpellNonMeleeDamageLog(target, spellid, amount);
player->DealDamage(target, amount, NULL, DIRECT_DAMAGE, schoolmask, NULL, durabilityloss);
return 0;

int SendCooldown(lua_State* L, Player* player)
uint32 spellId = Eluna::CHECKVAL<uint32>(L, 2);
uint32 cooldown = Eluna::CHECKVAL<uint32>(L, 3);

WorldPacket data(SMSG_SPELL_COOLDOWN, 8 + 1 + 1 * 8);
data << player->GetObjectGuid();
data << uint8(0x0);
data << uint32(spellId);
data << uint32(cooldown);
//player->RemoveSpellCooldown(spellId, true);
player->AddSpellCooldown(spellId, 0, time(NULL) + cooldown / IN_MILLISECONDS);
return 0;

02-02-2015, 01:13 PM
Love it!

10-23-2015, 12:36 AM
Anyone know how to fix the SpellCooldownMult issues? I know it is really outdated and it works like 80%