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

Solved a nil value

bybbzan

mapper
Joined
Aug 4, 2012
Messages
809
Solutions
2
Reaction score
136
Location
Sweden
SOLVED BY @WibbenZ


SOLUTION

Code:
local function revert(item)
    local spectators = getSpectators({x = 1008, y = 989, z = 8}, 1, 0)
    if spectators ~= nil then
        for i = 1, #spectators do
            local thing = spectators[i]
            if isPlayer(thing) then
                doTeleportThing(thing, {x = 1006, y = 989, z = 8})
            end   
        end
        doSendMagicEffect({x = 1000, y = 989, z = 8}, CONST_ME_POFF)
    end

    for i = 1007, 1009 do
        doRemoveItem(getTileItemById({x = i, y = 989, z = 8}, 1284).uid, 1)
        doCreateItem(598, 1, {x = i, y = 989, z = 8})
    end

    doTransformItem(item.uid, item.itemid - 1)
    doCreateItem(4811, 1, {x = 1007, y = 989, z = 8})
    doCreateItem(4809, 1, {x = 1009, y = 989, z = 8})
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.itemid == 1945 then
        doRemoveItem(getTileItemById({x = 1007, y = 989, z = 8}, 4811).uid, 1)
        doRemoveItem(getTileItemById({x = 1009, y = 989, z = 8}, 4809).uid, 1)
        for i = 1007, 1009 do
            doCreateItem(1284, 1, {x = i, y = 989, z = 8})
        end

        doTransformItem(item.uid, item.itemid + 1)
        doCreatureSay(cid, "You just opened a secret passage!", TALKTYPE_ORANGE_1)
        addEvent(revert, 10 * 1000, getThingfromPos(getThingPos(item.uid)))
    elseif item.itemid == 1946 then
        doPlayerSendCancel(cid, "You can't use this yet.")
    end
    return true
end
 
Last edited:
Okay, i got the script work without errors now.
When i use the lever a message appears "Welcome to the area".
When im standing on the bridge and the bridge disappears, i still get stuck.
@Limos @J.Dre
 
Last edited:
Does your server have the function "doRelocate" listed in luascript.cpp?

I thought you would be able to figure it out by now, but I guess I'll try to write it for you.
 
Does your server have the function "doRelocate" listed in luascript.cpp?

I thought you would be able to figure it out by now, but I guess I'll try to write it for you.

Yea found it here

Code:
    //doRelocate(pos, posTo[, creatures = true])
    //Moves all moveable objects from pos to posTo
    lua_register(m_luaState, "doRelocate", LuaScriptInterface::luaDoRelocate);
I know.. im the beginner of beginners.. thanks for your help.
 
Back
Top