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

Hole id 392

Jfrye

Mapper, trying to learn scripting
Joined
Jan 8, 2009
Messages
365
Solutions
5
Reaction score
86
Location
Mexico Missouri
Hey again. Im using TFS 1.1, client 10.77.

Now I seem to be having an issue with hole id 392.

Code:
<item id="392" article="a" name="hole">
        <attribute key="decayTo" value="354" />
        <attribute key="duration" value="1" />
        <attribute key="floorchange" value="down" />
</item>

It does not matter what value i set for duration, the hole does not want to close. It is a hidden hole, in which you have to use a pick to open it. so the normal ground tile has aid 777.

Script used to open the hole.
Code:
local aID = 777 
local ticks = 30
local GRASS = {4526, 4527, 4528, 4529, 4530, 4531, 4532, 4533, 4534, 4535, 4536, 4537, 4538, 4529, 4540, 4541, 4567, 4568, 4569, 4756} 
local DIRT = {351, 352, 353, 354, 355} 
local SNOW = {671, 6683, 6684, 6685, 6686, 7002} 
 
function onUse(cid, item, fromPosition, itemEx, toPosition) 
local toPositions = {x=toPosition.x, y=toPosition.y, z=toPosition.z, stackpos=0} 
 
    if itemEx.actionid == aID then 
        if isInArray(GRASS, itemEx.itemid) then 
            doTransformItem(itemEx.uid,470) 
            doDecayItemTo(toPositions, itemEx.itemid, ticks) 
        elseif isInArray(DIRT, itemEx.itemid) then 
            doTransformItem(itemEx.uid,392) 
            doDecayItemTo(toPositions, itemEx.itemid, ticks) 
        elseif itemEx.itemid == 231 then 
            doTransformItem(itemEx.uid,482) 
            doDecayItemTo(toPositions, itemEx.itemid, ticks) 
        elseif isInArray(SNOW, itemEx.itemid) then 
            doTransformItem(itemEx.uid,485) 
            doDecayItemTo(toPositions, itemEx.itemid, ticks) 
        else 
            doCreateItem(3324, 1, toPosition) 
            doDecayItemTo({x=toPosition.x, y=toPosition.y, z=toPosition.z, stackpos=1}, 0, ticks) 
        end 
    elseif itemEx.itemid == 7200 then 
        doTransformItem(itemEx.uid,7236) 
    end 
    return true 
end

I even tried changing the ticks from 30 to 1 at the top of the script, and that does nothing either.

Code:
<item id="294" article="a" name="pitfall">
        <attribute key="floorchange" value="down" />
        <attribute key="decayTo" value="293" />
        <attribute key="duration" value="6" />
</item>
This duration on this pitfall works great. Value was changed to 6 for testing purposes. Anyone have any idea why the hole with id 392 is giving me issues?
 
Did you try using meta method instead?

for instance:
Lua:
function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
    if (itemEx.uid <= 65535 or itemEx.actionid > 0) and (itemEx.itemid == 354 or itemEx.itemid == 355) then
        itemEx:transform(392)
        itemEx:decay()
        toPosition:sendMagicEffect(CONST_ME_POFF)
        return true
    end
return false
end
 
Lua:
local aID = 777
local ticks = 30
local GRASS = {4526, 4527, 4528, 4529, 4530, 4531, 4532, 4533, 4534, 4535, 4536, 4537, 4538, 4529, 4540, 4541, 4567, 4568, 4569, 4756}
local DIRT = {351, 352, 353, 354, 355}
local SNOW = {671, 6683, 6684, 6685, 6686, 7002}

function onUse(cid, item, fromPosition, itemEx, toPosition)
local toPositions = {x=toPosition.x, y=toPosition.y, z=toPosition.z, stackpos=0}

    if itemEx.actionid == aID then
        if isInArray(GRASS, itemEx.itemid) then
            ITEM = itemEx.uid
            itemid = itemEx.itemid
            doTransformItem(itemEx.uid,470)
           addEvent(decayItem, ticks * 1000, ITEM, itemid)
        elseif isInArray(DIRT, itemEx.itemid) then
            ITEM = itemEx.uid
            itemid = itemEx.itemid
            doTransformItem(itemEx.uid,392)
            addEvent(decayItem, ticks * 1000, ITEM, itemid)
        elseif itemEx.itemid == 231 then
            ITEM = itemEx.uid
            itemid = itemEx.itemid
            doTransformItem(itemEx.uid,482)
            addEvent(decayItem, ticks * 1000, ITEM, itemid)
        elseif isInArray(SNOW, itemEx.itemid) then
            ITEM = itemEx.uid
            itemid = itemEx.itemid
            doTransformItem(itemEx.uid,485)
            addEvent(decayItem, ticks * 1000, ITEM, itemid)
        else
            doCreateItem(3324, 1, toPosition)
            doDecayItemTo({x=toPosition.x, y=toPosition.y, z=toPosition.z, stackpos=1}, 0, ticks)
        end
    elseif itemEx.itemid == 7200 then
        doTransformItem(itemEx.uid,7236)
    end
    return true
end

function decayItem(ITEM, itemid)
    if ITEM then
        doTransformItem(ITEM, itemid)     
    end
end
 
like apollos mentioned, you have to use the :decay() method to start the process of decaying on any item
 
Lua:
local aID = 777
local ticks = 30
local GRASS = {4526, 4527, 4528, 4529, 4530, 4531, 4532, 4533, 4534, 4535, 4536, 4537, 4538, 4529, 4540, 4541, 4567, 4568, 4569, 4756}
local DIRT = {351, 352, 353, 354, 355}
local SNOW = {671, 6683, 6684, 6685, 6686, 7002}

function onUse(cid, item, fromPosition, itemEx, toPosition)
local toPositions = {x=toPosition.x, y=toPosition.y, z=toPosition.z, stackpos=0}

    if itemEx.actionid == aID then
        if isInArray(GRASS, itemEx.itemid) then
            ITEM = itemEx.uid
            itemid = itemEx.itemid
            doTransformItem(itemEx.uid,470)
           addEvent(decayItem, ticks * 1000, ITEM, itemid)
        elseif isInArray(DIRT, itemEx.itemid) then
            ITEM = itemEx.uid
            itemid = itemEx.itemid
            doTransformItem(itemEx.uid,392)
            addEvent(decayItem, ticks * 1000, ITEM, itemid)
        elseif itemEx.itemid == 231 then
            ITEM = itemEx.uid
            itemid = itemEx.itemid
            doTransformItem(itemEx.uid,482)
            addEvent(decayItem, ticks * 1000, ITEM, itemid)
        elseif isInArray(SNOW, itemEx.itemid) then
            ITEM = itemEx.uid
            itemid = itemEx.itemid
            doTransformItem(itemEx.uid,485)
            addEvent(decayItem, ticks * 1000, ITEM, itemid)
        else
            doCreateItem(3324, 1, toPosition)
            doDecayItemTo({x=toPosition.x, y=toPosition.y, z=toPosition.z, stackpos=1}, 0, ticks)
        end
    elseif itemEx.itemid == 7200 then
        doTransformItem(itemEx.uid,7236)
    end
    return true
end

function decayItem(ITEM, itemid)
    if ITEM then
        doTransformItem(ITEM, itemid)    
    end
end

This unfortunately does not work either :(
 
Did you try using meta method instead?

for instance:
Lua:
function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
    if (itemEx.uid <= 65535 or itemEx.actionid > 0) and (itemEx.itemid == 354 or itemEx.itemid == 355) then
        itemEx:transform(392)
        itemEx:decay()
        toPosition:sendMagicEffect(CONST_ME_POFF)
        return true
    end
return false
end

This fixed my problem. Thanks
 
Back
Top