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

Help with multiple CombatArea spell

Antonow

New Member
Joined
Dec 28, 2020
Messages
2
Reaction score
0
Hello there!
I've been trying to make a custom 'animated' spell, meaning it has a cast animation with subsequent animations that still deals damage.

Here's the code that I have so far:
Lua:
local combat = createCombatObject() -->Needed in order for spells to do extra things.
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE) -->Sets what kind of damage the spell has
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_POISONAREA) -->Sets what sprite effect spell has

function onGetFormulaValues(cid, level, maglevel)  -->Easier to customize (Ex. at lvl 70, mlv 61)
min = -(level * 3 + maglevel * 4) * 4  -->Min -840
max = -(level * 5 + maglevel * 8) * 2   -->Max -1676
return min, max
end
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

--local area = createCombatArea(AREA_CROSS5X5) -->Spell Area, this code can be used for pre-made areas, custom should be changed for the one below.
--setCombatArea(combat, area)

--> Current code only casts the spell on the SQM of th player casting. How to make a sequence of areas?
local spellArea = {createCombatArea({
{1, 0, 1},
{0, 3, 0},
{1, 0, 1}
}), createCombatArea({
{1, 0, 1, 0, 1},
{0, 0, 0, 0, 0},
{1, 0, 2, 0, 1},
{0, 0, 0, 0, 0},
{1, 0, 1, 0, 1}
}), createCombatArea({
{0, 1, 0, 1, 0},
{1, 0, 1, 0, 1},
{0, 1, 2, 1, 0},
{1, 0, 1, 0, 1},
{0, 1, 0, 1, 0}
}), createCombatArea({
{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, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0},
{1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1},
{1, 1, 1, 0, 0, 2, 0, 0, 1, 1, 1},
{1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1},
{0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 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}
}), createCombatArea({
{1, 0, 1},
{0, 2, 0},
{1, 0, 1}
}), createCombatArea({
{1, 0, 1, 0, 1},
{0, 0, 0, 0, 0},
{1, 0, 3, 0, 1},
{0, 0, 0, 0, 0},
{1, 0, 1, 0, 1}
}), createCombatArea({
{0, 1, 0, 1, 0},
{1, 0, 1, 0, 1},
{0, 1, 2, 1, 0},
{1, 0, 1, 0, 1},
{0, 1, 0, 1, 0}
})
}
local area = createCombatArea(spellArea)
setCombatArea(combat, area)

local condition = createConditionObject(CONDITION_POISON) -->Set conditioning for spell
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(condition, 10, 5000, -150)  --> Tick conditions, (ticks, interval, damage)
addDamageCondition(condition, 10, 5000, -100)
addDamageCondition(condition, 10, 5000, -50)
setCombatCondition(combat, condition)

function onCastSpell(cid, var)
return doCombat(cid, combat, var)
end

The spell itself does not give me any kind of error when casting, it works but it casts only on the sqm the player is and it's only 1 sqm.
I'm really confused with these 'animated' spells. Since I'm going to use this for a boss fight in my local server with friends I'd like to make it animated and not static with the pre-made areas found in spells.xml.

Can someone help me out and point me into the right direction?
 
With the help of Animera I managed to make this code now.
But I'm not 100% about the ending.

Lua:
-->needed in order for spells to do extra things.
local combat = createCombatObject()

-->Set conditioning for spell. (tick, interval, damage)
local condition = createConditionObject(CONDITION_POISON)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(condition, 10, 5000, -150)
addDamageCondition(condition, 10, 5000, -100)
addDamageCondition(condition, 10, 5000, -50)
setCombatCondition(combat, condition)

--> Assign area on each combat and let the spell cast each one by one.
local spellArea1 = createCombatArea({
{1, 0, 1},
{0, 3, 0},
{1, 0, 1}
})

local spellArea2 = createCombatArea({
{1, 0, 1, 0, 1},
{0, 0, 0, 0, 0},
{1, 0, 2, 0, 1},
{0, 0, 0, 0, 0},
{1, 0, 1, 0, 1}
})

local spellArea3 = createCombatArea({
{0, 1, 0, 1, 0},
{1, 0, 1, 0, 1},
{0, 1, 2, 1, 0},
{1, 0, 1, 0, 1},
{0, 1, 0, 1, 0}
})

local spellArea4 = createCombatArea({
{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, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0},
{1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1},
{1, 1, 1, 0, 0, 2, 0, 0, 1, 1, 1},
{1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1},
{0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 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}
})

local spellArea5 = createCombatArea({
{1, 0, 1},
{0, 2, 0},
{1, 0, 1}
})

local spellArea6 = createCombatArea({
{1, 0, 1, 0, 1},
{0, 0, 0, 0, 0},
{1, 0, 3, 0, 1},
{0, 0, 0, 0, 0},
{1, 0, 1, 0, 1}
})

local spellArea7 = createCombatArea({
{0, 1, 0, 1, 0},
{1, 0, 1, 0, 1},
{0, 1, 2, 1, 0},
{1, 0, 1, 0, 1},
{0, 1, 0, 1, 0}
})

-->Call each combat one by one
local combat1= createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
setCombatParam(Combat1, COMBAT_PARAM_EFFECT, CONST_ME_POISONAREA)
setCombatArea(combat1, spellArea1)

local combat2= createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
setCombatParam(Combat2, COMBAT_PARAM_EFFECT, CONST_ME_POISONAREA)
setCombatArea(combat2, spellArea2)

local combat3= createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
setCombatParam(Combat3, COMBAT_PARAM_EFFECT, CONST_ME_POISONAREA)
setCombatArea(combat3, spellArea3)

local combat4= createCombatObject()
setCombatParam(combat4, COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
setCombatParam(Combat4, COMBAT_PARAM_EFFECT, CONST_ME_POISONAREA)
setCombatArea(combat4, spellArea4)

local combat5= createCombatObject()
setCombatParam(combat5, COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
setCombatParam(Combat5, COMBAT_PARAM_EFFECT, CONST_ME_POISONAREA)
setCombatArea(combat5, spellArea5)

local combat6= createCombatObject()
setCombatParam(combat6, COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
setCombatParam(Combat6, COMBAT_PARAM_EFFECT, CONST_ME_POISONAREA)
setCombatArea(combat6, spellArea6)

local combat7= createCombatObject()
setCombatParam(combat7, COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
setCombatParam(Combat7, COMBAT_PARAM_EFFECT, CONST_ME_POISONAREA)
setCombatArea(combat7, spellArea7)

-->Set formulavalues (Animera)
function onGetFormulaValues1(cid, level, maglevel) -->Easier to customize (Ex. at lvl 70, mlv 61)
min = -(level * 3 + maglevel * 4) * 2              -->Min -908
max = -(level * 5 + maglevel * 8) * 2             -->Max -1676
return min, max
end
function onGetFormulaValues2(cid, level, maglevel) -->Easier to customize (Ex. at lvl 70, mlv 61)
min = -(level * 3 + maglevel * 4) * 4              -->Min -1816
max = -(level * 5 + maglevel * 8) * 5             -->Max -4190
return min, max
end
function onGetFormulaValues3(cid, level, maglevel) -->Easier to customize (Ex. at lvl 70, mlv 61)
min = -(level * 3 + maglevel * 4) * 8              -->Min -3632
max = -(level * 5 + maglevel * 8) * 6             -->Max -5028
return min, max
end
-->Set Combat Callback for each combat with each formulavalueX
setCombatCallback(combat1, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues1")
setCombatCallback(combat2, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues1")
setCombatCallback(combat3, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues1")
setCombatCallback(combat4, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues1")
setCombatCallback(combat5, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues2")
setCombatCallback(combat6, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues2")
setCombatCallback(combat7, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues3")


-->This is the part that's confusing me :(
function onCastSpell(cid, var)
ddoCombat(cid, combat, var)

addEvent(function()

if isPlayer(cid) then

doCombat(cid, combat, var)

end

end, 350, cid, combat, var)
 
Back
Top