• 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!
  • If you're using Gesior 2012 or MyAAC, please review this thread for information about a serious security vulnerability and a fix.

TFS 1.X+ TFS 1.2 Movement item on slot remove wall

Datero

New Member
Joined
Apr 16, 2013
Messages
6
Reaction score
1
Hey, i making " put helmet on slot, and remove wall, go to hidden location " i tried everything, i can't remove wall, stackpos, work, but... not where is wall, removes item, always below, not where is my wall. I tried reading source documentation, for now, i don't understand much. Idk, if, option movement+slot, work with removing wall.

Lua:
local item = 11337

getpos = getThingfromPos(wallPos1)

local wallPosition = Position{x = 32039, y = 32271, z = 6}


function onEquip(player, item, slot, position, fromPosition, toPosition)   
        local player = Player(cid)
        Game.createItem(1043, 1, wallPosition)
        --doCreateItem(config.wallId, 1, config.wallPos)
        -- doTransformItem(item.uid, item.itemid -1)
            -- doTransformItem(config.lampId):getItemById(config.wallId -1)
            -- doRemoveItem(config.wallId, 1, config.wallPos)
    return true
end


local item = 11337


local player = Player(cid)


function onDeEquip(player, item, slot, position, fromPosition, toPosition, isCheck, topOrder)
    
    local slot = getPlayerSlotItem(CONST_SLOT_HEAD)
    local tile = Tile(Position(32039, 32271, 6):getItemById(1043))

    
    local wallItem = tile:getTileItemById(1043)
        if wallItem then
            if wallItem.stackpos == 1 then

        wallItem:doRemoveItem(getTileThingByPos({x=32039, y=32271, z=6, id = 1043, stackpos=1}).uid, 1)

    return true
end
end
end
 
Solution
Lua:
local wallPosition = Position{x = 32039, y = 32271, z = 6}
local id = 1043

function onEquip(player, item, slot, position, fromPosition, toPosition)
    local tile = Tile(wallPosition)
    if tile then
       local wallItem = tile:getTileItemById(id)
       if not wallItem then
          Game.createItem(id, 1, wallPosition)
       end
    end
    return true
end


function onDeEquip(player, item, slot, position, fromPosition, toPosition, isCheck, topOrder)
    local tile = Tile(wallPosition)
    if tile then
       local wallItem = tile:getTileItemById(id)
       if wallItem then
          wallItem:remove()
       end
    end
    return true
end

Colors

Joined
Mar 22, 2013
Messages
812
Solutions
4
Reaction score
268
I don't remember much to be honest but can't you just do wallItem:remove() instead of doRemoveItem~?
Also you are double checking for the item 1043 in tile and wallItem.
 

Dakos

Well-Known Member
Joined
Jan 1, 2010
Messages
157
Solutions
22
Reaction score
82
Lua:
local wallPosition = Position{x = 32039, y = 32271, z = 6}
local id = 1043

function onEquip(player, item, slot, position, fromPosition, toPosition)
    local tile = Tile(wallPosition)
    if tile then
       local wallItem = tile:getTileItemById(id)
       if not wallItem then
          Game.createItem(id, 1, wallPosition)
       end
    end
    return true
end


function onDeEquip(player, item, slot, position, fromPosition, toPosition, isCheck, topOrder)
    local tile = Tile(wallPosition)
    if tile then
       local wallItem = tile:getTileItemById(id)
       if wallItem then
          wallItem:remove()
       end
    end
    return true
end
 
Last edited:
Solution
Top