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

Lua Script demon helmet quest dont work

chupaescadatri

Banned User
Joined
Jul 5, 2014
Messages
338
Reaction score
49
The wall does not disappear

\data\actions\scripts\Edron\Demon Helmet Quest
dh_demonhelmet.lua
dh_demonhelmet.lua
dh_steelboots.lua
dh_switch.lua

dh_switch:
Code:
-- Script by Nottinghster
function onUse(cid, item, frompos, item2, topos)

local gatepos = {x=33314, y=31592, z=15, stackpos=1}
local telepos = {x=33316, y=31591, z=15, stackpos=1}
local gopos = {x=33321, y=31591, z=14, stackpos=1}

local getgate = getThingfromPos(gatepos)
local gettele = getThingfromPos(telepos)

    if item.uid == 10002 and item.itemid == 1945 and getgate.itemid == 1355 then
        doRemoveItem(getgate.uid,1)
        doTransformItem(item.uid,item.itemid+1)
        doCreateTeleport(1387, gopos, telepos)
    elseif item.uid == 10002 and item.itemid == 1946 and getgate.itemid == 0 then
        doCreateItem(1355,1,gatepos)
        doTransformItem(item.uid,item.itemid-1)
        doRemoveItem(gettele.uid,1)
    else
        doPlayerSendCancel(cid,"Sorry, not possible.")
    end
  
return TRUE
end
remeresdemonhelmet.jpg

How to fix? :(
 
what is player suppose to do?
Use a tile??

Looks like this script has to be in movements.
Btw what TFS version?
 
Code:
local gatePosition = { -- gate position according to picture
        {x = 33210, y = 31630, z = 13, stackpos = 1},
        {x = 33212, y = 31630, z = 13, stackpos = 1}
    }
-- you might need to change this
local teleporterPosition = {
        x = 33316, y = 31591, z = 15, stackpos = 1
    }
-- you might need to change this
local sendToPosition = {
        x = 33321, y = 31591, z = 14, stackpos = 1
    }

local wall = 1355

local removeGate = {getThingfromPos(gatePosition[1]), getThingfromPos(gatePosition[2]) }
local removeTeleporter = getThingfromPos(teleporterPosition)
function onUse(cid, item, frompos, item2, topos)
    if item.uid == 10002 and item.itemid == 1945 and doBothWallsExist(removeGate, wall) then
        removeTheItem(removeGate, 1)
        doTransformItem(item.uid, item.itemid + 1)
        doCreateTeleport(1387, sendToPosition, teleporterPosition)
    elseif item.uid == 10002 and item.itemid == 1946 and not doBothWallsExist(removeGate, wall) then
        for n = 1, #gatePosition do
            doCreateItem(wall, 1, gatePosition[n])
        end
        doTransformItem(item.uid, item.itemid - 1)
        removeTheItem(removeTeleporter.uid, 1)
    else
        doPlayerSendCancel(cid, "Sorry, not possible.")
    end
    return TRUE
end

-- we want to make sure both walls exist, not just 1 of them
function doBothWallsExist(y, v)
    local c = 0
    for k = 1, #y do
        if y[k].itemid == v then
            c = c + 1
        end
        if c == #y then
            return true
        end
    end
    return false
end

function removeTheItem(g, a)
    if type(g) == "table" then
        for i = 1, #g do
            doRemoveItem(g[i].uid, a)
        end
    end
    doRemoveItem(g, a)
end
 
Last edited:
Code:
local gatePosition = { -- gate position according to picture
        {x = 33210, y = 31630, z = 13, stackpos = 1},
        {x = 33212, y = 31630, z = 13, stackpos = 1}
    }
-- you might need to change this
local teleporterPosition = {
        x = 33316, y = 31591, z = 15, stackpos = 1
    }
-- you might need to change this
local sendToPosition = {
        x = 33321, y = 31591, z = 14, stackpos = 1
    }

local wall = 1355

local removeGate = {getThingfromPos(gatePosition[1]), getThingfromPos(gatePosition[2]) }
local removeTeleporter = getThingfromPos(teleporterPosition)
function onUse(cid, item, frompos, item2, topos)
    if item.uid == 10002 and item.itemid == 1945 and doBothWallsExist(removeGate, wall) then
        removeTheItem(removeGate, 1)
        doTransformItem(item.uid, item.itemid + 1)
        doCreateTeleport(1387, sendToPosition, teleporterPosition)
    elseif item.uid == 10002 and item.itemid == 1946 and not doBothWallsExist(removeGate, wall) then
        for n = 1, #gatePosition do
            doCreateItem(wall, 1, gatePosition[n])
        end
        doTransformItem(item.uid, item.itemid - 1)
        removeTheItem(removeTeleporter.uid, 1)
    else
        doPlayerSendCancel(cid, "Sorry, not possible.")
    end
    return TRUE
end

-- we want to make sure both walls exist, not just 1 of them
function doBothWallsExist(y, v)
    local c = 0
    for k = 1, #y do
        if y[k].itemid == v then
            c = c + 1
        end
        if c == #y then
            return true
        end
    end
    return false
end

function removeTheItem(g, a)
    if type(g) == "table" then
        for i = 1, #g do
            doRemoveItem(g[i].uid, a)
        end
    end
    doRemoveItem(g, a)
end
thanks!!
 
Back
Top