• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Script to "replace" source spell cooldown

Icaraii

Well-Known Member
Joined
Jan 5, 2020
Messages
469
Solutions
1
Reaction score
58
Hey guys, I would like a script that when you kill a monster with a specific weapon, you have a % of reducing spell cooldown by x seconds. But in order to do so, I would need a script to replace the source spell cooldown using table or storage value. However this is too complex for me to do, could somebody help?

TFS 1.3
 
Last edited:
Solution
Here I will show you an example of how it is done with pure lua, but you must bear in mind that it is not something clean and it is not a complete code, but I will give you an example to see if you dare to complete it or if someone wants to finish it for you

data/scripts/spellcooldownsystem.lua
Lua:
SpellCooldownSystem = {
    storages = {},
    cooldowns = {},
    reduction = 0.10 -- 10%
}

local spellCooldownEvent = CreatureEvent("SpellCooldownSystemLogin")
function spellCooldownEvent.onLogin(player)
    SpellCooldownSystem.storages[player:getId()] = {}
    player:registerEvent("SpellCooldownSystemReduction")
    return true
end
spellCooldownEvent:register()

local spellCooldownEvent =...
Back
Top