• 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 spell that checks for hole

SorketROrk

Well-Known Member
Joined
Oct 14, 2020
Messages
152
Solutions
1
Reaction score
69
Location
Sweden
Hi! :)

I would like to ask for a spell that should work something like this:

  • Player uses spell like "exori mas" > checks all tiles hit by the spell looking for hidden holes that require pick to open/actionid.
  • Gives a different type of spell effect on the tile that is found where players can use pick.

My idea here is for players to use a spell looking for hidden things, like in this example a tile where you can use a pick.

Is this possible to achieve?

Yours,
SRO
 
Solution
Try this
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1)
combat:setParameter(COMBAT_PARAM_USECHARGES, 1)
combat:setArea(createCombatArea(AREA_CIRCLE3X3))

function onTargetTile(cid, pos)
    local tile = Tile(pos)
    if tile then
        local ground = tile:getGround()
        if ground then
            if isInArray({354, 355}, ground:getId()) then
                pos:sendMagicEffect(CONST_ME_POFF)
            else
                pos:sendMagicEffect(CONST_ME_GROUNDSHAKER)
            end
        end
    end
    return true
end
combat:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile")

function onGetFormulaValues(player, skill, attack, factor)...
Try this
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1)
combat:setParameter(COMBAT_PARAM_USECHARGES, 1)
combat:setArea(createCombatArea(AREA_CIRCLE3X3))

function onTargetTile(cid, pos)
    local tile = Tile(pos)
    if tile then
        local ground = tile:getGround()
        if ground then
            if isInArray({354, 355}, ground:getId()) then
                pos:sendMagicEffect(CONST_ME_POFF)
            else
                pos:sendMagicEffect(CONST_ME_GROUNDSHAKER)
            end
        end
    end
    return true
end
combat:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile")

function onGetFormulaValues(player, skill, attack, factor)
    local level = player:getLevel()
    
    local min = (level / 5) + (skill + attack) * 0.5
    local max = (level / 5) + (skill + attack) * 1.1

    return -min * 1.28, -max * 1.28
end
combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function onCastSpell(creature, var)
    return combat:execute(creature, var)
end
 
Solution
Try this
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1)
combat:setParameter(COMBAT_PARAM_USECHARGES, 1)
combat:setArea(createCombatArea(AREA_CIRCLE3X3))

function onTargetTile(cid, pos)
    local tile = Tile(pos)
    if tile then
        local ground = tile:getGround()
        if ground then
            if isInArray({354, 355}, ground:getId()) then
                pos:sendMagicEffect(CONST_ME_POFF)
            else
                pos:sendMagicEffect(CONST_ME_GROUNDSHAKER)
            end
        end
    end
    return true
end
combat:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile")

function onGetFormulaValues(player, skill, attack, factor)
    local level = player:getLevel()
  
    local min = (level / 5) + (skill + attack) * 0.5
    local max = (level / 5) + (skill + attack) * 1.1

    return -min * 1.28, -max * 1.28
end
combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function onCastSpell(creature, var)
    return combat:execute(creature, var)
end
Thank you so much!
I'll test to see how it works when I get home 🙂😃
 
Back
Top