• 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 Stop attack enter PZ or Teleport

Forkz

Well-Known Member
Joined
Jun 29, 2020
Messages
360
Solutions
1
Reaction score
76
Hello otlanders,
According to the script below my spell spawns a custom monster around the target but when the target enters PZ or teleport area the monster stops attacking and does not end the attack (time).


Script Spell


Lua:
local removeTime = 3 --time to remove the clones

local arrs = {
    { x=-1, y=-1},
    { x=1, y=-1},
    { x=-1, y=1},
    { x=1, y=1}
}

local summonName = "Headcaptor"
local effect = CONST_ME_MAGIC_BLUE
local summonSay = "headcaptor"

function onCastSpell(cid, var)
    local targetId = variantToNumber(var)
    if not targetId then
        return false
    end

    for k, v in pairs(arrs) do
        local position = getCreaturePosition(targetId)
        position.x, position.y = position.x + v.x, position.y + v.y
        local creature = doCreateMonster(summonName, position, false, true)
        if isCreature(creature) then
            doTeleportThing(creature, position)
            doSendMagicEffect(position, effect)
            doConvinceCreature(cid, creature)
            doMonsterSetTarget(creature, targetId)
            doCreatureSay(creature, summonSay, TALKTYPE_ORANGE_1)
            addEvent(function (creature)
                if isCreature(creature) then
                    doRemoveCreature(creature)
                end
            end, 1000 * removeTime, creature)
        end
    end
    return true
end
 
From your description of the issue, I have no idea what the issue is.

Try explaining it again, differently. xD
 
From your description of the issue, I have no idea what the issue is.

Try explaining it again, differently. xD
Hi @Xikini my love -

There is a link to the video explaining my problem.

1- Player attacks the target
2- If the player is near PZ area or enters a teleport the "summon" stops attacking and doesn't finish the attack of "1.5s".

I would like that regardless of where the player was the "summon" would be attacking until the "set" time ends.
 
Entering a pz zone / teleporting out of range / going up/down stairs to stop a creature from attacking you is an intended base feature of Tibia.

There's no way of disabling this.

You'd have to create a custom function that forces an unblockable attack between 2 creatures, and apply it to all of your summons.
 
Entering a pz zone / teleporting out of range / going up/down stairs to stop a creature from attacking you is an intended base feature of Tibia.

There's no way of disabling this.

You'd have to create a custom function that forces an unblockable attack between 2 creatures, and apply it to all of your summons.
What if instead of me using CreateMonster and creating a spell that summons "monsters" is possible?
 
Back
Top