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

TFS 0.X Shovel hole don't open with blood

sabodden

Member
Joined
Sep 27, 2019
Messages
138
Reaction score
17
It is annoying...
If someone gets hits on shovel role the blood blocks to open the hole...

If someone drops trashes on the hole, nobody can open...


It isn't possible to do like rope?
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

    if itemEx.actionid == 45001 then
        local storage = 51006
        queststatus = getPlayerStorageValue(cid, storage)
        if queststatus == -1 then
            doPlayerSendTextMessage(cid, 22, "You have found an ancient amulet. Strange engravings cover it. Maybe Morris can make them out.")
            -- give item????
            setPlayerStorageValue(cid, storage, 1)
        else
            doPlayerSendTextMessage(cid,22,"It is empty.")
        end
        return true
    end

    if(isInArray(HOLES, itemEx.itemid)) then
        if(itemEx.itemid ~= 8579) then
            itemEx.itemid = itemEx.itemid + 1
        else
            itemEx.itemid = 8585
        end

        doTransformItem(itemEx.uid, itemEx.itemid)
        doDecayItem(itemEx.uid)
        return true
    elseif(SAND_HOLES[itemEx.itemid] ~= nil) then
        doSendMagicEffect(toPosition, CONST_ME_POFF)
        doTransformItem(itemEx.uid, SAND_HOLES[itemEx.itemid])

        doDecayItem(itemEx.uid)
        return true
    elseif(itemEx.itemid == SAND and not isRookie(cid)) then
        local rand = math.random(1, 100)
        if(rand >= 1 and rand <= 5) then
            doCreateItem(ITEM_SCARAB_COIN, 1, toPosition)
        elseif(rand > 85) then
            doCreateMonster("Scarab", toPosition, false)
        end

        doSendMagicEffect(toPosition, CONST_ME_POFF)
        return true
    end

    return false
end
 
Solution
Lol, amazing... Thank you!

What if i want to remove the dead rat, gold coins...
Everything so players cant block the hole

Only with some items (mws/fire field,energy field...)
local blockable_field_items = {1497, 1499, 1496, 1495, 1492, 1493, 1494}
Then you should remove the checkings for items, this line:

Lua:
if (isInArray(CLOSED_HOLE, hole.itemid) and not (blockingItem.itemid > 0 or isCreature(blockingItem.uid) or isInArray(FIELDS, itemEx.itemid))) then

To this:

Code:
    if (isInArray(CLOSED_HOLE, hole.itemid) and not (isCreature(blockingItem.uid) or isInArray(FIELDS, itemEx.itemid))) then

And also move them down when the hole opens:

add this variables:
local holepositionup = {x = toPosition.x, y = toPosition.y, z =...

Terotrificy

Well-Known Member
Joined
Oct 18, 2020
Messages
238
Solutions
9
Reaction score
75
Location
Santiago, Chile.
It is annoying...
If someone gets hits on shovel role the blood blocks to open the hole...

If someone drops trashes on the hole, nobody can open...


It isn't possible to do like rope?
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

    if itemEx.actionid == 45001 then
        local storage = 51006
        queststatus = getPlayerStorageValue(cid, storage)
        if queststatus == -1 then
            doPlayerSendTextMessage(cid, 22, "You have found an ancient amulet. Strange engravings cover it. Maybe Morris can make them out.")
            -- give item????
            setPlayerStorageValue(cid, storage, 1)
        else
            doPlayerSendTextMessage(cid,22,"It is empty.")
        end
        return true
    end

    if(isInArray(HOLES, itemEx.itemid)) then
        if(itemEx.itemid ~= 8579) then
            itemEx.itemid = itemEx.itemid + 1
        else
            itemEx.itemid = 8585
        end

        doTransformItem(itemEx.uid, itemEx.itemid)
        doDecayItem(itemEx.uid)
        return true
    elseif(SAND_HOLES[itemEx.itemid] ~= nil) then
        doSendMagicEffect(toPosition, CONST_ME_POFF)
        doTransformItem(itemEx.uid, SAND_HOLES[itemEx.itemid])

        doDecayItem(itemEx.uid)
        return true
    elseif(itemEx.itemid == SAND and not isRookie(cid)) then
        local rand = math.random(1, 100)
        if(rand >= 1 and rand <= 5) then
            doCreateItem(ITEM_SCARAB_COIN, 1, toPosition)
        elseif(rand > 85) then
            doCreateMonster("Scarab", toPosition, false)
        end

        doSendMagicEffect(toPosition, CONST_ME_POFF)
        return true
    end

    return false
end
Here you can take mine as example, i realized it wasn't working in OThire 1.0, so i edited it:

Lua:
local TILE_SAND = 231
local ITEM_SCARAB_COIN = 2159
local TUMB_ENTRANCE = 25001
local SCARAB_TILE = 25002
local SAND_HOLE = 489
local FIELDS = {1487,1488,1489,1490,1491,1492,1493,1494,1495,1496,1500,1501,1502,1503,1504}
local duration = 5 * 60000 -- 5 minutes

local function __resetTile__(parameters)
    local thing = getTileItemById(parameters.pos, TILE_SAND)
    doSetItemActionId(thing.uid, SCARAB_TILE)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
local holePos = {x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = 0}
local hole = getThingfromPos(holePos)
local blockingItem = getThingfromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = 255})

if (isInArray(POOLS, itemEx.itemid) and (isInArray(CLOSED_HOLE, hole.itemid))) then
        for i = 1, #POOLS do
        local pool = getTileItemById(toPosition, POOLS[i]).uid
        if pool > 0 then
            doRemoveItem(pool,1)
        end
    end
end
    if (isInArray(CLOSED_HOLE, hole.itemid) and not (blockingItem.itemid > 0 or isCreature(blockingItem.uid) or isInArray(FIELDS, itemEx.itemid))) then
        doTransformItem(hole.uid, hole.itemid + 1)
    elseif (hole.itemid == TILE_SAND and not (blockingItem.itemid > 0 or isCreature(blockingItem.uid))) then
        if (hole.actionid == TUMB_ENTRANCE) then
            if (math.random(1, 5) == 1) then
             for i = 1, #POOLS do
        local pool = getTileItemById(toPosition, POOLS[i]).uid
        if pool > 0 then
            doRemoveItem(pool,1)
        end
    end
                doTransformItem(hole.uid, SAND_HOLE)
                if hole.actionid ~= 0 then
                    doSetItemActionId(hole.uid, hole.actionid)
                end
            end
            doDecayItem(hole.uid)
        elseif (hole.actionid == SCARAB_TILE and not (blockingItem.itemid > 0 or isCreature(blockingItem.uid))) then
            addEvent(__resetTile__, 30*60000, {pos = toPosition})
            doSetItemActionId(hole.uid, 101)
            if (math.random(1, 20) == 1) then
                doCreateItem(ITEM_SCARAB_COIN, toPosition)
            else
                doSummonCreature("Scarab", toPosition)
            end
        end
        doSendMagicEffect(toPosition, CONST_ME_POFF)
    else
        return false
    end
    doDecayItem(hole.uid)
    return true
end

 
Last edited:
OP
OP
sabodden

sabodden

Member
Joined
Sep 27, 2019
Messages
138
Reaction score
17
Here you can take mine as example, i realized it wasn't working in OThire 1.0, so i edited it:

Lua:
local TILE_SAND = 231
local ITEM_SCARAB_COIN = 2159
local TUMB_ENTRANCE = 25001
local SCARAB_TILE = 25002
local SAND_HOLE = 489
local FIELDS = {1487,1488,1489,1490,1491,1492,1493,1494,1495,1496,1500,1501,1502,1503,1504}
local duration = 5 * 60000 -- 5 minutes

local function __resetTile__(parameters)
    local thing = getTileItemById(parameters.pos, TILE_SAND)
    doSetItemActionId(thing.uid, SCARAB_TILE)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
local holePos = {x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = 0}
local hole = getThingfromPos(holePos)
local blockingItem = getThingfromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = 255})

if (isInArray(POOLS, itemEx.itemid) and (isInArray(CLOSED_HOLE, hole.itemid))) then
        for i = 1, #POOLS do
        local pool = getTileItemById(toPosition, POOLS[i]).uid
        if pool > 0 then
            doRemoveItem(pool,1)
        end
    end
end
    if (isInArray(CLOSED_HOLE, hole.itemid) and not (blockingItem.itemid > 0 or isCreature(blockingItem.uid) or isInArray(FIELDS, itemEx.itemid))) then
        doTransformItem(hole.uid, hole.itemid + 1)
    elseif (hole.itemid == TILE_SAND and not (blockingItem.itemid > 0 or isCreature(blockingItem.uid))) then
        if (hole.actionid == TUMB_ENTRANCE) then
            if (math.random(1, 5) == 1) then
             for i = 1, #POOLS do
        local pool = getTileItemById(toPosition, POOLS[i]).uid
        if pool > 0 then
            doRemoveItem(pool,1)
        end
    end
                doTransformItem(hole.uid, SAND_HOLE)
                if hole.actionid ~= 0 then
                    doSetItemActionId(hole.uid, hole.actionid)
                end
            end
            doDecayItem(hole.uid)
        elseif (hole.actionid == SCARAB_TILE and not (blockingItem.itemid > 0 or isCreature(blockingItem.uid))) then
            addEvent(__resetTile__, 30*60000, {pos = toPosition})
            doSetItemActionId(hole.uid, 101)
            if (math.random(1, 20) == 1) then
                doCreateItem(ITEM_SCARAB_COIN, toPosition)
            else
                doSummonCreature("Scarab", toPosition)
            end
        end
        doSendMagicEffect(toPosition, CONST_ME_POFF)
    else
        return false
    end
    doDecayItem(hole.uid)
    return true
end


Lol, amazing... Thank you!

What if i want to remove the dead rat, gold coins...
Everything so players cant block the hole

Only with some items (mws/fire field,energy field...)
local blockable_field_items = {1497, 1499, 1496, 1495, 1492, 1493, 1494}
 

Terotrificy

Well-Known Member
Joined
Oct 18, 2020
Messages
238
Solutions
9
Reaction score
75
Location
Santiago, Chile.
Lol, amazing... Thank you!

What if i want to remove the dead rat, gold coins...
Everything so players cant block the hole

Only with some items (mws/fire field,energy field...)
local blockable_field_items = {1497, 1499, 1496, 1495, 1492, 1493, 1494}
Then you should remove the checkings for items, this line:

Lua:
if (isInArray(CLOSED_HOLE, hole.itemid) and not (blockingItem.itemid > 0 or isCreature(blockingItem.uid) or isInArray(FIELDS, itemEx.itemid))) then

To this:

Code:
    if (isInArray(CLOSED_HOLE, hole.itemid) and not (isCreature(blockingItem.uid) or isInArray(FIELDS, itemEx.itemid))) then

And also move them down when the hole opens:

add this variables:
local holepositionup = {x = toPosition.x, y = toPosition.y, z = toPosition.z}
local holepositiondown = {x=holepositionup .x, y=holepositionup .y, z=holepositionup .z+1}
and then add this to the code
doRelocate(holepositionup ,holepositiondown )

Something like this:

Lua:
local TILE_SAND = 231
local ITEM_SCARAB_COIN = 2159
local TUMB_ENTRANCE = 25001
local SCARAB_TILE = 25002
local SAND_HOLE = 489
local FIELDS = {1487,1488,1489,1490,1491,1492,1493,1494,1495,1496,1500,1501,1502,1503,1504}
local duration = 5 * 60000 -- 5 minutes

local function __resetTile__(parameters)
    local thing = getTileItemById(parameters.pos, TILE_SAND)
    doSetItemActionId(thing.uid, SCARAB_TILE)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
local holePos = {x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = 0}
local hole = getThingfromPos(holePos)
local blockingItem = getThingfromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = 255})
local holepositionup = {x = toPosition.x, y = toPosition.y, z = toPosition.z}
local holepositiondown = {x=holepositionup .x, y=holepositionup .y, z=holepositionup .z+1}
if (isInArray(POOLS, itemEx.itemid) and (isInArray(CLOSED_HOLE, hole.itemid))) then
        for i = 1, #POOLS do
        local pool = getTileItemById(toPosition, POOLS[i]).uid
        if pool > 0 then
            doRemoveItem(pool,1)
        end
    end
end
    if (isInArray(CLOSED_HOLE, hole.itemid) and not (isCreature(blockingItem.uid) or isInArray(FIELDS, itemEx.itemid))) then
        doRelocate(holepositionup ,holepositiondown )
        doTransformItem(hole.uid, hole.itemid + 1)
    elseif (hole.itemid == TILE_SAND and not (blockingItem.itemid > 0 or isCreature(blockingItem.uid))) then
        if (hole.actionid == TUMB_ENTRANCE) then
            if (math.random(1, 5) == 1) then
             for i = 1, #POOLS do
        local pool = getTileItemById(toPosition, POOLS[i]).uid
        if pool > 0 then
            doRemoveItem(pool,1)
        end
    end
                doTransformItem(hole.uid, SAND_HOLE)
                if hole.actionid ~= 0 then
                    doSetItemActionId(hole.uid, hole.actionid)
                end
            end
            doDecayItem(hole.uid)
        elseif (hole.actionid == SCARAB_TILE and not (blockingItem.itemid > 0 or isCreature(blockingItem.uid))) then
            addEvent(__resetTile__, 30*60000, {pos = toPosition})
            doSetItemActionId(hole.uid, 101)
            if (math.random(1, 20) == 1) then
                doCreateItem(ITEM_SCARAB_COIN, toPosition)
            else
                doSummonCreature("Scarab", toPosition)
            end
        end
        doSendMagicEffect(toPosition, CONST_ME_POFF)
    else
        return false
    end
    doDecayItem(hole.uid)
    return true
end
Post automatically merged:

You would better off making it so items can't be thrown on rope spots
He don't want to have items blocking loose stone piles either
 
Solution

zabuzo

Well-Known Member
Joined
Jun 10, 2016
Messages
237
Reaction score
54
Then you should remove the checkings for items, this line:

Lua:
if (isInArray(CLOSED_HOLE, hole.itemid) and not (blockingItem.itemid > 0 or isCreature(blockingItem.uid) or isInArray(FIELDS, itemEx.itemid))) then

To this:

Code:
    if (isInArray(CLOSED_HOLE, hole.itemid) and not (isCreature(blockingItem.uid) or isInArray(FIELDS, itemEx.itemid))) then

And also move them down when the hole opens:

add this variables:
local holepositionup = {x = toPosition.x, y = toPosition.y, z = toPosition.z}
local holepositiondown = {x=holepositionup .x, y=holepositionup .y, z=holepositionup .z+1}
and then add this to the code
doRelocate(holepositionup ,holepositiondown )

Something like this:

Lua:
local TILE_SAND = 231
local ITEM_SCARAB_COIN = 2159
local TUMB_ENTRANCE = 25001
local SCARAB_TILE = 25002
local SAND_HOLE = 489
local FIELDS = {1487,1488,1489,1490,1491,1492,1493,1494,1495,1496,1500,1501,1502,1503,1504}
local duration = 5 * 60000 -- 5 minutes

local function __resetTile__(parameters)
    local thing = getTileItemById(parameters.pos, TILE_SAND)
    doSetItemActionId(thing.uid, SCARAB_TILE)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
local holePos = {x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = 0}
local hole = getThingfromPos(holePos)
local blockingItem = getThingfromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = 255})
local holepositionup = {x = toPosition.x, y = toPosition.y, z = toPosition.z}
local holepositiondown = {x=holepositionup .x, y=holepositionup .y, z=holepositionup .z+1}
if (isInArray(POOLS, itemEx.itemid) and (isInArray(CLOSED_HOLE, hole.itemid))) then
        for i = 1, #POOLS do
        local pool = getTileItemById(toPosition, POOLS[i]).uid
        if pool > 0 then
            doRemoveItem(pool,1)
        end
    end
end
    if (isInArray(CLOSED_HOLE, hole.itemid) and not (isCreature(blockingItem.uid) or isInArray(FIELDS, itemEx.itemid))) then
        doRelocate(holepositionup ,holepositiondown )
        doTransformItem(hole.uid, hole.itemid + 1)
    elseif (hole.itemid == TILE_SAND and not (blockingItem.itemid > 0 or isCreature(blockingItem.uid))) then
        if (hole.actionid == TUMB_ENTRANCE) then
            if (math.random(1, 5) == 1) then
             for i = 1, #POOLS do
        local pool = getTileItemById(toPosition, POOLS[i]).uid
        if pool > 0 then
            doRemoveItem(pool,1)
        end
    end
                doTransformItem(hole.uid, SAND_HOLE)
                if hole.actionid ~= 0 then
                    doSetItemActionId(hole.uid, hole.actionid)
                end
            end
            doDecayItem(hole.uid)
        elseif (hole.actionid == SCARAB_TILE and not (blockingItem.itemid > 0 or isCreature(blockingItem.uid))) then
            addEvent(__resetTile__, 30*60000, {pos = toPosition})
            doSetItemActionId(hole.uid, 101)
            if (math.random(1, 20) == 1) then
                doCreateItem(ITEM_SCARAB_COIN, toPosition)
            else
                doSummonCreature("Scarab", toPosition)
            end
        end
        doSendMagicEffect(toPosition, CONST_ME_POFF)
    else
        return false
    end
    doDecayItem(hole.uid)
    return true
end
Post automatically merged:


He don't want to have items blocking loose stone piles either

it couldn't lag/crash the server if anybody trash a lot one tile?
 

Terotrificy

Well-Known Member
Joined
Oct 18, 2020
Messages
238
Solutions
9
Reaction score
75
Location
Santiago, Chile.
it couldn't lag/crash the server if anybody trash a lot one tile?
Mmmm i don't think so, back in 7.4 you could trash a lot of items above closed pitfalls and everything went down when you walked in, but i'm gonna test it now.

Just tested it, with around 300+ items, nothing happened.
 

zabuzo

Well-Known Member
Joined
Jun 10, 2016
Messages
237
Reaction score
54
Mmmm i don't think so, back in 7.4 you could trash a lot of items above closed pitfalls and everything went down when you walked in, but i'm gonna test it now.

Just tested it, with around 300+ items, nothing happened.

I'm scare because i want to use it in my server 8.6
And a motherfucker can turn on elfbot on the hole with anti push all day
And then open the hole, imagine how many trash it can move...
 
Last edited:

Terotrificy

Well-Known Member
Joined
Oct 18, 2020
Messages
238
Solutions
9
Reaction score
75
Location
Santiago, Chile.
I'm scare because i want to use it in my server 8.6
And a motherfucker can turn on elfbot on the hole with anti push all day
And then open the hole, imagine how many trash it can move...
You should be able to set the max amount of items in a tile in your config files i think, i managed to make the maximun amount of items above the pitfall before go down with 2k items to the rope hole, and didn't even lagged a bit lol.
 

zabuzo

Well-Known Member
Joined
Jun 10, 2016
Messages
237
Reaction score
54
Btw i want to use the blood part, i got the same problem here,
I tried:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

    if itemEx.actionid == 45001 then
        local storage = 51006
        queststatus = getPlayerStorageValue(cid, storage)
        if queststatus == -1 then
            doPlayerSendTextMessage(cid, 22, "You have found an ancient amulet. Strange engravings cover it. Maybe Morris can make them out.")
            -- give item????
            setPlayerStorageValue(cid, storage, 1)
        else
            doPlayerSendTextMessage(cid,22,"It is empty.")
        end
        return true
    end

    if (isInArray(POOLS, itemEx.itemid) and (isInArray(CLOSED_HOLE, hole.itemid))) then
            for i = 1, #POOLS do
            local pool = getTileItemById(toPosition, POOLS[i]).uid
            if pool > 0 then
                doRemoveItem(pool,1)
            end
        end
    end

    if(isInArray(HOLES, itemEx.itemid)) then
        if(itemEx.itemid ~= 8579) then
            itemEx.itemid = itemEx.itemid + 1
        else
            itemEx.itemid = 8585
        end

        doTransformItem(itemEx.uid, itemEx.itemid)
        doDecayItem(itemEx.uid)
        return true
    elseif(SAND_HOLES[itemEx.itemid] ~= nil) then
        doSendMagicEffect(toPosition, CONST_ME_POFF)
        doTransformItem(itemEx.uid, SAND_HOLES[itemEx.itemid])

        doDecayItem(itemEx.uid)
        return true
    elseif(itemEx.itemid == SAND and not isRookie(cid)) then
        local rand = math.random(1, 100)
        if(rand >= 1 and rand <= 5) then
            doCreateItem(ITEM_SCARAB_COIN, 1, toPosition)
        elseif(rand > 85) then
            doCreateMonster("Scarab", toPosition, false)
        end

        doSendMagicEffect(toPosition, CONST_ME_POFF)
        return true
    end

    return false
end


But simple don't work, no errors but same old problem
Do u know why?
 

Terotrificy

Well-Known Member
Joined
Oct 18, 2020
Messages
238
Solutions
9
Reaction score
75
Location
Santiago, Chile.
Btw i want to use the blood part, i got the same problem here,
I tried:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

    if itemEx.actionid == 45001 then
        local storage = 51006
        queststatus = getPlayerStorageValue(cid, storage)
        if queststatus == -1 then
            doPlayerSendTextMessage(cid, 22, "You have found an ancient amulet. Strange engravings cover it. Maybe Morris can make them out.")
            -- give item????
            setPlayerStorageValue(cid, storage, 1)
        else
            doPlayerSendTextMessage(cid,22,"It is empty.")
        end
        return true
    end

    if (isInArray(POOLS, itemEx.itemid) and (isInArray(CLOSED_HOLE, hole.itemid))) then
            for i = 1, #POOLS do
            local pool = getTileItemById(toPosition, POOLS[i]).uid
            if pool > 0 then
                doRemoveItem(pool,1)
            end
        end
    end

    if(isInArray(HOLES, itemEx.itemid)) then
        if(itemEx.itemid ~= 8579) then
            itemEx.itemid = itemEx.itemid + 1
        else
            itemEx.itemid = 8585
        end

        doTransformItem(itemEx.uid, itemEx.itemid)
        doDecayItem(itemEx.uid)
        return true
    elseif(SAND_HOLES[itemEx.itemid] ~= nil) then
        doSendMagicEffect(toPosition, CONST_ME_POFF)
        doTransformItem(itemEx.uid, SAND_HOLES[itemEx.itemid])

        doDecayItem(itemEx.uid)
        return true
    elseif(itemEx.itemid == SAND and not isRookie(cid)) then
        local rand = math.random(1, 100)
        if(rand >= 1 and rand <= 5) then
            doCreateItem(ITEM_SCARAB_COIN, 1, toPosition)
        elseif(rand > 85) then
            doCreateMonster("Scarab", toPosition, false)
        end

        doSendMagicEffect(toPosition, CONST_ME_POFF)
        return true
    end

    return false
end


But simple don't work, no errors but same old problem
Do u know why?
did you check if you have POOLS array correctly? maybe it have different name or is not global, you might aswell add it as a local variable to your script.
 

zabuzo

Well-Known Member
Joined
Jun 10, 2016
Messages
237
Reaction score
54

Terotrificy

Well-Known Member
Joined
Oct 18, 2020
Messages
238
Solutions
9
Reaction score
75
Location
Santiago, Chile.

Xikini

I whore myself out for likes
Support Team
Joined
Nov 17, 2010
Messages
5,612
Solutions
395
Reaction score
3,731
It wouldn't be a perfectly 'clean' solution, but to solve the potential crashing issue, you could move 100 items at a time on an addEvent timer every 50 milliseconds until they all fall down.

In the rare circumstance that someone goes through the effort of trashing the hole, they'll see the mechanism in place to prevent the crashing, and probably 99.9% of players won't even know the anti-crash solution exists, cuz they'll only put like 10 items on the hole, and immediately see them all fall, and assume there is no limit of items by default.
 
OP
OP
sabodden

sabodden

Member
Joined
Sep 27, 2019
Messages
138
Reaction score
17
Then you should remove the checkings for items, this line:

Lua:
if (isInArray(CLOSED_HOLE, hole.itemid) and not (blockingItem.itemid > 0 or isCreature(blockingItem.uid) or isInArray(FIELDS, itemEx.itemid))) then

To this:

Code:
    if (isInArray(CLOSED_HOLE, hole.itemid) and not (isCreature(blockingItem.uid) or isInArray(FIELDS, itemEx.itemid))) then

And also move them down when the hole opens:

add this variables:
local holepositionup = {x = toPosition.x, y = toPosition.y, z = toPosition.z}
local holepositiondown = {x=holepositionup .x, y=holepositionup .y, z=holepositionup .z+1}
and then add this to the code
doRelocate(holepositionup ,holepositiondown )

Something like this:

Lua:
local TILE_SAND = 231
local ITEM_SCARAB_COIN = 2159
local TUMB_ENTRANCE = 25001
local SCARAB_TILE = 25002
local SAND_HOLE = 489
local FIELDS = {1487,1488,1489,1490,1491,1492,1493,1494,1495,1496,1500,1501,1502,1503,1504}
local duration = 5 * 60000 -- 5 minutes

local function __resetTile__(parameters)
    local thing = getTileItemById(parameters.pos, TILE_SAND)
    doSetItemActionId(thing.uid, SCARAB_TILE)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
local holePos = {x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = 0}
local hole = getThingfromPos(holePos)
local blockingItem = getThingfromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = 255})
local holepositionup = {x = toPosition.x, y = toPosition.y, z = toPosition.z}
local holepositiondown = {x=holepositionup .x, y=holepositionup .y, z=holepositionup .z+1}
if (isInArray(POOLS, itemEx.itemid) and (isInArray(CLOSED_HOLE, hole.itemid))) then
        for i = 1, #POOLS do
        local pool = getTileItemById(toPosition, POOLS[i]).uid
        if pool > 0 then
            doRemoveItem(pool,1)
        end
    end
end
    if (isInArray(CLOSED_HOLE, hole.itemid) and not (isCreature(blockingItem.uid) or isInArray(FIELDS, itemEx.itemid))) then
        doRelocate(holepositionup ,holepositiondown )
        doTransformItem(hole.uid, hole.itemid + 1)
    elseif (hole.itemid == TILE_SAND and not (blockingItem.itemid > 0 or isCreature(blockingItem.uid))) then
        if (hole.actionid == TUMB_ENTRANCE) then
            if (math.random(1, 5) == 1) then
             for i = 1, #POOLS do
        local pool = getTileItemById(toPosition, POOLS[i]).uid
        if pool > 0 then
            doRemoveItem(pool,1)
        end
    end
                doTransformItem(hole.uid, SAND_HOLE)
                if hole.actionid ~= 0 then
                    doSetItemActionId(hole.uid, hole.actionid)
                end
            end
            doDecayItem(hole.uid)
        elseif (hole.actionid == SCARAB_TILE and not (blockingItem.itemid > 0 or isCreature(blockingItem.uid))) then
            addEvent(__resetTile__, 30*60000, {pos = toPosition})
            doSetItemActionId(hole.uid, 101)
            if (math.random(1, 20) == 1) then
                doCreateItem(ITEM_SCARAB_COIN, toPosition)
            else
                doSummonCreature("Scarab", toPosition)
            end
        end
        doSendMagicEffect(toPosition, CONST_ME_POFF)
    else
        return false
    end
    doDecayItem(hole.uid)
    return true
end
Post automatically merged:


He don't want to have items blocking loose stone piles either

amazing @Terotrificy

whats the part that move the item downstairs?
 
Top