• 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 Check on PoI code.

elektrus

Uninvited Guest
Joined
Jun 16, 2011
Messages
28
Reaction score
0
Location
Poland
Map: https://i.imgur.com/ehna8gl.jpg
Movements.xml:
<movevent event="StepIn" itemid="5916" script="AllThrones.lua"/>
<movevent event="StepIn" itemid="5915" script="AllThrones.lua"/>
<movevent event="StepIn" uniqueid="10281" script="AllThrones.lua"/>
AllThrones.lua:
function onStepIn(cid, item, pos)

if item.uid == 10274 then
if getPlayerStorageValue(cid,10274) == -1 then
setPlayerStorageValue(cid,10274,1)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_BIGCLOUDS)
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)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_BIGCLOUDS)
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)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_BIGCLOUDS)
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)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_BIGCLOUDS)
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)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_BIGCLOUDS)
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)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_BIGCLOUDS)
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)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_BIGCLOUDS)
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 == 1225 and pos == {x=999, y=994, z=7} 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
return 1
end

Thrones seem to work (there is animation and message) but I can't pass the doors nor there is message about not enough absorbed energy. Any ideas what is wrong? Just don't tell me it's cause im running 1.0.0.
 
movements -- thrones.lua
PHP:
local throneTable = {
    {uniqueId = 10274, name = 'Verminor'},
    {uniqueId = 10275, name = 'Infernatil'},
    {uniqueId = 10276, name = 'Tafariel'},
    {uniqueId = 10277, name = 'Apocalypse'},
    {uniqueId = 10278, name = 'Pumin'},
    {uniqueId = 10279, name = 'Bazir'},
    {uniqueId = 10280, name = 'Ashfalor'}
    }

function onStepIn(cid, item, pos)
    for _, throne in pairs(throneTable) do
        if(item.uid == throne.uniqueId) then
            if(getPlayerStorageValue(cid, throne.uniqueId) < 1) then
                setPlayerStorageValue(cid, throne.uniqueId, 1)
                doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have touched ' .. throne.name .. '\'s throne and absorbed some of his spirit.')
            else
                doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have already absorbed some of ' .. throne.name .. '\'s spirit.')
            end
        end
    end
    return TRUE
end
register

Code:
    <movevent type="StepIn" fromuid="10274" touid="10280" event="script" value="poi/thrones.lua" />

actions>

make new file storagedoor.lua

PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.uid == 10281 then
        if(isInArray({getPlayerStorageValue(cid, 10274), getPlayerStorageValue(cid, 10275), getPlayerStorageValue(cid, 10276), getPlayerStorageValue(cid, 10277), getPlayerStorageValue(cid, 10278), getPlayerStorageValue(cid, 10279), getPlayerStorageValue(cid, 10280)}, -1) == TRUE) then
              doPlayerSendTextMessage(cid, 22, "The door seems to be sealed against unwanted intruders.")
        else
            doPlayerSendTextMessage(cid, 22, "You've absorbed enough energy! You may pass.")
            doTransformItem(item.uid, item.itemid + 1)
            doTeleportThing(cid, toPosition, TRUE)
        end
        return TRUE
    end
    return FALSE
end

register

Code:
    <action uniqueid="10281" event="script" value="quests/poi/storagedoor.lua"/>
 
Now thrones do nothing and doors crash Tibia :D
Yeah, i changed "event="script" value="poi/thrones.lua" />" to "script="thrones.lua"/>" etc.
 
Use constant names for magic effects and text messages to avoid client crashes (e.g MESSAGE_EVENT_ADVANCE instead of 22)

The script for thrones is not registered correctly in movements.xml (should be <movevent event instead of <movevent type)
Code:
<movevent event="StepIn" fromuid="10274" touid="10280" script="thrones.lua" />
 
Back
Top