• 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!

TFS 1.X+ HELP Sprite custom spell problem

gnadaja98

New Member
Joined
May 15, 2024
Messages
6
Reaction score
1
Hi, can someone help me? i add a custom spell "fan of knives" in my server, and i copy the sprite from throwing knife, but the problem is when i use the spell, the sprite still on map for ever. If when i walk it dont desapear, can someone help me?(PRINT)

Spell Code:
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, 177)
combat:setArea(createCombatArea(AREA_CIRCLE5X5))

function onGetFormulaValues(player, skill, attack, factor)
    local min = (player:getLevel() / 5) + (skill * attack * 0.03) + 7
    local max = (player:getLevel() / 5) + (skill * attack * 0.05) + 11
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function onCastSpell(creature, variant)
    return combat:execute(creature, variant)
end
 

Attachments

test
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, 177)
combat:setArea(createCombatArea(AREA_CIRCLE5X5))

function onGetFormulaValues(player, skill, attack, factor)
    local min = (player:getLevel() / 5) + (skill * attack * 0.03) + 7
    local max = (player:getLevel() / 5) + (skill * attack * 0.05) + 11
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function removeEffect(position)
    local tile = Tile(position)
    if tile then
        local item = tile:getTopVisibleThing()
        if item and item:getId() == 177 then
            item:remove()
        end
    end
end

function onCastSpell(creature, variant)
    local position = creature:getPosition()
    if combat:execute(creature, variant) then
        addEvent(removeEffect, 5000, position) -- Adjust the duration as needed
        return true
    end
    return false
end
 
Back
Top