Antonow
New Member
- Joined
- Dec 28, 2020
- Messages
- 3
- Reaction score
- 1
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:
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?
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?