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

OTX2 - trap hit is accumulating.

tdp157

Member
Joined
Oct 14, 2014
Messages
29
Reaction score
12
Hello, can anyone help me?

I have an OTX 2 07 Server - Codename LORD ZEDD.

And it is now possible to add the damage from traps to kill monsters.

D38oerS.jpeg


I send my trap.lua movements script for analysis.


Lua:
function onStepIn(cid, item, pos)
    if (isInArray(TRAP_OFF, item.itemid) == TRUE) then
        if (isPlayer(cid) == TRUE) then
            doTargetCombatHealth(0, cid, COMBAT_PHYSICALDAMAGE, -50, -100, CONST_ME_NONE)
            doTransformItem(item.uid, item.itemid + 1)
        end
    elseif (item.itemid == 2579) then
        if (isPlayer(cid) ~= TRUE) then
            doTargetCombatHealth(0, cid, COMBAT_PHYSICALDAMAGE, -10, -20, CONST_ME_NONE)
            doTransformItem(item.uid, item.itemid - 1)
        end
    end
    return TRUE
end

function onStepOut(cid, item, pos)
    doTransformItem(item.uid, item.itemid - 1)
    return TRUE
end

function onRemoveItem(item, tile, pos)
    if (getDistanceBetween(getThingPos(item.uid), pos) > 0) then
        doTransformItem(item.uid, item.itemid - 1)
        doSendMagicEffect(getThingPos(item.uid), CONST_ME_POFF)
    end
    return TRUE
end

function onAddItem(item, tileitem, pos)
    doTransformItem(item.uid, item.itemid - 1)
    doSendMagicEffect(pos, CONST_ME_POFF)
    return TRUE
end
 
Lua:
function onStepIn(cid, item, pos)
    if (isInArray(TRAP_OFF, item.itemid) == TRUE) then
        --if (isPlayer(cid) == TRUE) then
            doTargetCombatHealth(0, cid, COMBAT_PHYSICALDAMAGE, -50, -100, CONST_ME_NONE)
            doTransformItem(item.uid, item.itemid + 1)
        --end
    elseif (item.itemid == 2579) then
        --if (isPlayer(cid) ~= TRUE) then
            doTargetCombatHealth(0, cid, COMBAT_PHYSICALDAMAGE, -10, -20, CONST_ME_NONE)
            doTransformItem(item.uid, item.itemid - 1)
        --end
    end
    return TRUE
end
 
Lua:
function onStepIn(cid, item, pos)
    if (isInArray(TRAP_OFF, item.itemid) == TRUE) then
        --if (isPlayer(cid) == TRUE) then
            doTargetCombatHealth(0, cid, COMBAT_PHYSICALDAMAGE, -50, -100, CONST_ME_NONE)
            doTransformItem(item.uid, item.itemid + 1)
        --end
    elseif (item.itemid == 2579) then
        --if (isPlayer(cid) ~= TRUE) then
            doTargetCombatHealth(0, cid, COMBAT_PHYSICALDAMAGE, -10, -20, CONST_ME_NONE)
            doTransformItem(item.uid, item.itemid - 1)
        --end
    end
    return TRUE
end
Continues adding the damage of all traps in the stack

1704413117515.png
 
This function should avoid stacking the traps on top, accumulating damage.
Lua:
function onAddItem(item, tileitem, pos)
    doTransformItem(item.uid, item.itemid - 1)
    doSendMagicEffect(pos, CONST_ME_POFF)
    return TRUE
end
Lua:
function onAddItem(item, tileitem, pos)
    if (item.itemid == 2579) then
        doTransformItem(item.uid, item.itemid - 1)
        doSendMagicEffect(pos, CONST_ME_POFF)
    end
    return true
end
try testing the script separately from each function, and use true and not TRUE.

And check if any of these functions above are not causing damage even when closed.
 
Last edited:

Similar threads

Back
Top