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
ToLua:return -min, -max
Lua:if player:getStorageValue(500) == 1 then return -min * 2, -max * 2 -- Define here boost damage else return -min, -max end
function onHealthChange(creature, attacker...
BUFF - Create spell like thisHello, 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?
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
return -min, -max
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
ToLua:return -min, -max
Lua:if player:getStorageValue(500) == 1 then return -min * 2, -max * 2 -- Define here boost damage else return -min, -max end
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
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()
player:setStorageValue(7373, 0)
Sure, but i dont like when script call other scriptIn 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
Spell call creaturescriptSorry but what you mean script call script?
Please mark as solution. Doesnt matter which of bothThank you to everyone who helped me. Both scripts works as i wanted
Is there a way to modify the script so that other players can benefit from the extra damage and to make it work on monsters?Please mark as solution. Doesnt matter which of both
Is there a way to modify the script so that other players can benefit from the extra damage and to make it work on monsters?
How would I implement it? I'm new to ot creationIt is possible yes
Okay thanks!