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

Traps Stacking

cryptomeepo

Member
Joined
Aug 11, 2021
Messages
61
Solutions
4
Reaction score
14
Players are able to stack traps and hit kill monsters.

Scripts:

open_trap:
Lua:
function onRemoveItem(item, tileitem, position)
    if item:getPosition():getDistance(position) > 0 then
        item:transform(3481, 1)
        item:decay()
        item:getPosition():sendMagicEffect(3)
    end
    return true
end

damage:
Code:
function onStepIn(creature, item, position, fromPosition)
    local tile = Tile(position)
    if tile:hasFlag(TILESTATE_PROTECTIONZONE) then
        return
    end
    
    if item:getId() == 2145 then
        item:transform(2146, 1)
        item:decay()
        doTargetCombatHealth(0, creature, COMBAT_PHYSICALDAMAGE, -60, -60)
    elseif item:getId() == 2146 or item:getId() == 2148 then
        doTargetCombatHealth(0, creature, COMBAT_PHYSICALDAMAGE, -60, -60)
    elseif item:getId() == 3482 then
        if not creature:isPlayer() then
            doTargetCombatHealth(0, creature, COMBAT_PHYSICALDAMAGE, -30, -30)
        else
            position:sendMagicEffect(CONST_ME_POFF)
        end
        item:transform(3481, 1)
        item:decay()
    elseif item:getId() == 3944 then
        doTargetCombatHealth(0, creature, COMBAT_PHYSICALDAMAGE, -30, -30)
        item:transform(3945, 1)
        item:decay()
    end
end

Can someone help me?
 
Solution
Fixed.

Lua:
function onStepIn(creature, item, position, fromPosition)
    local tile = Tile(position)
    if tile:hasFlag(TILESTATE_PROTECTIONZONE) then
        return
    end
    
    if item:getId() == 2145 then
        item:transform(2146, 1)
        item:decay()
        doTargetCombatHealth(0, creature, COMBAT_PHYSICALDAMAGE, -60, -60)
    elseif item:getId() == 2146 or item:getId() == 2148 then
        doTargetCombatHealth(0, creature, COMBAT_PHYSICALDAMAGE, -60, -60)
    elseif item:getId() == 3482 then
        local topItem = Tile(position):getTopDownItem()
        if not topItem or topItem ~= item then return end
        if not creature:isPlayer() then
            doTargetCombatHealth(0, creature, COMBAT_PHYSICALDAMAGE, -30, -30)...
Fixed.

Lua:
function onStepIn(creature, item, position, fromPosition)
    local tile = Tile(position)
    if tile:hasFlag(TILESTATE_PROTECTIONZONE) then
        return
    end
    
    if item:getId() == 2145 then
        item:transform(2146, 1)
        item:decay()
        doTargetCombatHealth(0, creature, COMBAT_PHYSICALDAMAGE, -60, -60)
    elseif item:getId() == 2146 or item:getId() == 2148 then
        doTargetCombatHealth(0, creature, COMBAT_PHYSICALDAMAGE, -60, -60)
    elseif item:getId() == 3482 then
        local topItem = Tile(position):getTopDownItem()
        if not topItem or topItem ~= item then return end
        if not creature:isPlayer() then
            doTargetCombatHealth(0, creature, COMBAT_PHYSICALDAMAGE, -30, -30)
        else
            position:sendMagicEffect(CONST_ME_POFF)
        end
        item:transform(3481, 1)
        item:decay()
    elseif item:getId() == 3944 then
        doTargetCombatHealth(0, creature, COMBAT_PHYSICALDAMAGE, -30, -30)
        item:transform(3945, 1)
        item:decay()
    end
end
 
Solution
Back
Top