• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua PoI Last Door OTX 2.5- doors doesn't work

dex93

New Member
Joined
May 31, 2015
Messages
57
Reaction score
3
Hi,
I'm trying to fix this about a hour but I can't do this by my self.
This is code for AllThrones:

LUA:
function onStepIn(cid, item, pos)
    if item.uid == 10274 then
        if getPlayerStorageValue(cid,10274) == -1 then
            setPlayerStorageValue(cid,10274,1)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have touched Verminor´s throne and absorbed some of his spirit.')
        else
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have already absorbed some of Veminor´s spirit.')
        end
    elseif item.uid == 10275 then
        if getPlayerStorageValue(cid,10275) == -1 then
            setPlayerStorageValue(cid,10275,1)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have touched Infernatil´s throne and absorbed some of his spirit.')
        else
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have already absorbed some of Infernatil´s spirit.')
        end
    elseif item.uid == 10276 then
        if getPlayerStorageValue(cid,10276) == -1 then
            setPlayerStorageValue(cid,10276,1)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have touched Tafariel´s throne and absorbed some of his spirit.')
        else
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have already absorbed some of Tafariel´s spirit.')
        end
    elseif item.uid == 10277 then
        if getPlayerStorageValue(cid,10277) == -1 then
            setPlayerStorageValue(cid,10277,1)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have touched Apocalypse´s throne and absorbed some of his spirit.')
        else
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have already absorbed some of Apocalypse´s spirit.')
        end
    elseif item.uid == 10278 then
        if getPlayerStorageValue(cid,10278) == -1 then
            setPlayerStorageValue(cid,10278,1)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have touched Pumin´s throne and absorbed some of his spirit.')
        else
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have already absorbed some of Pumin´s spirit.')
        end
    elseif item.uid == 10279 then
        if getPlayerStorageValue(cid,10279) == -1 then
            setPlayerStorageValue(cid,10279,1)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have touched Bazir´s throne and absorbed some of his spirit.')
        else
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have already absorbed some of Bazir´s spirit.')
        end
    elseif item.uid == 10280 then
        if getPlayerStorageValue(cid,10280) == -1 then
            setPlayerStorageValue(cid,10280,1)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have touched Ashfalor´s throne and absorbed some of his spirit.')
        else
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have already absorbed some of Ashfalor´s spirit.')
        end
    elseif item.uid == 10281 and item.itemid == 1223 and pos == {x=5372, y=5484, z=5} then
        if getPlayerStorageValue(cid,10274) == -1 or getPlayerStorageValue(cid,10275) == -1 or getPlayerStorageValue(cid,10276) == -1 or getPlayerStorageValue(cid,10277) == -1 or getPlayerStorageValue(cid,10278) == -1 then
            doTransformItem(item.uid,item.itemid+1)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'Sorry, but you did not absorb enough energy!')
        else
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You absorbed enough energy! You may pass.')
        end
    end
    return 1
end

I did double check storage of thrones in this file:
poi_last.lua



LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local charpos = getPlayerPosition(cid)
    if item.uid == 10281 and charpos.x == 5573 and (charpos.y == 5484 or charpos.y == 5483) and charpos.z == 5 then
        if getPlayerStorageValue(cid,10274) == -1 or getPlayerStorageValue(cid,10275) == -1 or getPlayerStorageValue(cid,10276) == -1 or getPlayerStorageValue(cid,10277) == -1 or getPlayerStorageValue(cid,10278) == -1 or getPlayerStorageValue(cid,10279) == -1 or getPlayerStorageValue(cid,10280) == -1 then
        doPlayerSendTextMessage(cid,25,"You did not absorb enough energy!")
        else
        local newPos = {x=5573, y=5484, z=5}
        doTeleportThing(cid, newPos)
        doSendMagicEffect(newPos, 10)
        end
    elseif item.uid == 10281 and charpos.x == 5571 and (charpos.y == 5484 or charpos.y == 5485) and charpos.z == 5 then
        local newPos = {x=5575, y=5484, z=5}
        doSendMagicEffect(getPlayerPosition(cid), 2)
        doTeleportThing(cid, newPos)
        doSendMagicEffect({x=5575, y=5484, z=5}, 10)
    end
    return TRUE
end


Pos of a door is:
{x=5372, y=5484, z=5}
a tile on the right is:
{x = 5373, y = 5484, z = 5}
and tile on the left is:
{x = 5371, y = 5484, z = 5}


I don't have any errors in console.
after done all thrones (touched them) when I'm trying to use the door (last_poi) with uid:
10:46 You see a closed door.
ItemID: [1223], UniqueID: [10281].
Position: [X: 5372] [Y: 5484] [Z: 5].
nothing happen.

In actions.xml I have this:
<action uniqueid="10281" event="script" value="doors/poi_last.lua"/>
and in movements.lua:
<movevent event="StepIn" itemid="5915" script="PitsOfInferno/AllThrones.lua" />
<movevent event="StepIn" itemid="5916" script="PitsOfInferno/AllThrones.lua" />

My PoI is only with the sales, thrones and room with rewards.
No holy tibia, no vial, no blood etc.

distro OTX 2.5 for 8.6 tibia
 
Solution
Forgot the door script. Why the f* not make it as a regular door? Haven't tested this one either:

LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
 
    local t, p = {10274,10275,10276,10277,10278,10279,10280}, {{x=5573, y=5484, z=5}, {x=5575, y=5484, z=5}}
    local r = false
    for _, v in ipairs(t) do
        if getPlayerStorageValue(cid, v) ~= -1 then
            r = true
        end
    end
 
    if not r then
        return doPlayerSendTextMessage(cid, 25, "You did not absorb enough energy!")
    end
 
    local Thing, Player = getThingPos(item.uid), getThingPos(cid)
    local n = Thing.x < Player.x and p[1] or p[2]
    doSendMagicEffect(Player, 2)
    if doTeleportThing(cid, n) then
        doSendMagicEffect(n...
Have not tested
LUA:
function onStepIn(cid, item, topos, frompos)
 
    local t = {
        [10274] = {name = "Verminor´s"},
        [10275] = {name = "Infernatil´s"},
        [10276] = {name = "Tafariel´s"},
        [10277] = {name = "Apocalypse´s"},
        [10278] = {name = "Pumin´s"},
        [10279] = {name = "Bazir´s"},
        [10280] = {name = "Ashfalor´s"},   
    }   
 
    if item.uid == 10281 then
        local ret = false
        for _, v in ipairs(t) do
            if getPlayerStorageValue(cid, v) ~= -1 then
                ret = true
            end
        end
   
        if ret then
            doTransformItem(item.uid,item.itemid+1)
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You absorbed enough energy! You may pass.")
        else
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Sorry, but you did not absorb enough energy!")
        end
        return
    end
   
    local n = t[item.uid]
    if n ~= nil then
        if getPlayerStorageValue(cid, item.uid) ~= -1 then
            return doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE,  "You have already absorbed some of ".. n.name .." spirit.")
        end
        setPlayerStorageValue(cid, item.uid, 1)
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE,  "You have touched ".. n.name .." throne and absorbed some of his spirit.")
    end
 
    return true
end
 
Last edited:
Have not tested
LUA:
function onStepIn(cid, item, pos)
  
    local t = {
        [10274] = {name = "Verminor´s"},
        [10275] = {name = "Infernatil´s"},
        [10276] = {name = "Tafariel´s"},
        [10277] = {name = "Apocalypse´s"},
        [10278] = {name = "Pumin´s"},
        [10279] = {name = "Bazir´s"},
        [10280] = {name = "Ashfalor´s"},      
    }      
  
    if item.uid == 10281 then
        local ret = false
        for _, v in ipairs(t) do
            if getPlayerStorageValue(cid, v) ~= -1 then
                ret = true
            end
        end
      
        if ret then
            doTransformItem(item.uid,item.itemid+1)
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You absorbed enough energy! You may pass.")
        else
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Sorry, but you did not absorb enough energy!")
        end
    end
      
    local n = t[item.uid]
    if n ~= nil then
        if getPlayerStorageValue(cid, item.uid) ~= -1 then
            return true, doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE,  "You have already absorbed some of ".. n.name .." spirit.")
        end  
        setPlayerStorageValue(cid, item.uid, 1)
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE,  "You have touched ".. n.name .." throne and absorbed some of his spirit.")
    end
  
    return true
end
still nothing, I tried change last_poi.lua to:

LUA:
function onUse(cid, item, frompos, item2, topos)

item.uid == 10281 and item.itemid == 1223 and pos == {x=5372, y=5484, z=5} then
        if getPlayerStorageValue(cid,10274) == -1 or getPlayerStorageValue(cid,10275) == -1 or getPlayerStorageValue(cid,10276) == -1 or getPlayerStorageValue(cid,10277) == -1 or getPlayerStorageValue(cid,10278) == -1 or getPlayerStorageValue(cid,10279) == -1 or getPlayerStorageValue(cid,10280) == -1 then
            doTransformItem(item.uid,item.itemid+1)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'Sorry, but you did not absorb enough energy!')
        else
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You absorbed enough energy! You may pass.')
        end
    end

and I can use the door but:

12:07 You see a closed door.
ItemID: [1223], UniqueID: [10281].
Position: [X: 5372] [Y: 5484] [Z: 5].
12:07 The door seems to be sealed against unwanted intruders.


I should get info something like You absorbed enough energy! or Sorry, but you did not~.
I'm stucked. :<
 
Forgot the door script. Why the f* not make it as a regular door? Haven't tested this one either:

LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
 
    local t, p = {10274,10275,10276,10277,10278,10279,10280}, {{x=5573, y=5484, z=5}, {x=5575, y=5484, z=5}}
    local r = false
    for _, v in ipairs(t) do
        if getPlayerStorageValue(cid, v) ~= -1 then
            r = true
        end
    end
 
    if not r then
        return doPlayerSendTextMessage(cid, 25, "You did not absorb enough energy!")
    end
 
    local Thing, Player = getThingPos(item.uid), getThingPos(cid)
    local n = Thing.x < Player.x and p[1] or p[2]
    doSendMagicEffect(Player, 2)
    if doTeleportThing(cid, n) then
        doSendMagicEffect(n, 10)
    end
    return true
end
 
Last edited:
Solution
@ond

>>> Loading actions... [Error - LuaInterface::loadFile] data/actions/scripts/doo
rs/poi_last.lua:5: 'do' expected near 'pairs'
[Warning - Event::loadScript] Cannot load script (data/actions/scripts/doors/poi
_last.lua)
data/actions/scripts/doors/poi_last.lua:5: 'do' expected near 'pairs'
(done).


I didn't know your way ^^

btw as you have seen I tried make a script for a normal door with storage above but same doesn't work ;v
 
You must have copied it before I edited my post (I saw myself I forgot the "do") at line 5

Updated the first script, IDK where my brain were at the time, but it seemed I made it as an onStepIn event...
 
Back
Top