• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Stackpos not work in tfs 1.2

sirakx

Member
Joined
Feb 23, 2015
Messages
51
Solutions
1
Reaction score
8
I want to place a stone above the teleport but apparently the stackpos not work, anyone can help me? Thank you.

this is my code:

Code:
local config = {
    pos = Position(779, 504, 7, 2),
    id = 1354
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local player = Player(cid)
    if not player then return false end
    local tile = Tile(config.pos)
    if tile ~= nil then
        local piedra = tile:getItemById(config.id)
        if piedra then
            piedra:remove()
            config.pos:sendMagicEffect(3)
            player:sendTextMessage(MESSAGE_EVENT_ORANGE, "Has removido la piedra que impedia pasar al porta.")
        else
            Game.createItem(config.id, 1, config.pos)
            config.pos:sendMagicEffect(15)
            player:sendTextMessage(MESSAGE_EVENT_ORANGE, "Has creado la piedra, ahora el lugar fue protegido.")
        end
    end
    Item(item.uid):transform( ((item.itemid == 1945) and 1946 or 1945) )
    return true
end

and this is my result of bad luck.

 
Last edited:
I already I've tried. and I do not want to sound rude, but I need that you try it before commenting.
 
Last edited:
I already I've tried. and I do not want to sound rude, but I need that you try it before commenting.
i dont want to sound rude, but maybe you should tell people what you've tried so people can avoid posting that exact same thing

i dont want to sound rude, but it took me about 15 seconds of testing to find a solution, when re-placing the stone either replace the tp, or move it somewhere and move it back and itll be under the stone, e.g
Code:
local tp = tile:getItemById(1387)
tp:moveTo(toPosition)
tp:moveTo(config.pos)

local tp = tile:getItemById(1387)
tp:clone():moveTo(config.pos)
tp:remove()
 
Back
Top