• 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 0.X Pull/Push only one time

warriorfrog

Active Member
Joined
Jul 29, 2015
Messages
334
Reaction score
35
I found this two spells that push and pull (here on forum):
But they don't work like i want, and idk how to change

pull.lua
Code:
local function doPullCreature(target, cid)
   if target > 0 then
    if not isNpc(target) then
        local position = getThingPosition(cid)
        local fromPosition = getThingPosition(target)
        local x = ((fromPosition.x - position.x) < 0 and 1 or ((fromPosition.x - position.x) == 0 and 0 or -1))
        local y = ((fromPosition.y - position.y) < 0 and 1 or ((fromPosition.y - position.y) == 0 and 0 or -1))
        local toPosition = {x = fromPosition.x + x, y = fromPosition.y + y, z = fromPosition.z}
        if doTileQueryAdd(target, toPosition) == 1 and getTileInfo(toPosition).house == false then
            doTeleportThing(target, toPosition, true)
        end
    end
   end
end
local spell = {}
spell.config = {
   [3] = {
    damageType = 1,
    areaEffect = 2,
    area = {
        {0, 0, 1, 1, 1, 0, 0},
        {0, 1, 1, 1, 1, 1, 0},
        {1, 1, 1, 1, 1, 1, 1},
        {1, 1, 1, 3, 1, 1, 1},
        {1, 1, 1, 1, 1, 1, 1},
        {0, 1, 1, 1, 1, 1, 0},
        {0, 0, 1, 1, 1, 0, 0}
    }       
   },
   [2] = {
    damageType = 1,
    areaEffect = 2,
    area = {
        {0, 0, 0, 0, 0, 0, 0},
        {0, 0, 1, 1, 1, 0, 0},
        {0, 1, 1, 1, 1, 1, 0},
        {0, 1, 1, 3, 1, 1, 0},
        {0, 1, 1, 1, 1, 1, 0},
        {0, 0, 1, 1, 1, 0, 0},
        {0, 0, 0, 0, 0, 0, 0}
    }       
   },
   [1] = {
    damageType = 1,
    areaEffect = 2,
    area = {
        {0, 0, 0, 0, 0, 0, 0},
        {0, 0, 0, 0, 0, 0, 0},
        {0, 0, 1, 1, 1, 0, 0},
        {0, 0, 1, 3, 1, 0, 0},
        {0, 0, 1, 1, 1, 0, 0},
        {0, 0, 0, 0, 0, 0, 0},
        {0, 0, 0, 0, 0, 0, 0}
    }       
   }
}

spell.combats = {}
for _, config in ipairs(spell.config) do
   local combat = createCombatObject()
   setCombatParam(combat, COMBAT_PARAM_TYPE, config.damageType)
   setCombatParam(combat, COMBAT_PARAM_EFFECT, config.areaEffect)
   function onTargetCreature(cid, target)
    doPullCreature(target, cid)
   end
   setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")
   setCombatArea(combat, createCombatArea(config.area))
   table.insert(spell.combats, combat)
end
function onCastSpell(cid, var)
   for n = 1, #spell.combats do
    addEvent(doCombat, (n * 150) - 150, cid, spell.combats[n], var)
   end
   return true
end

push.lua
Code:
local function doPushCreature(target, cid)
   if target > 0 then
    if not isNpc(target) then
        local position = getThingPosition(cid)
        local fromPosition = getThingPosition(target)
        local x = ((fromPosition.x - position.x) < 0 and -1 or ((fromPosition.x - position.x) == 0 and 0 or 1))
        local y = ((fromPosition.y - position.y) < 0 and -1 or ((fromPosition.y - position.y) == 0 and 0 or 1))
        local toPosition = {x = fromPosition.x + x, y = fromPosition.y + y, z = fromPosition.z}
        if doTileQueryAdd(target, toPosition) == 1 and getTileInfo(toPosition).house == false then
            doTeleportThing(target, toPosition, true)
        end
    end
   end
end
local spell = {}
spell.config = {
   [3] = {
    damageType = 1,
    areaEffect = 2,
    area = {
        {0, 0, 1, 1, 1, 0, 0},
        {0, 1, 1, 1, 1, 1, 0},
        {1, 1, 1, 1, 1, 1, 1},
        {1, 1, 1, 3, 1, 1, 1},
        {1, 1, 1, 1, 1, 1, 1},
        {0, 1, 1, 1, 1, 1, 0},
        {0, 0, 1, 1, 1, 0, 0}
    }       
   },
   [2] = {
    damageType = 1,
    areaEffect = 2,
    area = {
        {0, 0, 0, 0, 0, 0, 0},
        {0, 0, 1, 1, 1, 0, 0},
        {0, 1, 1, 1, 1, 1, 0},
        {0, 1, 1, 3, 1, 1, 0},
        {0, 1, 1, 1, 1, 1, 0},
        {0, 0, 1, 1, 1, 0, 0},
        {0, 0, 0, 0, 0, 0, 0}
    }       
   },
   [1] = {
    damageType = 1,
    areaEffect = 2,
    area = {
        {0, 0, 0, 0, 0, 0, 0},
        {0, 0, 0, 0, 0, 0, 0},
        {0, 0, 1, 1, 1, 0, 0},
        {0, 0, 1, 3, 1, 0, 0},
        {0, 0, 1, 1, 1, 0, 0},
        {0, 0, 0, 0, 0, 0, 0},
        {0, 0, 0, 0, 0, 0, 0}
    }       
   }
}

spell.combats = {}
for _, config in ipairs(spell.config) do
   local combat = createCombatObject()
   setCombatParam(combat, COMBAT_PARAM_TYPE, config.damageType)
   setCombatParam(combat, COMBAT_PARAM_EFFECT, config.areaEffect)
   function onTargetCreature(cid, target)
    doPushCreature(target, cid)
   end
   setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")
   setCombatArea(combat, createCombatArea(config.area))
   table.insert(spell.combats, combat)
end
function onCastSpell(cid, var)
   for n = 1, #spell.combats do
    addEvent(doCombat, (n * 150) - 150, cid, spell.combats[n], var)
   end
   return true
end


The problem is:
1- PUSH/PULL occurs more then one time...
if the creature is 1 sqm on right it push/pull 3 times, it should be only one

Where it happen?
How to change?
 
Solution
Add a nominal delay to the teleport portion, so that the creature isn't 'pushed' until after the spell is completed.

change
Lua:
doTeleportThing(target, toPosition, true)
to
Lua:
addEvent(doTeleportThing, 10, target, toPosition, true)

-- edit
Nevermind. Didn't realize the actual issue. The above advice won't solve this.

Based on your initial description, I thought the spell was just an area-triggered spell, that pushed/pulled.

What the problem actually is, is that the spell is basically triggering 3 times per cast, with a 250 ms delay, with over-lapping area's of coverage.

Because of that, the players (on ALL sides of the caster, not just to the right of the caster) are being push/pulled potentially multiple times...
Add a nominal delay to the teleport portion, so that the creature isn't 'pushed' until after the spell is completed.

change
Lua:
doTeleportThing(target, toPosition, true)
to
Lua:
addEvent(doTeleportThing, 10, target, toPosition, true)

-- edit
Nevermind. Didn't realize the actual issue. The above advice won't solve this.

Based on your initial description, I thought the spell was just an area-triggered spell, that pushed/pulled.

What the problem actually is, is that the spell is basically triggering 3 times per cast, with a 250 ms delay, with over-lapping area's of coverage.

Because of that, the players (on ALL sides of the caster, not just to the right of the caster) are being push/pulled potentially multiple times.

---
I'm going to think about how to possibly change that..
Initial thought is to create some sort of global table.. that will hold creature information..
Gonna take a bit of time to script in though.

--
Alright, here's my fix.
This fix assumes that the player cannot spam cast the spell. (aka, a god)

Pull
Lua:
local creaturePullInfo = {}

local function resetCreaturePullInfo(cid)
    creaturePullInfo[cid] = nil
end

local function doPullCreature(target, cid)
    if target > 0 then
        if not isInArray(creaturePullInfo[cid], target) then
            if not isNpc(target) then
                local position = getThingPosition(cid)
                local fromPosition = getThingPosition(target)
                local x = ((fromPosition.x - position.x) < 0 and 1 or ((fromPosition.x - position.x) == 0 and 0 or -1))
                local y = ((fromPosition.y - position.y) < 0 and 1 or ((fromPosition.y - position.y) == 0 and 0 or -1))
                local toPosition = {x = fromPosition.x + x, y = fromPosition.y + y, z = fromPosition.z}
                if doTileQueryAdd(target, toPosition) == 1 and getTileInfo(toPosition).house == false then
                    table.insert(creaturePullInfo[cid], target)
                    doTeleportThing(target, toPosition, true)
                end
            end
        end
    end
end

local spell = {}
spell.config = {
    [3] = {
        damageType = 1,
        areaEffect = 2,
        area = {
            {0, 0, 1, 1, 1, 0, 0},
            {0, 1, 1, 1, 1, 1, 0},
            {1, 1, 1, 1, 1, 1, 1},
            {1, 1, 1, 3, 1, 1, 1},
            {1, 1, 1, 1, 1, 1, 1},
            {0, 1, 1, 1, 1, 1, 0},
            {0, 0, 1, 1, 1, 0, 0}
        }      
    },
    [2] = {
        damageType = 1,
        areaEffect = 2,
        area = {
            {0, 0, 0, 0, 0, 0, 0},
            {0, 0, 1, 1, 1, 0, 0},
            {0, 1, 1, 1, 1, 1, 0},
            {0, 1, 1, 3, 1, 1, 0},
            {0, 1, 1, 1, 1, 1, 0},
            {0, 0, 1, 1, 1, 0, 0},
            {0, 0, 0, 0, 0, 0, 0}
        }      
    },
    [1] = {
        damageType = 1,
        areaEffect = 2,
        area = {
            {0, 0, 0, 0, 0, 0, 0},
            {0, 0, 0, 0, 0, 0, 0},
            {0, 0, 1, 1, 1, 0, 0},
            {0, 0, 1, 3, 1, 0, 0},
            {0, 0, 1, 1, 1, 0, 0},
            {0, 0, 0, 0, 0, 0, 0},
            {0, 0, 0, 0, 0, 0, 0}
        }      
    }
}

spell.combats = {}
for _, config in ipairs(spell.config) do
    local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_TYPE, config.damageType)
    setCombatParam(combat, COMBAT_PARAM_EFFECT, config.areaEffect)
    function onTargetCreature(cid, target)
        doPullCreature(target, cid)
    end
    setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")
    setCombatArea(combat, createCombatArea(config.area))
    table.insert(spell.combats, combat)
end

function onCastSpell(cid, var)
    creaturePullInfo[cid] = {}
    addEvent(resetCreaturePullInfo, 500, cid)
    for n = 1, #spell.combats do
        addEvent(doCombat, (n * 150) - 150, cid, spell.combats[n], var)
    end
    return true
end
Push
Lua:
local creaturePushInfo = {}

local function resetCreaturePushInfo(cid)
    creaturePushInfo[cid] = nil
end

local function doPushCreature(target, cid)
    if target > 0 then
        if not isInArray(creaturePushInfo[cid], target) then
            if not isNpc(target) then
                local position = getThingPosition(cid)
                local fromPosition = getThingPosition(target)
                local x = ((fromPosition.x - position.x) < 0 and -1 or ((fromPosition.x - position.x) == 0 and 0 or 1))
                local y = ((fromPosition.y - position.y) < 0 and -1 or ((fromPosition.y - position.y) == 0 and 0 or 1))
                local toPosition = {x = fromPosition.x + x, y = fromPosition.y + y, z = fromPosition.z}
                if doTileQueryAdd(target, toPosition) == 1 and getTileInfo(toPosition).house == false then
                    table.insert(creaturePushInfo[cid], target)
                    doTeleportThing(target, toPosition, true)
                end
            end
        end
    end
end

local spell = {}
spell.config = {
    [3] = {
        damageType = 1,
        areaEffect = 2,
        area = {
            {0, 0, 1, 1, 1, 0, 0},
            {0, 1, 1, 1, 1, 1, 0},
            {1, 1, 1, 1, 1, 1, 1},
            {1, 1, 1, 3, 1, 1, 1},
            {1, 1, 1, 1, 1, 1, 1},
            {0, 1, 1, 1, 1, 1, 0},
            {0, 0, 1, 1, 1, 0, 0}
        }      
    },
    [2] = {
        damageType = 1,
        areaEffect = 2,
        area = {
            {0, 0, 0, 0, 0, 0, 0},
            {0, 0, 1, 1, 1, 0, 0},
            {0, 1, 1, 1, 1, 1, 0},
            {0, 1, 1, 3, 1, 1, 0},
            {0, 1, 1, 1, 1, 1, 0},
            {0, 0, 1, 1, 1, 0, 0},
            {0, 0, 0, 0, 0, 0, 0}
        }      
    },
    [1] = {
        damageType = 1,
        areaEffect = 2,
        area = {
            {0, 0, 0, 0, 0, 0, 0},
            {0, 0, 0, 0, 0, 0, 0},
            {0, 0, 1, 1, 1, 0, 0},
            {0, 0, 1, 3, 1, 0, 0},
            {0, 0, 1, 1, 1, 0, 0},
            {0, 0, 0, 0, 0, 0, 0},
            {0, 0, 0, 0, 0, 0, 0}
        }      
    }
}

spell.combats = {}
for _, config in ipairs(spell.config) do
    local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_TYPE, config.damageType)
    setCombatParam(combat, COMBAT_PARAM_EFFECT, config.areaEffect)
    function onTargetCreature(cid, target)
        doPushCreature(target, cid)
    end
    setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")
    setCombatArea(combat, createCombatArea(config.area))
    table.insert(spell.combats, combat)
end

function onCastSpell(cid, var)
    creaturePushInfo[cid] = {}
    addEvent(resetCreaturePushInfo, 500, cid)
    for n = 1, #spell.combats do
        addEvent(doCombat, (n * 150) - 150, cid, spell.combats[n], var)
    end
    return true
end
 
Last edited:
Solution
Add a nominal delay to the teleport portion, so that the creature isn't 'pushed' until after the spell is completed.

change
Lua:
doTeleportThing(target, toPosition, true)
to
Lua:
addEvent(doTeleportThing, 10, target, toPosition, true)

-- edit
Nevermind. Didn't realize the actual issue. The above advice won't solve this.

Based on your initial description, I thought the spell was just an area-triggered spell, that pushed/pulled.

What the problem actually is, is that the spell is basically triggering 3 times per cast, with a 250 ms delay, with over-lapping area's of coverage.

Because of that, the players (on ALL sides of the caster, not just to the right of the caster) are being push/pulled potentially multiple times.

---
I'm going to think about how to possibly change that..
Initial thought is to create some sort of global table.. that will hold creature information..
Gonna take a bit of time to script in though.

--
Alright, here's my fix.
This fix assumes that the player cannot spam cast the spell. (aka, a god)

Pull
Lua:
local creaturePullInfo = {}

local function resetCreaturePullInfo(cid)
    creaturePullInfo[cid] = nil
end

local function doPullCreature(target, cid)
    if target > 0 then
        if not isInArray(creaturePullInfo[cid], target) then
            if not isNpc(target) then
                local position = getThingPosition(cid)
                local fromPosition = getThingPosition(target)
                local x = ((fromPosition.x - position.x) < 0 and 1 or ((fromPosition.x - position.x) == 0 and 0 or -1))
                local y = ((fromPosition.y - position.y) < 0 and 1 or ((fromPosition.y - position.y) == 0 and 0 or -1))
                local toPosition = {x = fromPosition.x + x, y = fromPosition.y + y, z = fromPosition.z}
                if doTileQueryAdd(target, toPosition) == 1 and getTileInfo(toPosition).house == false then
                    table.insert(creaturePullInfo[cid], target)
                    doTeleportThing(target, toPosition, true)
                end
            end
        end
    end
end

local spell = {}
spell.config = {
    [3] = {
        damageType = 1,
        areaEffect = 2,
        area = {
            {0, 0, 1, 1, 1, 0, 0},
            {0, 1, 1, 1, 1, 1, 0},
            {1, 1, 1, 1, 1, 1, 1},
            {1, 1, 1, 3, 1, 1, 1},
            {1, 1, 1, 1, 1, 1, 1},
            {0, 1, 1, 1, 1, 1, 0},
            {0, 0, 1, 1, 1, 0, 0}
        }     
    },
    [2] = {
        damageType = 1,
        areaEffect = 2,
        area = {
            {0, 0, 0, 0, 0, 0, 0},
            {0, 0, 1, 1, 1, 0, 0},
            {0, 1, 1, 1, 1, 1, 0},
            {0, 1, 1, 3, 1, 1, 0},
            {0, 1, 1, 1, 1, 1, 0},
            {0, 0, 1, 1, 1, 0, 0},
            {0, 0, 0, 0, 0, 0, 0}
        }     
    },
    [1] = {
        damageType = 1,
        areaEffect = 2,
        area = {
            {0, 0, 0, 0, 0, 0, 0},
            {0, 0, 0, 0, 0, 0, 0},
            {0, 0, 1, 1, 1, 0, 0},
            {0, 0, 1, 3, 1, 0, 0},
            {0, 0, 1, 1, 1, 0, 0},
            {0, 0, 0, 0, 0, 0, 0},
            {0, 0, 0, 0, 0, 0, 0}
        }     
    }
}

spell.combats = {}
for _, config in ipairs(spell.config) do
    local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_TYPE, config.damageType)
    setCombatParam(combat, COMBAT_PARAM_EFFECT, config.areaEffect)
    function onTargetCreature(cid, target)
        doPullCreature(target, cid)
    end
    setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")
    setCombatArea(combat, createCombatArea(config.area))
    table.insert(spell.combats, combat)
end

function onCastSpell(cid, var)
    creaturePullInfo[cid] = {}
    addEvent(resetCreaturePullInfo, 500, cid)
    for n = 1, #spell.combats do
        addEvent(doCombat, (n * 150) - 150, cid, spell.combats[n], var)
    end
    return true
end
Push
Lua:
local creaturePushInfo = {}

local function resetCreaturePushInfo(cid)
    creaturePushInfo[cid] = nil
end

local function doPushCreature(target, cid)
    if target > 0 then
        if not isInArray(creaturePushInfo[cid], target) then
            if not isNpc(target) then
                local position = getThingPosition(cid)
                local fromPosition = getThingPosition(target)
                local x = ((fromPosition.x - position.x) < 0 and -1 or ((fromPosition.x - position.x) == 0 and 0 or 1))
                local y = ((fromPosition.y - position.y) < 0 and -1 or ((fromPosition.y - position.y) == 0 and 0 or 1))
                local toPosition = {x = fromPosition.x + x, y = fromPosition.y + y, z = fromPosition.z}
                if doTileQueryAdd(target, toPosition) == 1 and getTileInfo(toPosition).house == false then
                    table.insert(creaturePushInfo[cid], target)
                    doTeleportThing(target, toPosition, true)
                end
            end
        end
    end
end

local spell = {}
spell.config = {
    [3] = {
        damageType = 1,
        areaEffect = 2,
        area = {
            {0, 0, 1, 1, 1, 0, 0},
            {0, 1, 1, 1, 1, 1, 0},
            {1, 1, 1, 1, 1, 1, 1},
            {1, 1, 1, 3, 1, 1, 1},
            {1, 1, 1, 1, 1, 1, 1},
            {0, 1, 1, 1, 1, 1, 0},
            {0, 0, 1, 1, 1, 0, 0}
        }     
    },
    [2] = {
        damageType = 1,
        areaEffect = 2,
        area = {
            {0, 0, 0, 0, 0, 0, 0},
            {0, 0, 1, 1, 1, 0, 0},
            {0, 1, 1, 1, 1, 1, 0},
            {0, 1, 1, 3, 1, 1, 0},
            {0, 1, 1, 1, 1, 1, 0},
            {0, 0, 1, 1, 1, 0, 0},
            {0, 0, 0, 0, 0, 0, 0}
        }     
    },
    [1] = {
        damageType = 1,
        areaEffect = 2,
        area = {
            {0, 0, 0, 0, 0, 0, 0},
            {0, 0, 0, 0, 0, 0, 0},
            {0, 0, 1, 1, 1, 0, 0},
            {0, 0, 1, 3, 1, 0, 0},
            {0, 0, 1, 1, 1, 0, 0},
            {0, 0, 0, 0, 0, 0, 0},
            {0, 0, 0, 0, 0, 0, 0}
        }     
    }
}

spell.combats = {}
for _, config in ipairs(spell.config) do
    local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_TYPE, config.damageType)
    setCombatParam(combat, COMBAT_PARAM_EFFECT, config.areaEffect)
    function onTargetCreature(cid, target)
        doPushCreature(target, cid)
    end
    setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")
    setCombatArea(combat, createCombatArea(config.area))
    table.insert(spell.combats, combat)
end

function onCastSpell(cid, var)
    creaturePushInfo[cid] = {}
    addEvent(resetCreaturePushInfo, 500, cid)
    for n = 1, #spell.combats do
        addEvent(doCombat, (n * 150) - 150, cid, spell.combats[n], var)
    end
    return true
end

Thank you so much @Xikini

---
For eveyone else who want a push/pull script it is now doing only one time ;)
 
@Xikini

I'm using TFS 1.3, I tried your spell and it shows the effect, but it doesn't pull or push the enemy, can you help me?

Lua:
local creaturePullInfo = {}

local function resetCreaturePullInfo(cid)
    creaturePullInfo[cid] = nil
end

local function doPullCreature(target, cid)
    if target > 0 then
        if not isInArray(creaturePullInfo[cid], target) then
            if not isNpc(target) then
                local position = getThingPosition(cid)
                local fromPosition = getThingPosition(target)
                local x = ((fromPosition.x - position.x) < 0 and 1 or ((fromPosition.x - position.x) == 0 and 0 or -1))
                local y = ((fromPosition.y - position.y) < 0 and 1 or ((fromPosition.y - position.y) == 0 and 0 or -1))
                local toPosition = {x = fromPosition.x + x, y = fromPosition.y + y, z = fromPosition.z}
                if doTileQueryAdd(target, toPosition) == 1 and getTileInfo(toPosition).house == false then
                    table.insert(creaturePullInfo[cid], target)
                    doTeleportThing(target, toPosition, true)
                end
            end
        end
    end
end

local spell = {}
spell.config = {
    [3] = {
        damageType = 1,
        areaEffect = 2,
        area = {
            {0, 0, 1, 1, 1, 0, 0},
            {0, 1, 1, 1, 1, 1, 0},
            {1, 1, 1, 1, 1, 1, 1},
            {1, 1, 1, 3, 1, 1, 1},
            {1, 1, 1, 1, 1, 1, 1},
            {0, 1, 1, 1, 1, 1, 0},
            {0, 0, 1, 1, 1, 0, 0}
        }     
    },
    [2] = {
        damageType = 1,
        areaEffect = 2,
        area = {
            {0, 0, 0, 0, 0, 0, 0},
            {0, 0, 1, 1, 1, 0, 0},
            {0, 1, 1, 1, 1, 1, 0},
            {0, 1, 1, 3, 1, 1, 0},
            {0, 1, 1, 1, 1, 1, 0},
            {0, 0, 1, 1, 1, 0, 0},
            {0, 0, 0, 0, 0, 0, 0}
        }     
    },
    [1] = {
        damageType = 1,
        areaEffect = 2,
        area = {
            {0, 0, 0, 0, 0, 0, 0},
            {0, 0, 0, 0, 0, 0, 0},
            {0, 0, 1, 1, 1, 0, 0},
            {0, 0, 1, 3, 1, 0, 0},
            {0, 0, 1, 1, 1, 0, 0},
            {0, 0, 0, 0, 0, 0, 0},
            {0, 0, 0, 0, 0, 0, 0}
        }     
    }
}

spell.combats = {}
for _, config in ipairs(spell.config) do
    local combat = createCombatObject()
    setCombatParam(combat, COMBAT_PARAM_TYPE, config.damageType)
    setCombatParam(combat, COMBAT_PARAM_EFFECT, config.areaEffect)
    function onTargetCreature(cid, target)
        doPullCreature(target, cid)
    end
    setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")
    setCombatArea(combat, createCombatArea(config.area))
    table.insert(spell.combats, combat)
end

function onCastSpell(cid, var)
    creaturePullInfo[cid] = {}
    addEvent(resetCreaturePullInfo, 500, cid)
    for n = 1, #spell.combats do
        addEvent(doCombat, (n * 150) - 150, cid, spell.combats[n], var)
    end
    return true
end

Lua Script Error: [Spell Interface]
in callback: data/spells/scripts/support/pull.lua:eek:nTargetCreature
(Unknown scriptfile)
data/spells/scripts/support/pull.lua:8: attempt to compare number with userdata
 
Back
Top