• 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 TFS 1.3 - Buff spell gives more damage from spells on x seconds.

BREWSKY

New Member
Joined
Mar 27, 2016
Messages
16
Reaction score
0
Hello, I wanted to create buff spell which gives more damage from spells, but i cant how to, in tfs 1.3 there is no condition to spell damage or something like that. Could someone help?
 
Solution
BUFF - Create spell like this
Lua:
local function BuffStop(playerId, seconds)
    local player = Player(playerId)
        player:setStorageValue(500, 0)
            end

function onCastSpell(player, variant)
        player:setStorageValue(500, 1)
            addEvent(BuffStop, 5000, player) -- 5000 = 5 second
                return combat:execute(player, variant)
                    end

Now in spells change
Lua:
    return -min, -max
To
Lua:
    if player:getStorageValue(500) == 1 then
    return -min * 2, -max * 2 -- Define here boost damage
    else
    return -min, -max
        end

In that case you have to edit every spell so just use onHealthChange

Creaturescript:
Lua:
function onHealthChange(creature, attacker...
easy way(incresse all damage):
use onhealthchange/onmanachange creaturescripts register on monster(use onSpawn) and player(use onlogin), get storage/some table value from attacker, if storage/value exist incresse primaryDamage and secondaryDamage.
issue: if player death during buff storage stay incressed(you must restart it onlogin)
hard way:
edit source code, create new condition, check it i good place src, incresse damage by value from condition
or
add player incressedamage variable, update it by lua, place incressedamage in good place in src
 
Hello, I wanted to create buff spell which gives more damage from spells, but i cant how to, in tfs 1.3 there is no condition to spell damage or something like that. Could someone help?
BUFF - Create spell like this
Lua:
local function BuffStop(playerId, seconds)
    local player = Player(playerId)
        player:setStorageValue(500, 0)
            end

function onCastSpell(player, variant)
        player:setStorageValue(500, 1)
            addEvent(BuffStop, 5000, player) -- 5000 = 5 second
                return combat:execute(player, variant)
                    end

Now in spells change
Lua:
    return -min, -max
To
Lua:
    if player:getStorageValue(500) == 1 then
    return -min * 2, -max * 2 -- Define here boost damage
    else
    return -min, -max
        end
 
BUFF - Create spell like this
Lua:
local function BuffStop(playerId, seconds)
    local player = Player(playerId)
        player:setStorageValue(500, 0)
            end

function onCastSpell(player, variant)
        player:setStorageValue(500, 1)
            addEvent(BuffStop, 5000, player) -- 5000 = 5 second
                return combat:execute(player, variant)
                    end

Now in spells change
Lua:
    return -min, -max
To
Lua:
    if player:getStorageValue(500) == 1 then
    return -min * 2, -max * 2 -- Define here boost damage
    else
    return -min, -max
        end

In that case you have to edit every spell so just use onHealthChange

Creaturescript:
Lua:
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if not creature or not attacker or not attacker:isPlayer() then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end
 
    if attacker:getStorageValue(7373) == 1 then
        primaryDamage = primaryDamage + (primaryDamage * 50 / 100) -- Means 50% more damage
        secondaryType = secondaryType + (secondaryType * 50 / 100)
    end
    return primaryDamage, primaryType, primaryDamage, secondaryType
end

Spell(RevScript):
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, 1)

local function castSpellTo(cid, variant)
    local player = Player(cid)
    if player then
        player:setStorageValue(7373, 0)
    end
end

local buff = Spell(SPELL_INSTANT)

function buff.onCastSpell(creature, variant)
    creature:setStorageValue(7373, 1)
    local cid = creature:getId()
        addEvent(castSpellTo, 5000, cid, variant) -- After 5 sec you dont have extra damage anymore
    return true
end

buff:name("exura buff")
buff:words("exura buff")
buff:group("support")
buff:vocation("Knight", "master sorecerer")
buff:id(1)
buff:cooldown(1000)
buff:level(200)
buff:manaPercent(1)
buff:register()

login.lua:
Lua:
player:setStorageValue(7373, 0)
 
Solution
In that case you have to edit every spell so just use onHealthChange

Creaturescript:
Lua:
function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if not creature or not attacker or not attacker:isPlayer() then
        return primaryDamage, primaryType, secondaryDamage, secondaryType
    end

    if attacker:getStorageValue(7373) == 1 then
        primaryDamage = primaryDamage + (primaryDamage * 50 / 100) -- Means 50% more damage
        secondaryType = secondaryType + (secondaryType * 50 / 100)
    end
    return primaryDamage, primaryType, primaryDamage, secondaryType
end

Spell(RevScript):
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, 1)

local function castSpellTo(cid, variant)
    local player = Player(cid)
    if player then
        player:setStorageValue(7373, 0)
    end
end

local buff = Spell(SPELL_INSTANT)

function buff.onCastSpell(creature, variant)
    creature:setStorageValue(7373, 1)
    local cid = creature:getId()
        addEvent(castSpellTo, 5000, cid, variant) -- After 5 sec you dont have extra damage anymore
    return true
end

buff:name("exura buff")
buff:words("exura buff")
buff:group("support")
buff:vocation("Knight", "master sorecerer")
buff:id(1)
buff:cooldown(1000)
buff:level(200)
buff:manaPercent(1)
buff:register()

login.lua:
Lua:
player:setStorageValue(7373, 0)
Sure, but i dont like when script call other script :)
 
Back
Top