Hello guys,
someone here can help me with my spell problem?
This spell is not working correctly, currently the spell only works if my character is on top of the dead creature corpse (same tile) and appear only 1 skeleton... (does nothing with the others bodies around) of my character.
and is not doing a magic in area, how would it be correctly...
How can I fix this spell?
My spells.xml configuration
My spell script.
Undead Legion.lua
someone here can help me with my spell problem?
This spell is not working correctly, currently the spell only works if my character is on top of the dead creature corpse (same tile) and appear only 1 skeleton... (does nothing with the others bodies around) of my character.
and is not doing a magic in area, how would it be correctly...
How can I fix this spell?
My spells.xml configuration
XML:
<instant name="Undead Legion" words="exana mas mort" lvl="30" mana="300" prem="1" aggressive="1" needlearn="1" script="spells/undead legion.lua">
<vocation name="Druid" />
<vocation name="Elder Druid" />
</instant>
My spell script.
Undead Legion.lua
LUA:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_GREEN_RINGS)
combat:setArea(createCombatArea(AREA_CIRCLE5X5))
local humanBodies = {
4240, 4241, 4247, 4248
}
function onCastSpell(creature, variant)
local position = Variant.getPosition(variant)
local tile = Tile(position)
if tile then
local corpse = tile:getTopDownItem()
if corpse then
local itemType = corpse:getType()
if not table.contains(humanBodies, itemType:getId()) then
if itemType:isCorpse() and itemType:isMovable() then
local monster = Game.createMonster("Skeleton", position)
if monster then
corpse:remove()
monster:setMaster(creature)
position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
return true
end
end
end
end
end
creature:getPosition():sendMagicEffect(CONST_ME_POFF)
creature:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
return false
end