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

getStorage from POI > INQ

Edling

Member
Joined
Mar 1, 2009
Messages
246
Reaction score
11
Hello. I try to fix this since you can make INQ in my server without touching any Throne of POI first which I disslike. I have found this script but I can't get it work proppobly.

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local storages = {10001, 10002, 10003, 10004, 10005, 10006, 10007}
    local fail = FALSE

    for i = 1, #storages do
        if (getPlayerStorageValue(cid, storages[i]) == -1) then
            fail = TRUE
        end
    end

    if (fail == TRUE) then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need to absorb some of pits of infernos spirit first!")
    else
        doTransformItem(item.uid, item.itemid + 1)
        doTeleportThing(cid, fromPosition, TRUE)
    end

    return TRUE
end


Code:
function onStepIn(cid, item, pos)
local nie = {x=32824, y=32231, z=12}
    if item.uid == 10001 then
        if getPlayerStorageValue(cid,10001) == -1 then
            setPlayerStorageValue(cid,10001,1)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have touched Verminor´s throne and absorbed some of his spirit.')
            doSendMagicEffect(getCreaturePosition(cid),20)
        else
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have already absorbed some of Veminor´s spirit.')
            local wal2 = {x=32840, y=32327, z=15}
            doTeleportThing(cid, wal2)
            doSendMagicEffect(wal2,17)
        end
    elseif item.uid == 10002 then
        if getPlayerStorageValue(cid,10002) == -1 then
            setPlayerStorageValue(cid,10002,1)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have touched Infernatil´s throne and absorbed some of his spirit.')
            doSendMagicEffect(getCreaturePosition(cid),15)
        else
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have already absorbed some of Infernatil´s spirit.')
            local wal7 = {x=32909, y=32211, z=15}
            doTeleportThing(cid, wal7)
            doSendMagicEffect(wal7,17)
            end
    elseif item.uid == 10003 then
        if getPlayerStorageValue(cid,10003) == -1 then
            setPlayerStorageValue(cid,10003,1)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have touched Tafariel´s throne and absorbed some of his spirit.')
            doSendMagicEffect(getCreaturePosition(cid),2)
        else
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have already absorbed some of Tafariel´s spirit.')
            local wal3 = {x=32761, y=32243, z=15}
            doTeleportThing(cid, wal3)
            doSendMagicEffect(wal3,17)
        end
    elseif item.uid == 10004 then
        if getPlayerStorageValue(cid,10004) == -1 then
            setPlayerStorageValue(cid,10004,1)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have touched Apocalypse´s throne and absorbed some of his spirit.')
            doSendMagicEffect(getCreaturePosition(cid),4)
        else
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have already absorbed some of Apocalypse´s spirit.')
            local wal4 = {x=32875, y=32267, z=15}
            doTeleportThing(cid, wal4)
            doSendMagicEffect(wal4,17)
        end
    elseif item.uid == 10005 then
        if getPlayerStorageValue(cid,10005) == -1 then
            setPlayerStorageValue(cid,10005,1)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have touched Pumin´s throne and absorbed some of his spirit.')
            doSendMagicEffect(getCreaturePosition(cid),7)
        else
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have already absorbed some of Pumin´s spirit.')
            local wal = {x=32785, y=32279, z=15}
            doTeleportThing(cid, wal)
            doSendMagicEffect(wal,17)
        end
    elseif item.uid == 10007 then
        if getPlayerStorageValue(cid,10007) == -1 then
            setPlayerStorageValue(cid,10007,1)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have touched Ashfalor´s throne and absorbed some of his spirit.')
            doSendMagicEffect(getCreaturePosition(cid),17)
        else
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have already absorbed some of Ashfalor´s spirit.')
            local wal1 = {x=32839, y=32310, z=15}
            doTeleportThing(cid, wal1)
            doSendMagicEffect(wal1,17)
        end
        elseif item.uid == 10008 then
        if getPlayerStorageValue(cid,10008) == -1 then
            setPlayerStorageValue(cid,10008,1)
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have touched Bazir´s throne and absorbed some of his spirit.')
            doSendMagicEffect(getCreaturePosition(cid),11)
            local wal5 = {x=32745, y=32385, z=15}
            doTeleportThing(cid, wal5)
        else
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have already absorbed some of Bazir´s spirit.')
            local wal5 = {x=32745, y=32385, z=15}
            doTeleportThing(cid, wal5)
        end
    elseif item.uid == 14334 then
        if getPlayerStorageValue(cid,10001) == -1 then
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'Sorry, but you did not absorb enough energy!')
            doTeleportThing(cid, nie)
            doSendMagicEffect(getCreaturePosition(cid),51)
        else
        end
         elseif item.uid == 14333 then
        if getPlayerStorageValue(cid,10002) == -1 then
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'Sorry, but you did not absorb enough energy!')
            doTeleportThing(cid, nie)
            doSendMagicEffect(getCreaturePosition(cid),51)
            else
            end
             elseif item.uid == 14332 then
        if getPlayerStorageValue(cid,10003) == -1 then
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'Sorry, but you did not absorb enough energy!')
            doTeleportThing(cid, nie)
            doSendMagicEffect(getCreaturePosition(cid),51)
            else
            end
             elseif item.uid == 14339 then
        if getPlayerStorageValue(cid,10004) == -1 then
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'Sorry, but you did not absorb enough energy!')
            doTeleportThing(cid, nie)
            doSendMagicEffect(getCreaturePosition(cid),51)
            else
            end
             elseif item.uid == 14330 then
        if getPlayerStorageValue(cid,10005) == -1 then
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'Sorry, but you did not absorb enough energy!')
            doTeleportThing(cid, nie)
            doSendMagicEffect(getCreaturePosition(cid),51)
            else
            end
             elseif item.uid == 14329 then
        if getPlayerStorageValue(cid,10007) == -1 then
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'Sorry, but you did not absorb enough energy!')
            doTeleportThing(cid, nie)
            doSendMagicEffect(getCreaturePosition(cid),51)
            else
            end
             elseif item.uid == 14328 then
        if getPlayerStorageValue(cid,10008) == -1 then
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'Sorry, but you did not absorb enough energy!')
            doTeleportThing(cid, nie)
            doSendMagicEffect(getCreaturePosition(cid),51)
            else
            end  
        end
    end
    return 1

But It does not let me in even if POI is completed :(

9a4d73a.jpg
 
So you want when you use the door, it should check if you have the storagevalue from at least one throne and then let you in. If not, it should give you that message?
 
Yeah exactly.
I posted my thrones.lau in the spoiler with the storagevalues so you dont miss that one. Maybe it should be + 1 instead of - 1 ?

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local storages = {10001, 10002, 10003, 10004, 10005, 10006, 10007}
    local fail = TRUE

    for i = 1, #storages do
        if (getPlayerStorageValue(cid, storages[i]) == -1) then
            fail = TRUE
        end
    end

    if (fail == TRUE) then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need to absorb some of pits of infernos spirit first!")
    else
        doTransformItem(item.uid, item.itemid + 1)
        doTeleportThing(cid, fromPosition, TRUE)
    end

    return TRUE
end

Tried to switch but still not working :S
 
This is how you make readable and friendly code for other to learn and analyze:
Code:
local config = {
    [10001] = {storage = 10001, text = "You have touched Verminor´s throne and absorbed some of his spirit.", effect = CONST_ME_POISONAREA, destination = {x = 32840, y = 32327, z = 15}},
    [10002] = {storage = 10002, text = "You have touched Infernatil´s throne and absorbed some of his spirit.", effect = CONST_ME_FIREAREA, destination = {x = 32909, y = 32211, z = 15}},
    [10003] = {storage = 10003, text = "You have touched Tafariel´s throne and absorbed some of his spirit.", effect = CONST_ME_MORTAREA, destination = {x = 32761, y = 32243, z = 15}},
    [10004] = {storage = 10004, text = "You have touched Apocalypse´s throne and absorbed some of his spirit.", effect = CONST_ME_EXPLOSIONAREA, destination = {x = 32875, y = 32267, z = 15}},
    [10005] = {storage = 10005, text = "You have touched Pumin´s throne and absorbed some of his spirit.", effect = CONST_ME_MORTAREA, destination = {x = 32785, y = 32279, z = 15}},
    [10007] = {storage = 10007, text = "You have touched Ashfalor´s throne and absorbed some of his spirit.", effect = CONST_ME_FIREAREA, destination = {x = 32839, y = 32310, z = 15}},
    [10008] = {storage = 10008, text = "You have touched Bazir´s throne and absorbed some of his spirit.", effect = CONST_ME_MAGIC_GREEN, destination = {x = 32745, y = 32385, z = 15}}
}

function onStepIn(cid, item, position, fromPosition)
    if not isPlayer(cid) then
        return true
    end

    local throne = config[item.uid]
    if not throne then
        return true
    end

    if getPlayerStorageValue(cid, throne.storage) ~= 1 then
        setPlayerStorageValue(cid, throne.storage, 1)
        doSendMagicEffect(position, throne.effect)
        doCreatureSay(cid, throne.text, TALKTYPE_MONSTER, false, cid)
    else
        doCreatureSay(cid, "Begone!", TALKTYPE_MONSTER, false, cid)
        doTeleportThing(cid, throne.destination)
        doSendMagicEffect(throne.destination, CONST_ME_MORTAREA)
    end

    return true
end


Code:
local function hasTouchedAllThrones(cid)
    local storages = {10001, 10002, 10003, 10004, 10005, 10007, 10008}
    for i = 1, #storages do
        if getPlayerStorageValue(cid, storages[i]) ~= 1 then
            return false
        end
    end

    return true
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if not hasTouchedAllThrones(cid) then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need to absorb some of pits of infernos spirit first!")
        return true
    end

    local doorId = item.itemid
    if doorId == 5105 then
        doTransformItem(item.uid, doorId + 1)
        doTeleportThing(cid, toPosition, true)
    end

    return true
end

Your old code did not work because you were checking a storage, that does not exsist. In this case 10006.
 
Last edited:
Okey tried this now after my workout at the gym.
I get this message. Should I remove END at line 30?
aad44c8.jpg


EDIT: I added a end at line 31 and the error was gone but when entering the thrones my client crash and get this error instead :(
And the door is still not working.
4daeaca.jpg
 
Well I think its to easy to skip POI and go for INQ only :D

The thing is that the OLD POI script works perfect but the door didn't.
 
Done, recopy.

It does not matter old one works or not. You want code that preform good and also easy to edit.
 
Last edited:
Hmm, the thrones are working. But not the door.
Done, recopy.

It does not matter old one works or not. You want code that preform good and also easy to edit.

Still get the same won't let me walk trough after touched all the thrones.
 
Last edited:
Recopy the door, write door id where i wrote 5023 on the script.

I have its 5105 now hmm.

EDIT: I tried made a new character and he can enter the door if not touched any seal. While my GOD can't enter while have touched the seals....

EDIT2: After touching 1 seal I can't enter my door anymore so I think the code is written backwards.
 
Last edited:
My fault, recopy door

Nice, it works now.
I need to rewrite the access for reward room now in POI since we changed the script. Can I make a same function with this door too? I mean this door will only open if u made ALL thrones?

EDIT:
You can use this door as a door to make sure u have done POI before access INQ AND as a DOOR for check all thrones before reward in POI.

Thanks everyone.
 
Last edited:
As you said, only opens if you touched all the thrones anf can be easily changed to touch one throne only.
 
Back
Top