• 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 (action) toPosition return null coord

WTF.Error

Member
Joined
Aug 8, 2007
Messages
489
Reaction score
10
I want make a script to destroy a wall.
( Like a Hammer you use in walls )

from right side from wall all work fine.

right to left.png
from left side of wall.
I cant get position of wall.
left to right.png

function toPosition return x , y ,z = 0
 
I want get position from where iten is used.

toPosition partially work.

this iscript dont will get a item from a specific place.
understand ?



it isn't toPosition.
it is
Code:
getThingPos(itemEx.uid)


here my code.


Code:
function onUse(cid, item, fromPosition, itemEx, toPosition) 
 doRemoveItem(itemEx.uid) 
 doPlayerSendTextMessage(cid,22,"X:"..toPosition.x.."Y:"..toPosition.y.."Z:"..toPosition.z)
 end
 
Last edited:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local x = getThingPos(itemEx.uid)
doRemoveItem(itemEx.uid)
doPlayerSendTextMessage(cid,22,"X:"..x.x.."Y:"..x.y.."Z:"..x.z.."")
end
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local x = getThingPos(itemEx.uid)
doRemoveItem(itemEx.uid)
doPlayerSendTextMessage(cid,22,"X:"..x.x.."Y:"..x.y.."Z:"..x.z.."")
end


return in console
Code:
[12:17:09.405] data/actions/scripts/development/test..lua:onUse
[12:17:09.405] Description:
[12:17:09.405] data/actions/scripts/development/test.lua:5: attempt to index local 'x' (a boolean value)
[12:17:09.405] stack traceback:
[12:17:09.405]  data/actions/scripts/development/test.lua:5: in function <data/actions/scripts/development/test.lua:2>
/\
in this case is like my problem.
Only in from 'external' wall


Which server version is it?

TFS 0.4_DEV 3777






----------
More information
I found this part in source.

Code:
        if(player && thing && thing->getItem())
        {
            if(tile->hasProperty(ISVERTICAL))
            {
                if(player->getPosition().x + 1 == tile->getPosition().x)
                    thing = NULL;
            }
            else if(tile->hasProperty(ISHORIZONTAL) && player->getPosition().y + 1 == tile->getPosition().y)
                thing = NULL;
        }

A few itens like walls dont allow user get position.. ( probably to dont allow a guy open windows from outside )

If i change this I will give any future problem ?
PS:Now I understand why that shit happen.
Can be fix using another wall or replacing a few itens in item.otb
 
Last edited:
Back
Top