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

make it do damage.

zxzxzx

New Member
Joined
Mar 12, 2011
Messages
334
Reaction score
3
Hello! my spell don't do any damage, don't know why, no errors:

Code:
local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat1, COMBAT_PARAM_EFFECT, 6)
local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, 6)
local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat3, COMBAT_PARAM_EFFECT, 6)
local combat4 = createCombatObject()
setCombatParam(combat4, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat4, COMBAT_PARAM_EFFECT, 6)
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, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 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, 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, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 0, 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},
}
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, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 2, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 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, 0},
}
arr4 = {
{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, 0, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 0, 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},
}
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)
function onGetFormulaValues(cid, level, maglevel)
    local min = (level * 1) + (maglevel * 10) + 0
    local max = (level * 1) + (maglevel * 10) + 0
    return min, max
end
setCombatCallback(combat1, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
setCombatCallback(combat2, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
setCombatCallback(combat3, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
setCombatCallback(combat4, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
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}
addEvent(onCastSpell1, 1, parameters)
addEvent(onCastSpell2, 1000, parameters)
addEvent(onCastSpell3, 2000, parameters)
addEvent(onCastSpell4, 3000, parameters)
end
 
Okay now do damage but only for the first, (one of 4 attacks)
As far as I managed to notice you need separate functions for each of your damage formula. I have no idea why, because I didn't track it further down, but I also had a similar problem once. So here:
LUA:
setCombatCallback(combat1, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
setCombatCallback(combat2, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
setCombatCallback(combat3, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
setCombatCallback(combat4, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

you should have onGetFormulaValuesX, for each of your combat and have 4 separate functions even if they do the same thing (You could put all your logic in one function and just call it in these callbacks).
 
Okay now do damage but only for the first, (one of 4 attacks)

Just add additional formula, fully customizable;

LUA:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 6)
local area = createCombatArea({
{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, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 3, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 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, 0},
})
setCombatArea(combat, area)
local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, 6)
local area2 = createCombatArea({
{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, 0, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 0, 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},
})
setCombatArea(combat2, area2)
local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat3, COMBAT_PARAM_EFFECT, 6)
local area3 = createCombatArea({
{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, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 3, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 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, 0},
})
setCombatArea(combat3, area3)
local combat4 = createCombatObject()
setCombatParam(combat4, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat4, COMBAT_PARAM_EFFECT, 6)
local area4 = createCombatArea({
{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, 0, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 0, 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},
})
setCombatArea(combat4, area4)
function onGetFormulaValues(cid, level, maglevel)
    min = -((level / 5) + (maglevel * 5.5) + 25)
    max = -((level / 5) + (maglevel * 11) + 50)
    return min, max
end

function onGetFormulaValues2(cid, level, maglevel)
    min = -((level / 5) + (maglevel * 5.5) + 25)
    max = -((level / 5) + (maglevel * 11) + 50)
    return min, max
end

function onGetFormulaValues3(cid, level, maglevel)
    min = -((level / 5) + (maglevel * 5.5) + 25)
    max = -((level / 5) + (maglevel * 11) + 50)
    return min, max
end

function onGetFormulaValues4(cid, level, maglevel)
    min = -((level / 5) + (maglevel * 5.5) + 25)
    max = -((level / 5) + (maglevel * 11) + 50)
    return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
setCombatCallback(combat2, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues2")
setCombatCallback(combat3, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues3")
setCombatCallback(combat4, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues4")

function onCastSpell(cid, var)
    addEvent(doCombat, 1000, cid, combat2, var)
    addEvent(doCombat, 2000, cid, combat3, var)
    addEvent(doCombat, 3000, cid, combat4, var)
    return doCombat(cid, combat, var)
end
 
good! now working but my console show this: argument #3 is unsafe, "in function add event'

Code:
function onCastSpell(cid, var)
    addEvent(doCombat, 500, cid, combat2, var)
    addEvent(doCombat, 1000, cid, combat3, var)
    addEvent(doCombat, 1500, cid, combat4, var)
    return doCombat(cid, combat, var)
end

lanes 98-102
 
Code:
function onCastSpell(cid, var)
    addEvent(doCombat, 500, cid.uid, combat2, var)
    addEvent(doCombat, 1000, cid.uid, combat3, var)
    addEvent(doCombat, 1500, cid.uid, combat4, var)
    return doCombat(cid, combat, var)
end
 
Code:
function onCastSpell(cid, var)
    addEvent(doCombat, 500, cid.uid, combat2, var)
    addEvent(doCombat, 1000, cid.uid, combat3, var)
    addEvent(doCombat, 1500, cid.uid, combat4, var)
    return doCombat(cid, combat, var)
end
This won't work, cid is Creature ID, it's already an ID. The warning comes from the combat passed that way. Don't know if there's any solution for this other than ignoring this warning.
 
This won't work, cid is Creature ID, it's already an ID, the combat should not be passed there though. Don't know if there's any solution for this other than ignoring this warning.
Try it then ;)

Because doing this I'm not getting this error.
 
thanks now working! but I wan't to add distance shoot effect and added
Code:
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ETHEREALSPEAR)
and it's looks like
Code:
local combat = createCombatObject()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ETHEREALSPEAR)
local area = createCombatArea({
{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, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 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, 0},
})
setCombatArea(combat, area)
but when I cast the spell there's no distance shoot.. :/ is there a solution?
 
thanks now working! but I wan't to add distance shoot effect and added
Code:
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ETHEREALSPEAR)
and it's looks like
Code:
local combat = createCombatObject()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ETHEREALSPEAR)
local area = createCombatArea({
{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, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 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, 0},
})
setCombatArea(combat, area)
but when I cast the spell there's no distance shoot.. :/ is there a solution?

LUA:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ETHEREALSPEAR)
local area = createCombatArea({
{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, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 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, 0},
})
setCombatArea(combat, area)
 
Code:
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ETHEREALSPEAR)
 
This won't work, cid is Creature ID, it's already an ID. The warning comes from the combat passed that way. Don't know if there's any solution for this other than ignoring this warning.
Try it then ;)

Because doing this I'm not getting this error.
would have been better if it was called creature cause that's what it is, not a number
creature.uid does work cause it gets passed through doCombat and doCombat is a compat function which constructs Creature by using the cid and doing combat:execute(creature, variant) afterwards
 
Code:
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ETHEREALSPEAR)
This not working, still can't see the distance shoot effect..

Code:
local combat2 = createCombatObject()
combat:setParameter(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(combat2, COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
combat:setParameter(combat2, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ETHEREALSPEAR)
local area2 = createCombatArea({
{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, 0, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 0, 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},
})
setCombatArea(combat2, area2)

looks like
Code:
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ETHEREALSPEAR)
dont match with whole script
 
distance effects dont work in aoe spells, you have to use a target spell to use distanceeffect param
only way to do it is to manually send effects
 
damn.. a lot of work.. I realy want to make spell like this
can u help me? spell must used this damage formula

  1. function onGetFormulaValues(cid, level, maglevel)
  2. min = -((level / 5) + (maglevel * 5.5) + 25)
  3. max = -((level / 5) + (maglevel * 11) + 50)
  4. return min, max
  5. end

distance effects dont work in aoe spells, you have to use a target spell to use distanceeffect param
only way to do it is to manually send effects
Hi Again, I think this script will help a loot, there is that damage formula I wanted and distance effect, but this script using only one aoe arena ((AREA_CROSSX))) SO is it possible to add another one? I try many times but I have only errors.

Code:
local combatConfig = {
    [0] = {type = COMBAT_PHYSICALDAMAGE, effect = CONST_ME_SOUND_YELLOW, distanceEffect = CONST_ANI_WHIRLWINDSWORD},
    [1] = {type = COMBAT_PHYSICALDAMAGE, effect = CONST_ME_SOUND_RED, distanceEffect = CONST_ANI_WHIRLWINDAXE},
    [2] = {type = COMBAT_PHYSICALDAMAGE, effect = CONST_ME_SOUND_BLUE, distanceEffect = CONST_ANI_WHIRLWINDCLUB},
}

function onGetFormulaValues0(player, level, maglevel)
    local min = (level * 2.56) + (maglevel * 26) + 0
    local max = (level * 3.56) + (maglevel * 26) + 0
    return -min, -max
end

function onGetFormulaValues1(player, level, maglevel)
    local min = (level * 2.56) + (maglevel * 26) + 0
    local max = (level * 3.56) + (maglevel * 26) + 0
    return -min, -max
end

function onGetFormulaValues2(player, level, maglevel)
    local min = (level * 2.56) + (maglevel * 26) + 0
    local max = (level * 3.56) + (maglevel * 26) + 0
    return -min, -max
end

function onTargetTile0(creature, position)
    creature:getPosition():sendDistanceEffect(position, combatConfig[0].distanceEffect)
end

function onTargetTile1(creature, position)
    creature:getPosition():sendDistanceEffect(position, combatConfig[1].distanceEffect)
end

function onTargetTile2(creature, position)
    creature:getPosition():sendDistanceEffect(position, combatConfig[2].distanceEffect)
end

function onTargetCreature0(creature, target)
    return doChallengeCreature(creature, target)
end

function onTargetCreature1(creature, target)
    return doChallengeCreature(creature, target)
end

function onTargetCreature2(creature, target)
    return doChallengeCreature(creature, target)
end

local combat = {}
for i = 0, 2 do
    combat[i] = Combat()
    combat[i]:setParameter(COMBAT_PARAM_TYPE, combatConfig[i].type)
    combat[i]:setParameter(COMBAT_PARAM_EFFECT, combatConfig[i].effect)
    combat[i]:setArea(createCombatArea(AREA_CROSSX))
    combat[i]:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues"..i)
    combat[i]:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile"..i)
    combat[i]:setCallback(CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature"..i)
end

local function combatCallBack(cid, id, variant)
    local player = Player(cid)
    if not player then
        return false
    end

    return combat[id]:execute(player, variant)
end

function onCastSpell(creature, variant)
    local cid = creature:getId()
    for i = 0, 2 do
        addEvent(combatCallBack, i * 500, cid, i, variant)
    end

    return true
end
 
Last edited by a moderator:
Hi Again, I think this script will help a loot, there is that damage formula I wanted and distance effect, but this script using only one aoe arena ((AREA_CROSSX))) SO is it possible to add another one? I try many times but I have only errors.

Code:
local combatConfig = {
    [0] = {type = COMBAT_PHYSICALDAMAGE, effect = CONST_ME_SOUND_YELLOW, distanceEffect = CONST_ANI_WHIRLWINDSWORD},
    [1] = {type = COMBAT_PHYSICALDAMAGE, effect = CONST_ME_SOUND_RED, distanceEffect = CONST_ANI_WHIRLWINDAXE},
    [2] = {type = COMBAT_PHYSICALDAMAGE, effect = CONST_ME_SOUND_BLUE, distanceEffect = CONST_ANI_WHIRLWINDCLUB},
}

function onGetFormulaValues0(player, level, maglevel)
    local min = (level * 2.56) + (maglevel * 26) + 0
    local max = (level * 3.56) + (maglevel * 26) + 0
    return -min, -max
end

function onGetFormulaValues1(player, level, maglevel)
    local min = (level * 2.56) + (maglevel * 26) + 0
    local max = (level * 3.56) + (maglevel * 26) + 0
    return -min, -max
end

function onGetFormulaValues2(player, level, maglevel)
    local min = (level * 2.56) + (maglevel * 26) + 0
    local max = (level * 3.56) + (maglevel * 26) + 0
    return -min, -max
end

function onTargetTile0(creature, position)
    creature:getPosition():sendDistanceEffect(position, combatConfig[0].distanceEffect)
end

function onTargetTile1(creature, position)
    creature:getPosition():sendDistanceEffect(position, combatConfig[1].distanceEffect)
end

function onTargetTile2(creature, position)
    creature:getPosition():sendDistanceEffect(position, combatConfig[2].distanceEffect)
end

function onTargetCreature0(creature, target)
    return doChallengeCreature(creature, target)
end

function onTargetCreature1(creature, target)
    return doChallengeCreature(creature, target)
end

function onTargetCreature2(creature, target)
    return doChallengeCreature(creature, target)
end

local combat = {}
for i = 0, 2 do
    combat[i] = Combat()
    combat[i]:setParameter(COMBAT_PARAM_TYPE, combatConfig[i].type)
    combat[i]:setParameter(COMBAT_PARAM_EFFECT, combatConfig[i].effect)
    combat[i]:setArea(createCombatArea(AREA_CROSSX))
    combat[i]:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues"..i)
    combat[i]:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile"..i)
    combat[i]:setCallback(CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature"..i)
end

local function combatCallBack(cid, id, variant)
    local player = Player(cid)
    if not player then
        return false
    end

    return combat[id]:execute(player, variant)
end

function onCastSpell(creature, variant)
    local cid = creature:getId()
    for i = 0, 2 do
        addEvent(combatCallBack, i * 500, cid, i, variant)
    end

    return true
end

Just take a look what's happening there. The distance effect is sent manually, just like Static_ wrote earlier in this thread. They are sent within callback functions (onTargetTile0 - onTargetTile2). You would need to add the same to your spell.
 
You saying I need to use this
Code:
(onTargetTile0 - onTargetTile2)
in that script?
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 6)
local area = createCombatArea({
{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, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 3, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 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, 0},
})
setCombatArea(combat, area)
local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, 6)
local area2 = createCombatArea({
{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, 0, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 0, 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},
})
setCombatArea(combat2, area2)
local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat3, COMBAT_PARAM_EFFECT, 6)
local area3 = createCombatArea({
{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, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 3, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 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, 0},
})
setCombatArea(combat3, area3)
local combat4 = createCombatObject()
setCombatParam(combat4, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat4, COMBAT_PARAM_EFFECT, 6)
local area4 = createCombatArea({
{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, 0, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 0, 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},
})
setCombatArea(combat4, area4)
function onGetFormulaValues(cid, level, maglevel)
    min = -((level / 5) + (maglevel * 5.5) + 25)
    max = -((level / 5) + (maglevel * 11) + 50)
    return min, max
end
function onGetFormulaValues2(cid, level, maglevel)
    min = -((level / 5) + (maglevel * 5.5) + 25)
    max = -((level / 5) + (maglevel * 11) + 50)
    return min, max
end
function onGetFormulaValues3(cid, level, maglevel)
    min = -((level / 5) + (maglevel * 5.5) + 25)
    max = -((level / 5) + (maglevel * 11) + 50)
    return min, max
end
function onGetFormulaValues4(cid, level, maglevel)
    min = -((level / 5) + (maglevel * 5.5) + 25)
    max = -((level / 5) + (maglevel * 11) + 50)
    return min, max
end
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
setCombatCallback(combat2, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues2")
setCombatCallback(combat3, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues3")
setCombatCallback(combat4, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues4")
function onCastSpell(cid, var)
    addEvent(doCombat, 1000, cid, combat2, var)
    addEvent(doCombat, 2000, cid, combat3, var)
    addEvent(doCombat, 3000, cid, combat4, var)
    return doCombat(cid, combat, var)
end

refresh? can u do this for me?
 
Last edited by a moderator:
Back
Top