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

Lua No AoE Effect on Undead Legion

BugbyJones

New Member
Joined
Jun 25, 2023
Messages
4
Reaction score
1
Hi,

My Undead Legion spell only creates one skeleton and only if you're standing directly on the corpse. It should resurrect all corpses to skeletons over a certain area.

Here is the line in Spells.XML:

Lua:
<instant name="Undead Legion" words="exana mas mort" lvl="30" mana="500" aggressive="1" needlearn="1" script="spells/undead legion.lua">
        <vocation name="Druid" />
        <vocation name="Elder Druid" />
    </instant>


And here is the script for the spell .lua:

Code:
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



I will continue trying to fix it myself for now and will send the solution if I manage to.

Thanks.
Post automatically merged:

Edit to add- you can't actually cast the spell at all unless standing on a corpse.

It says "sorry not possible" instead of casting the spell and showing the AoE animation etc.
 
Last edited:
Hi,

My Undead Legion spell only creates one skeleton and only if you're standing directly on the corpse. It should resurrect all corpses to skeletons over a certain area.

Here is the line in Spells.XML:

Lua:
<instant name="Undead Legion" words="exana mas mort" lvl="30" mana="500" aggressive="1" needlearn="1" script="spells/undead legion.lua">
        <vocation name="Druid" />
        <vocation name="Elder Druid" />
    </instant>


And here is the script for the spell .lua:

Code:
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



I will continue trying to fix it myself for now and will send the solution if I manage to.

Thanks.
Post automatically merged:

Edit to add- you can't actually cast the spell at all unless standing on a corpse.

It says "sorry not possible" instead of casting the spell and showing the AoE animation etc.
try this:
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_GREEN_RINGS)

local area = createCombatArea(AREA_CIRCLE5X5)
combat:setArea(area)

function onTargetTile(creature, position)
    local tile = Tile(position)
    if tile then
        local corpse = tile:getTopDownItem()
        if corpse then
            local itemType = corpse:getType()
            if itemType:isCorpse() and itemType:isMovable() then
                local monster = Game.createMonster("Skeleton", position)
                if monster then
                    corpse:remove()
                    creature:addSummon(monster)
                    position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
                    return true
                end
            end
        end
    end
end

combat:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile")

function onCastSpell(creature, variant)
    return combat:execute(creature, variant)
end

to see if u script is working or why not, try using print after some function
 
try this:
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_GREEN_RINGS)

local area = createCombatArea(AREA_CIRCLE5X5)
combat:setArea(area)

function onTargetTile(creature, position)
    local tile = Tile(position)
    if tile then
        local corpse = tile:getTopDownItem()
        if corpse then
            local itemType = corpse:getType()
            if itemType:isCorpse() and itemType:isMovable() then
                local monster = Game.createMonster("Skeleton", position)
                if monster then
                    corpse:remove()
                    creature:addSummon(monster)
                    position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
                    return true
                end
            end
        end
    end
end

combat:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile")

function onCastSpell(creature, variant)
    return combat:execute(creature, variant)
end

to see if u script is working or why not, try using print after some function

Legend, it works well. I just need to play around with the AoE size and animation to match old Tibia. I can do that easily.

Thank you.
 
Back
Top