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

help with spell

Hidroponica

Member
Joined
Feb 16, 2016
Messages
75
Reaction score
8
this spell work 100% but dont work in tfs 1.2

Code:
local combat = Combat()

combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ETHEREALSPEAR)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1)

function onGetFormulaValues(player, attack, factor)
    local skillTotal = 2 * player:getEffectiveSkillLevel(SKILL_DISTANCE)
    local levelTotal = player:getLevel() / 5
    return -(((skillTotal + attack / 2500) * 0.5) + (levelTotal) + 7), -(((skillTotal + attack / 1875) * 0.75) + (levelTotal) + 13)
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
local function isWalkable(pos, creature, proj, pz)-- by Nord
    if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
    if getTopCreature(pos).uid > 0 and creature then return false end
    if getTileInfo(pos).protection and pz then return false, true end
    local n = not proj and 3 or 2
    for i = 0, 255 do
        pos.stackpos = i
        local tile = getTileThingByPos(pos)
        if tile.itemid ~= 0 and not isCreature(tile.uid) then
            if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
                return false
            end
        end
    end
    return true
end
local function push(id, dir, t)
    if t < 0 or not(isCreature(id)) then return true end
    local pos = getPositionByDirection(getThingPos(id), dir)
    if not(isWalkable(pos, true, false, true)) then
        return true
    end
    doTeleportThing(id, pos, true)
    addEvent(push, 0, id, dir, t-1)
end
local config = {
    ammu = {2543,2544,2545,2546,2547,6529,7363,7364,7365,7838,7839,7840,7850},
    pushBack = 2
}
function onCastSpell(cid, var)
    local removed = false
    for _, itemid in pairs(config.ammu) do
        if getPlayerItemCount(cid, itemid) >= 1 then
            doPlayerRemoveItem(cid, itemid, 1)
            removed = true
            end
            if getPlayerSlotItem(cid, 5).itemid == 7438 or getPlayerSlotItem(cid, 6).itemid == 7438 then
            removed = true
            break
      
        end
    end
    if not(removed) then return doPlayerSendCancel(cid, "You need ammunation for this spell.") and false end  
    local ret = doCombat(cid, combat, var)
    if ret then
        local dirTo = getDirectionTo(getThingPos(cid), getThingPos(variantToNumber(var)))
        push(variantToNumber(var), dirTo, config.pushBack)
    end
    return ret
end


Code:
Lua Script Error: [Spell Interface]
data/spells/scripts/attack/arrow repel.lua:onCastSpell
data/spells/scripts/attack/arrow repel.lua:64: attempt to call global 'getDirectionTo' (a nil value)
stack traceback:
        [C]: in function 'getDirectionTo'
        data/spells/scripts/attack/arrow repel.lua:64: in function <data/spells/scripts/attack/arrow repel.lua:48>
 
this spell work 100% but dont work in tfs 1.2

Code:
local combat = Combat()

combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ETHEREALSPEAR)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, 1)

function onGetFormulaValues(player, attack, factor)
    local skillTotal = 2 * player:getEffectiveSkillLevel(SKILL_DISTANCE)
    local levelTotal = player:getLevel() / 5
    return -(((skillTotal + attack / 2500) * 0.5) + (levelTotal) + 7), -(((skillTotal + attack / 1875) * 0.75) + (levelTotal) + 13)
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
local function isWalkable(pos, creature, proj, pz)-- by Nord
    if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
    if getTopCreature(pos).uid > 0 and creature then return false end
    if getTileInfo(pos).protection and pz then return false, true end
    local n = not proj and 3 or 2
    for i = 0, 255 do
        pos.stackpos = i
        local tile = getTileThingByPos(pos)
        if tile.itemid ~= 0 and not isCreature(tile.uid) then
            if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
                return false
            end
        end
    end
    return true
end
local function push(id, dir, t)
    if t < 0 or not(isCreature(id)) then return true end
    local pos = getPositionByDirection(getThingPos(id), dir)
    if not(isWalkable(pos, true, false, true)) then
        return true
    end
    doTeleportThing(id, pos, true)
    addEvent(push, 0, id, dir, t-1)
end
local config = {
    ammu = {2543,2544,2545,2546,2547,6529,7363,7364,7365,7838,7839,7840,7850},
    pushBack = 2
}
function onCastSpell(cid, var)
    local removed = false
    for _, itemid in pairs(config.ammu) do
        if getPlayerItemCount(cid, itemid) >= 1 then
            doPlayerRemoveItem(cid, itemid, 1)
            removed = true
            end
            if getPlayerSlotItem(cid, 5).itemid == 7438 or getPlayerSlotItem(cid, 6).itemid == 7438 then
            removed = true
            break
     
        end
    end
    if not(removed) then return doPlayerSendCancel(cid, "You need ammunation for this spell.") and false end 
    local ret = doCombat(cid, combat, var)
    if ret then
        local dirTo = getDirectionTo(getThingPos(cid), getThingPos(variantToNumber(var)))
        push(variantToNumber(var), dirTo, config.pushBack)
    end
    return ret
end


Code:
Lua Script Error: [Spell Interface]
data/spells/scripts/attack/arrow repel.lua:onCastSpell
data/spells/scripts/attack/arrow repel.lua:64: attempt to call global 'getDirectionTo' (a nil value)
stack traceback:
        [C]: in function 'getDirectionTo'
        data/spells/scripts/attack/arrow repel.lua:64: in function <data/spells/scripts/attack/arrow repel.lua:48>
because this spell isnt for tfs 1.2
 
how i do

Lua Script Error: [Spell Interface]
data/spells/scripts/attack/arrow repel.lua:eek:nCastSpell
data/spells/scripts/attack/arrow repel.lua:65: attempt to call global 'getDirectionTo' (a nil value)
stack traceback:
[C]: in function 'getDirectionTo'
data/spells/scripts/attack/arrow repel.lua:65: in function <data/spells/scripts/attack/arrow repel.lua:48>
 
I just love people with terrible english with 0 knowledge of lua that come here and expect people to do everything for them xD How the fk do they expect to have an OTS if they can't even understand the errors in goddamn console? lol
 
Back
Top