krafttomten
Well-Known Member
Hello OTland!
Does anyone know how to write a custom monster spell in lua that both adds a certain condition, let's say decrease shield skill, and also does instant damage? There are no such monster spells in the original distro that I could find by looking through all of them. And all of my tests have resulted in the monster shooting the spell so fast that the server crashes
This is my code
Does anyone know how to write a custom monster spell in lua that both adds a certain condition, let's say decrease shield skill, and also does instant damage? There are no such monster spells in the original distro that I could find by looking through all of them. And all of my tests have resulted in the monster shooting the spell so fast that the server crashes
This is my code
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_DEATH)
combat:setArea(createCombatArea(AREA_BEAM1))
local parameters = {
{key = CONDITION_PARAM_TICKS, value = 10 * 1000},
{key = CONDITION_PARAM_SKILL_SHIELDPERCENT, value = 60},
}
function onCastSpell(creature, variant)
for _, target in ipairs(combat:getTargets(creature, variant)) do
target:addAttributeCondition(parameters)
end
return true
end