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

Help with demon helmet

nicolasdasd

New Member
Joined
Feb 26, 2013
Messages
7
Reaction score
1
Hello, I present my problem since I have the quest "demon helmet", and when you use the lever, the stone is removed, however it does not return unless you use the lever again..

Would it be possible that using the lever removes the stone and you have 45 seconds to go to the chests?

These are the respective scripts:

En actions
LUA:
<action uniqueid="2000" script="switchdemon.lua" />

script:
Code:
function onUse(cid, item, frompos, item2, topos)
piece1pos = {x=1059, y=859, z=7, stackpos=1}
rockpos = {x=1059, y=859, z=7, stackpos=1}
getpiece1 = getThingfromPos(piece1pos)
if item.uid == 2000 and item.itemid == 1945 and getpiece1.itemid == 1355 then
doRemoveItem(getpiece1.uid,1)
doTransformItem(item.uid,item.itemid+1)
elseif item.uid == 2000 and item.itemid == 1946 then
doCreateItem(1355,1,rockpos)
doTransformItem(item.uid,item.itemid-1)
else
doPlayerSendTextMessage(cid,22,"Sorry, not possible.")
end
return 1
end

Thank you !
 
Solution
LUA:
local stoneRemoved = false
local timeToRemove = 45000 -- 45 seconds in milliseconds

function onUse(cid, item, frompos, item2, topos)
    local stonePos = {x = 1059, y = 859, z = 7}
    local playerPosition = getCreaturePosition(cid)
   
    local stoneItem = getTileItemById(stonePos, 1355)
   
    if stoneItem and not stoneRemoved then
        doRemoveItem(stoneItem.uid)
        stoneRemoved = true
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The stone has been removed! You have 45 seconds to get to the chests.")
       
       
        addEvent(function() restoreStone(stonePos, cid) end, timeToRemove)
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Chests are blocked by a stone.")
    end...

Heres something maybe can help you
 

Heres something maybe can help you
thank you! I'm going to check it now!
 
LUA:
local stoneRemoved = false
local timeToRemove = 45000 -- 45 seconds in milliseconds

function onUse(cid, item, frompos, item2, topos)
    local stonePos = {x = 1059, y = 859, z = 7}
    local playerPosition = getCreaturePosition(cid)
    
    if not stoneRemoved then
        doRemoveTileItemByPos(stonePos)
        stoneRemoved = true
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The stone has been removed! You have 45 seconds to get to the chests.")
        
        
        addEvent(function() restoreStone(stonePos, cid) end, timeToRemove)
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The chests are blocked by a boulder.")
    end
    
    return true
end

function restoreStone(stonePos, cid)
    if not stoneRemoved then
        return
    end
    
    doCreateItem(1355, 1, stonePos)
    stoneRemoved = false
    
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The stone again blocked access to the chests.")
end
 
LUA:
local stoneRemoved = false
local timeToRemove = 45000 -- 45 seconds in milliseconds

function onUse(cid, item, frompos, item2, topos)
    local stonePos = {x = 1059, y = 859, z = 7}
    local playerPosition = getCreaturePosition(cid)
   
    if not stoneRemoved then
        doRemoveTileItemByPos(stonePos)
        stoneRemoved = true
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The stone has been removed! You have 45 seconds to get to the chests.")
       
       
        addEvent(function() restoreStone(stonePos, cid) end, timeToRemove)
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The chests are blocked by a boulder.")
    end
   
    return true
end

function restoreStone(stonePos, cid)
    if not stoneRemoved then
        return
    end
   
    doCreateItem(1355, 1, stonePos)
    stoneRemoved = false
   
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The stone again blocked access to the chests.")
end
[27/8/2023 13:47:57] [Error - Action Interface]
[27/8/2023 13:47:57] data/actions/scripts/switchdemon.lua:onUse
[27/8/2023 13:47:57] Description:
[27/8/2023 13:47:57] data/actions/scripts/switchdemon.lua:9: attempt to call global 'doRemoveTileItemByPos' (a nil value)
[27/8/2023 13:47:57] stack traceback:
[27/8/2023 13:47:57] data/actions/scripts/switchdemon.lua:9: in function <data/actions/scripts/switchdemon.lua:4>

I get that error in the console when using the lever. The problem seems in "doRemoveTileItemByPos"

Do you have any idea why it could be?
It's otx v2.1

Thanks :P
 
LUA:
local stoneRemoved = false
local timeToRemove = 45000 -- 45 seconds in milliseconds

function onUse(cid, item, frompos, item2, topos)
    local stonePos = {x = 1059, y = 859, z = 7}
    local playerPosition = getCreaturePosition(cid)
   
    local stoneItem = getTileItemById(stonePos, 1355)
   
    if stoneItem and not stoneRemoved then
        doRemoveItem(stoneItem.uid)
        stoneRemoved = true
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The stone has been removed! You have 45 seconds to get to the chests.")
       
       
        addEvent(function() restoreStone(stonePos, cid) end, timeToRemove)
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Chests are blocked by a stone.")
    end
   
    return true
end

function restoreStone(stonePos, cid)
    if not stoneRemoved then
        return
    end
   
    doCreateItem(1355, 1, stonePos)
    stoneRemoved = false
   
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The stone again blocked access to the chests.")
end
 
Last edited:
Solution
Works very good now !
works demo helmet.jpg

always grateful for this great community
Season 9 Thank You GIF by The Office
 
LUA:
local stoneRemoved = false
local timeToRemove = 45000 -- 45 seconds in milliseconds

function onUse(cid, item, frompos, item2, topos)
    local stonePos = {x = 1059, y = 859, z = 7}
    local playerPosition = getCreaturePosition(cid)
 
    local stoneItem = getTileItemById(stonePos, 1355)
 
    if stoneItem and not stoneRemoved then
        doRemoveItem(stoneItem.uid)
        stoneRemoved = true
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The stone has been removed! You have 45 seconds to get to the chests.")
     
     
        addEvent(function() restoreStone(stonePos, cid) end, timeToRemove)
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Chests are blocked by a stone.")
    end
 
    return true
end

function restoreStone(stonePos, cid)
    if not stoneRemoved then
        return
    end
 
    doCreateItem(1355, 1, stonePos)
    stoneRemoved = false
 
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The stone again blocked access to the chests.")
end
thanks
 
Last edited:
is this revscript?

as you can see no
you should atleast learn first to take a look how a revscript looks like instead of asking such a question
just saying

example
you go to any file which is located in scripts folder you open it and then you can just see simply how its build up
example

1697745011946.png

This is a action based on revscript if its just a normal action then there wouldnt be the marked parts
 
as you can see no
you should atleast learn first to take a look how a revscript looks like instead of asking such a question
just s

as you can see no
you should atleast learn first to take a look how a revscript looks like instead of asking such a question
just saying

example
you go to any file which is located in scripts folder you open it and then you can just see simply how its build up
example

View attachment 79399

This is a action based on revscript if its just a normal action then there wouldnt be the marked parts
i know how a revscript looks xd , i was trying to get mateus to convert the script to revscript but i found it on another post ^^
 
Back
Top