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

Multi attack spell/sd

Edroniasty

New Member
Joined
Oct 2, 2015
Messages
84
Reaction score
1
Hello! I'm looking for spell like sd rune who will attack 4/5 times, spell must depends on
Lua:
function onGetFormulaValues(player, level, maglevel)
    local min = (level / 5) + (maglevel * 3) + 32
    local max = (level / 5) + (maglevel * 9) + 40
    return -min, -max
end

Can't find it on forum - for tfs 1.2+ rep for help++

thanks

bump

bump
 
Last edited by a moderator:
Solution
this works, tested
however, i wasn't sure if you wanted it to keep hitting if the creature dies or not, but right now it will hit up to 5 times or until the creature is dead. whichever comes first.
you can change the interval between them by replacing 500 in the addEvent function with however many milliseconds you desire
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)

function onGetFormulaValues(player, level, maglevel)
    local min = (level / 5) + (maglevel * 3) + 32
    local max = (level / 5) + (maglevel * 9) + 40
    return -min, -max
end...
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)

function onGetFormulaValues(player, level, maglevel)
    local min = (level / 5) + (maglevel * 3) + 32
    local max = (level / 5) + (maglevel * 9) + 40
    return -min, -max
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
function onCastSpell(cid, var)
   local config = {
       min_repeat = 4,
       max_repeat = 5,
       time_between_reapiting = 100 -- 0.1 sec
   }
   for i = 1, math.random(config.min_repeat, config.max_repeat) do
       addEvent(function()
           if isPlayer(cid) then
               doCombat(cid, combat, positionToVariant(getCreaturePosition(var)))
           end
       end, i * config.time_between_reapiting)
   end
   return true
end
 
Last edited:
error ;s


(main interface)
in a timer event called from: (unknown scriptfile) luacombatexecute/ variant not found
stack tradeback
in function docombat

lua23/21

bump
 
Last edited by a moderator:
try this:
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
function onGetFormulaValues(player, level, maglevel)
    local min = (level / 5) + (maglevel * 3) + 32
    local max = (level / 5) + (maglevel * 9) + 40
    return -min, -max
end
setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

local function findTarget(cid, target)
   local config = {
       min_repeat = 4,
       max_repeat = 5,
       time_between_reapiting = 100 -- 0.1 sec
   }
   for i = 1, math.random(config.min_repeat - 1, config.max_repeat - 1) do
       addEvent(function()
           if target then
               doCombat(cid, combat, positionToVariant(getCreaturePosition(target)))
           end
       end, i * config.time_between_reapiting)
   end
end

function onCastSpell(cid, var)
   local pos = variantToPosition(var)
   local target = getTopCreature(pos).uid
   return findTarget(cid, target) and doCombat(cid, combat, var)
end
 
Last edited by a moderator:
Code:
Lua Script Error: [Spell Interface]
data/spells/scripts/attack/aterti veta.lua:onCastSpell
data/spells/scripts/attack/aterti veta.lua:18: attempt to call global 'getThingFromPos' (a nil value)
stack traceback:
        [C]: in function 'getThingFromPos'
        data/spells/scripts/attack/aterti veta.lua:18: in function <data/spells/scripts/attack/aterti veta.lua:12>
 
Code:
Lua Script Error: [Spell Interface]
data/spells/scripts/attack/aterti veta.lua:onCastSpell
data/spells/scripts/attack/aterti veta.lua:18: attempt to call global 'getThingFromPos' (a nil value)
stack traceback:
        [C]: in function 'getThingFromPos'
        data/spells/scripts/attack/aterti veta.lua:18: in function <data/spells/scripts/attack/aterti veta.lua:12>
updated
 
Code:
Lua Script Error: [Spell Interface]
data/spells/scripts/attack/aterti veta.lua:onCastSpell
data/spells/scripts/attack/aterti veta.lua:30: attempt to call global 'getThingFromPos' (a nil value)
stack traceback:
        [C]: in function 'getThingFromPos'
        data/spells/scripts/attack/aterti veta.lua:30: in function <data/spells/scripts/attack/aterti veta.lua:28>
 
Code:
ua Script Error: [Main Interface]
in a timer event called from:
(Unknown scriptfile)
LuaScriptInterface::luaCombatExecute(). Variant not found
stack traceback:
        [C]: in function 'doCombat'
        data/spells/scripts/attack/aterti veta.lua:22: in function <data/spells/scripts/attack/aterti veta.lua:20>

bump still waiting for help I see this is bit complicated
 
Last edited by a moderator:
Yea I know but I don't know what I should change in code, (I'm bad scripter) I know there's many topics with spells like that but they don't working with my tfs 1.2+ so I asking here for help ;s

I belive someone have spells like that and can post here
 
Yea I know but I don't know what I should change in code, (I'm bad scripter) I know there's many topics with spells like that but they don't working with my tfs 1.2+ so I asking here for help ;s

I belive someone have spells like that and can post here
I guess I wasn't clear enough. That was my fault.
Can you post your working single shot sudden death rune script?
 
this works, tested
however, i wasn't sure if you wanted it to keep hitting if the creature dies or not, but right now it will hit up to 5 times or until the creature is dead. whichever comes first.
you can change the interval between them by replacing 500 in the addEvent function with however many milliseconds you desire
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)

function onGetFormulaValues(player, level, maglevel)
    local min = (level / 5) + (maglevel * 3) + 32
    local max = (level / 5) + (maglevel * 9) + 40
    return -min, -max
end

combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

local function executeAttack(cid, variant, i, j)
    local player = Player(cid)
    if not player then
        return
    end
    if i >= j then
        return
    end
    addEvent(executeAttack, 500, cid, variant, i + 1, j)
    return combat:execute(player, variant)
end

function onCastSpell(creature, variant, isHotkey)
    return executeAttack(creature:getId(), variant, 0, 5)
end
 
Solution
Back
Top