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

Talkaction "open sesame"

tiddpd

PHP Scripter
Joined
Apr 16, 2008
Messages
331
Reaction score
0
I made this script to open a door when you say "open sesame" in front of it, it does work, I get this error:
(I am using TFS 0.3 Beta 3)

[07/02/2009 14:04:14] Lua Script Error: [TalkAction Interface]
[07/02/2009 14:04:14] data/talkactions/scripts/open.lua

[07/02/2009 14:04:14] luaGetThingFromPos(). Tile not found

This is the script

Code:
local standPos = {x=457,y=199,z=7}
local statuePos = getThingFromPos {x = 457, y = 198, z = 7, stackpos=1}
local statue = getThingFromPos(statuePos)

function onSay(cid, param)
        if statue.itemid > 0 then
			doTransformItem(item.uid, item.itemid + 1)
        else
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        end
    end

Also note: I get the same error in other scripts that use getThingFromPos. It can't find the tile. (when its actually there)
 
Last edited:
Well the local statue most be inside the function!

PHP:
function onSay(cid, param)
local standPos = {x=457,y=199,z=7}
local statuePos = getThingFromPos {x = 457, y = 198, z = 7, stackpos=1}
local statue = getThingFromPos(statuePos)

        if statue.itemid > 0 then
			doTransformItem(item.uid, item.itemid + 1)
        else
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        end
    end
 
PHP:
function onSay(cid, param)
local standPos = {x=457,y=199,z=7}
local statuePos = getThingFromPos ({x = 457, y = 198, z = 7, stackpos=1})
local statue = getThingFromPos(statuePos)

        if statue.itemid > 0 then
            doTransformItem(statue.uid, item.itemid + 1)
        else
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        end
    end
 
I tried that one too, still the same error: Tile cannot be found. :confused:

Edit: I got it, I removed getThingFromPos from the local StatuePos

Thanks anyway man
 
Last edited:
Try this...
function onSay(cid, words, param)
-----------------
local statuePos = { x=390, y=261, z=7, stackpos=1 } -- pos of statue
local maxdist = 3 -- max distance player can be of the statue
local statue = getThingfromPos(statuePos)
-----------------
if math.max(math.abs(statuePos.x-statuePos.x), math.abs(statuePos.y-statuePos.y)) < maxdist then

if statue.uid > 0 then
doTransformItem(statue.uid, item.itemid + 1)
else
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
end
 
Or this..

PHP:
local standPos = {x=457,y=199,z=7}
local statuePos = {x = 457, y = 198, z = 7, stackpos=1}


function onSay(cid, param)

local statue = getThingFromPos(statuePos)

        if statue.itemid > 0 then
			doTransformItem(item.uid, item.itemid + 1)
        else
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        end
    end

One local has to define the position of the item (eg. local xPos = {x=10, y=10, z=10}) and another one inside the function has to get this item (eg. local x = getThingfromPos(xPos))
 
Back
Top