• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Help with this spell

wafuboe

Active Member
Joined
Dec 24, 2010
Messages
884
Solutions
2
Reaction score
26
Hi, i recently found this spell script, i edited it a little bit, so it will do 2 ground shaker waves, but what i need to go to add more waves for example three more?

heres the script
Code:
---Creado Por Josepancho Blacktibia---


local acombat1 = createCombatObject()
local acombat2 = createCombatObject()
local acombat3 = createCombatObject()
local acombat4 = createCombatObject()

local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_EFFECT, 35)
setCombatParam(combat1, COMBAT_PARAM_DISTANCEEFFECT, 0)

function onGetFormulaValues(player, skill, attack, factor)
    local min = (player:getLevel() / 5) + (skill * attack * 0.06) + 13
    local max = (player:getLevel() / 5) + (skill * attack * 0.11) + 27
    return -min, -max
end

combat1:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, 35)
setCombatParam(combat2, COMBAT_PARAM_DISTANCEEFFECT, 0)

function onGetFormulaValues(player, skill, attack, factor)
    local min = (player:getLevel() / 5) + (skill * attack * 0.06) + 13
    local max = (player:getLevel() / 5) + (skill * attack * 0.11) + 27
    return -min, -max
end

combat2:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

arr1 = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 3, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
}


arr2 = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 3, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
}



local area1 = createCombatArea(arr1)
local area2 = createCombatArea(arr2)
setCombatArea(acombat1, area1)
setCombatArea(acombat2, area2)


function onTargetTile(cid, pos)
    doCombat(cid,combat1,positionToVariant(pos))
end

function onTargetTile2(cid, pos)
    doCombat(cid,combat2,positionToVariant(pos))
end

setCombatCallback(acombat1, CALLBACK_PARAM_TARGETTILE, "onTargetTile")

setCombatCallback(acombat2, CALLBACK_PARAM_TARGETTILE, "onTargetTile2")

local function onCastSpell1(parameters)
    doCombat(parameters.cid, acombat1, parameters.var)
end
local function onCastSpell2(parameters)
    doCombat(parameters.cid, acombat2, parameters.var)
end
function onCastSpell(cid, var)
local parameters = { cid = cid, var = var}
addEvent(onCastSpell1, 100, parameters)
addEvent(onCastSpell2, 400, parameters)

return TRUE

end
 
Solution
Just add another addEvent with a higher delay. Also just skimming it looks like both your combats do the same thing so no need to make new functions for each one just recall the function every event.

Just example not sure if it will work:
LUA:
addEvent(onCastSpell, 100, parameters)
addEvent(onCastSpell, 400, parameters)
addEvent(onCastSpell, 800, parameters)
addEvent(onCastSpell, 1200, parameters)

Also if you want to do the correct way, check into this post for reference.
Solved - Want to correctly loop addevent
Just add another addEvent with a higher delay. Also just skimming it looks like both your combats do the same thing so no need to make new functions for each one just recall the function every event.

Just example not sure if it will work:
LUA:
addEvent(onCastSpell, 100, parameters)
addEvent(onCastSpell, 400, parameters)
addEvent(onCastSpell, 800, parameters)
addEvent(onCastSpell, 1200, parameters)

Also if you want to do the correct way, check into this post for reference.
Solved - Want to correctly loop addevent
 
Solution
Just add another addEvent with a higher delay. Also just skimming it looks like both your combats do the same thing so no need to make new functions for each one just recall the function every event.

Just example not sure if it will work:
LUA:
addEvent(onCastSpell, 100, parameters)
addEvent(onCastSpell, 400, parameters)
addEvent(onCastSpell, 800, parameters)
addEvent(onCastSpell, 1200, parameters)

Also if you want to do the correct way, check into this post for reference.
Solved - Want to correctly loop addevent

thanks Apollos :D it worked perfectly
 
Back
Top