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

How To make Spell Who hit 3 times in row

Wazzap

Killing Elite
Joined
Jun 15, 2010
Messages
124
Reaction score
4
Location
London / Poland
1.How his look like
local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_EFFECT, 6)
setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, -0.4, -50, -0.5, 0)

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, 37)
setCombatFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, -0.4, -60, -0.5, 0)

local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat3, COMBAT_PARAM_EFFECT, 20)
setCombatFormula(combat3, COMBAT_FORMULA_LEVELMAGIC, -0.4, -70, -0.5, 0)

local combat4 = createCombatObject()
setCombatParam(combat4, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat4, COMBAT_PARAM_EFFECT, 39)
setCombatFormula(combat4, COMBAT_FORMULA_LEVELMAGIC, -0.4, -70, -0.5, 0)

which magic hit ( ICE, Fire ... )
Effect
Power Hit ( - HP if get hit )

Next we have where, size to Hit

arr1 = {
{0, 0, 0},
{0, 0, 1},
{0, 2, 0},
{1, 0, 0},
{0, 0, 0},
}

arr2 = {
{0, 0, 0},
{0, 1, 0},
{0, 2, 0},
{0, 1, 0},
{0, 0, 0},
}

arr3 = {
{0, 0, 0},
{1, 0, 0},
{0, 2, 0},
{0, 0, 1},
{0, 0, 0},
}

arr4 = {
{0, 0, 0},
{0, 0, 0},
{1, 2, 1},
{0, 0, 0},
{0, 0, 0},
}


0 = ignor
1 = hit of spell
2 , 3 = player

Next We Have this ( NON CHANGE )

local area1 = createCombatArea(arr1)
local area2 = createCombatArea(arr2)
local area3 = createCombatArea(arr3)
local area4 = createCombatArea(arr4)
setCombatArea(combat1, area1)
setCombatArea(combat2, area2)
setCombatArea(combat3, area3)
setCombatArea(combat4, area4)

local function onCastSpell1(parameters)
doCombat(parameters.cid, parameters.combat1, parameters.var)
end

local function onCastSpell2(parameters)
doCombat(parameters.cid, parameters.combat2, parameters.var)
end

local function onCastSpell3(parameters)
doCombat(parameters.cid, parameters.combat3, parameters.var)
end

local function onCastSpell4(parameters)
doCombat(parameters.cid, parameters.combat4, parameters.var)
end

function onCastSpell(cid, var)
local parameters = { cid = cid, var = var, combat1 = combat1, combat2 = combat2, combat3 = combat3, combat4 = combat4}

next we have time how long to shot second shot form onCastSpellx:

addEvent(onCastSpell1, x, parameters)
addEvent(onCastSpell2, x, parameters)
addEvent(onCastSpell3, x, parameters)
addEvent(onCastSpell4, x, parameters)

end
x = time 1000 = 1 second

2. How To ADD more
Under :
local combat4 = createCombatObject()
setCombatParam(combat4, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat4, COMBAT_PARAM_EFFECT, 39)
setCombatFormula(combat4, COMBAT_FORMULA_LEVELMAGIC, -0.4, -70, -0.5, 0)
Add :
local combat5 = createCombatObject()
setCombatParam(combat5, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat5, COMBAT_PARAM_EFFECT, 39)
setCombatFormula(combat5, COMBAT_FORMULA_LEVELMAGIC, -0.4, -70, -0.5, 0)
Under :
arr4 = {
{0, 0, 0},
{0, 0, 0},
{1, 2, 1},
{0, 0, 0},
{0, 0, 0},
}
Add :
arr5 = {
{0, 0, 0},
{0, 0, 0},
{1, 2, 1},
{0, 0, 0},
{0, 0, 0},
}
Under :
local area4 = createCombatArea(arr4)
Add :
local area5 = createCombatArea(arr5)
Under :
local function onCastSpell4(parameters)
doCombat(parameters.cid, parameters.combat4, parameters.var)
end
Add :
local function onCastSpell5(parameters)
doCombat(parameters.cid, parameters.combat5, parameters.var)
end
New We have to in :
local parameters = { cid = cid, var = var, combat1 = combat1, combat2 = combat2, combat3 = combat3, combat4 = combat4}
After :
combat4 = combat4
Before :
add :
, combat5 = combat5
Mast look like this :
local parameters = { cid = cid, var = var, combat1 = combat1, combat2 = combat2, combat3 = combat3, combat4 = combat4, combat5 = combat5}
and for end :
Under :
addEvent(onCastSpell4, x, parameters)
Add :
addEvent(onCastSpell5, x, parameters)

3. How to - a hit
Delete following list :
local combatX = createCombatObject()
setCombatParam(combatX, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combatX, COMBAT_PARAM_EFFECT, 39)
setCombatFormula(combatX, COMBAT_FORMULA_LEVELMAGIC, -0.4, -70, -0.5, 0)
arrX = {
{0, 0, 0},
{0, 0, 0},
{1, 2, 1},
{0, 0, 0},
{0, 0, 0},
}
local areaX = createCombatArea(arrX)
setCombatArea(combatX, areaX)
local function onCastSpellX(parameters)
doCombat(parameters.cid, parameters.combatX, parameters.var)
end
From This :
local parameters = { cid = cid, var = var, combat1 = combat1, combat2 = combat2, combat3 = combat3, combatX = combatX}
delete this :
, combatX = combatX
Last things to delete :
addEvent(onCastSpellX, time, parameters)


END
Sorr For my bad English
 
is this a release or a tutorial? :blink:
 
Dude thats amazing I think I was also the first one to do this .... 3 years ago.

Seriously, anyone who hasn't figured this out yet needs to die.

Anyways, good job I hopd it helps the need-to-die people out ;D
 
This is tutorial + ready script to paste in you server

Thx for nice post this script it is not easy to did :(
 
thanks for you ! And What Are All Atacks And Effects.... please
FAST For Learn To Edit This Script

And The Exaust NO WORK!
 
Last edited:
my approach
note: function castIfCasterAlive should be pulled into libs if you want to use it in multiple places

Lua:
local animationEffect = CONST_ME_GROUNDSHAKER
local combatDamage = createCombatObject()
setCombatParam(combatDamage, COMBAT_PARAM_EFFECT, 0)
setCombatParam(combatDamage, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
function onGetFormulaValues(player, skill, attack, factor)
    local min = 100,
    local max = 100
    return -min, -max
end
combatDamage:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_EFFECT, animationEffect)
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
function onGetFormulaValues(player, skill, attack, factor)
    local min = 100,
    local max = 100
    return -min, -max
end
combat1:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_EFFECT, animationEffect)
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, 0, 0, 0, 0)
local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_EFFECT, animationEffect)
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, 0, 0, 0, 0)
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, 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, 0, 1, 2, 1, 0, 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 },
    { 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, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0 },
    { 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 },
    { 0, 0, 0, 1, 0, 2, 0, 1, 0, 0, 0 },
    { 0, 0, 0, 1, 0, 0, 0, 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 },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
}
arr3 = {
    { 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, 0, 0, 0, 1, 0, 0, 0 },
    { 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0 },
    { 0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0 },
    { 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0 },
    { 0, 0, 0, 1, 0, 0, 0, 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 }
}
arrDamage = {
    { 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, 0, 0, 0, 1, 1, 0, 0 },
    { 0, 0, 1, 1, 0, 2, 0, 1, 1, 0, 0 },
    { 0, 0, 1, 1, 0, 0, 0, 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 areaDamage = createCombatArea(arrDamage)
local area1 = createCombatArea(arr1)
local area2 = createCombatArea(arr2)
local area3 = createCombatArea(arr3)
setCombatArea(combatDamage, areaDamage)
setCombatArea(combat1, area1)
setCombatArea(combat2, area2)
setCombatArea(combat3, area3)
local function castIfCasterAlive(creature, combat, var, shouldFollowCaster)
    if shouldFollowCaster then
        var = Variant(creature)
    end
    local caster = Creature(creature)
    if caster then
         combat:execute(creature, var)
    end
end
local spell = Spell("instant")
function spell.onCastSpell(creature, var)
    local castPositon = creature:getPosition()
    addEvent(castIfCasterAlive, 0, creature:getId(), combat1, var, false)
    addEvent(castIfCasterAlive, 150, creature:getId(), combatDamage, var, false)
    addEvent(castIfCasterAlive, 150, creature:getId(), combat2, var, false)
    addEvent(castIfCasterAlive, 300, creature:getId(), combat3, var, false)
    return true
end
spell:group("attack")
spell:id(106)
spell:name("Groundshaker")
spell:words("exori mas")
spell:magicLevel(7)
spell:level(100)
spell:mana(500)
spell:isPremium(true)
spell:needWeapon(true)
spell:cooldown(2 * 1000)
spell:groupCooldown(2 * 1000)
spell:needLearn(false)
spell:vocation("knight;true", "elite knight;true")
spell:register()
 
You are the best!
I hadn't seen the comment talking about the cooldown.

I was using the code to make my spell (because I understood the logic better) and to fix the cooldown problem I added the following line

line 1 without any parameters:
Lua:
local combat = createCombatObject()

and in onCastSpell simple add the return before end the function:
Lua:
return combat:execute(cid, var)

I know it's simple, but maybe it can help someone newbie like me.
 
Back
Top