• 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 Lady tenebris ultimate

aqubjukr

Well-Known Member
Joined
Mar 13, 2013
Messages
200
Solutions
17
Reaction score
79
Location
Paraná, Brazil
Can someone help me make the monster, when using the spell, stand still until it casts the spell (2.5 sec).

Monster position = 32912, 31599, 14


JavaScript:
local vocation = {1, 2, 3, 4, 5, 6, 7, 8, 10}

area = {
    {0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0},
    {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0},
    {0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0},
    {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
    {1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1},
    {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
    {0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0},
    {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0},
    {0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0}
}

local createArea = createCombatArea(area)

local combat = Combat()
combat:setArea(createArea)

function onTargetTile(creature, pos)
    local creatureTable = {}
    local n, i = Tile({x=pos.x, y=pos.y, z=pos.z}).creatures, 1
    if n ~= 0 then
        local v = getThingfromPos({x=pos.x, y=pos.y, z=pos.z, stackpos=i}).uid
        while v ~= 0 do
            if isCreature(v) == true then
                table.insert(creatureTable, v)
                if n == #creatureTable then
                    break
                end
            end
            i = i + 1
            v = getThingfromPos({x=pos.x, y=pos.y, z=pos.z, stackpos=i}).uid
        end
    end
    if #creatureTable ~= nil and #creatureTable > 0 then
        for r = 1, #creatureTable do
            if creatureTable[r] ~= creature then
                local min = 2200
                local max = 2500
                local player = Player(creatureTable[r])

                if isPlayer(creatureTable[r]) == true and table.contains(vocation, player:getVocation():getClientId()) then
                    doTargetCombatHealth(creature, creatureTable[r], COMBAT_DEATHDAMAGE, -min, -max, CONST_ME_NONE)
                elseif isMonster(creatureTable[r]) == true then
                    doTargetCombatHealth(creature, creatureTable[r], COMBAT_DEATHDAMAGE, -min, -max, CONST_ME_NONE)
                end
            end
        end
    end
    pos:sendMagicEffect(CONST_ME_MORTAREA)
    return true
end

combat:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile")

local function delayedCastSpell(cid, var)
    local creature = Creature(cid)
    if not creature then
        return
    end
    if creature:getHealth() >= 1 then
        return combat:execute(creature, positionToVariant(creature:getPosition()))
    end
    return
end

function onCastSpell(creature, var)
    local specs, spec = Game.getSpectators(Position(32912, 31599, 14), false, false, 12, 12, 12, 12)
    for i = 1, #specs do
        spec = specs[i]
        if spec:isPlayer() then
            spec:teleportTo(Position(32912, 31598, 14))
        elseif spec:getName():lower() == 'lady tenebris' then
            spec:teleportTo(Position(32912, 31599, 14))
        end
    end
    creature:say("LADY TENEBRIS BEGINS TO CHANNEL A POWERFULL SPELL! TAKE COVER!", TALKTYPE_MONSTER_YELL)
    addEvent(delayedCastSpell, 2500, creature:getId(), var)
    return true
end
 
Solution
@aqubjukr

You could try setting the creatures speed to a negative number:
Lua:
creature:changeSpeed(-1000)

and then return it to normal after the spell is cast: (inside the delayedCastSpell function)
Lua:
creature:changeSpeed(creature:getBaseSpeed() - 0)
@aqubjukr

You could try setting the creatures speed to a negative number:
Lua:
creature:changeSpeed(-1000)

and then return it to normal after the spell is cast: (inside the delayedCastSpell function)
Lua:
creature:changeSpeed(creature:getBaseSpeed() - 0)
 
Solution
@aqubjukr

You could try setting the creatures speed to a negative number:
Lua:
creature:changeSpeed(-1000)

and then return it to normal after the spell is cast: (inside the delayedCastSpell function)
Lua:
creature:changeSpeed(creature:getBaseSpeed() - 0)

Thx, i've changed the spell to -370 when casting spell and created a "local function" to revert speed after cast.

Thx for helping!!!
 
Back
Top