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

TFS 1.X+ Converting from 0.3.7 to 1.4.1

Obito

0x1337
Joined
Feb 17, 2011
Messages
350
Solutions
8
Reaction score
145
Location
Egypt
Greetings, I was using this in my 0.3.7 TFS tried to convert it to 1.4.1 I know 1.4.1 supports 0.4 functions libs but for some reason, it doesn't work there's no error in the console or anything happen in the game. It works when u step out in some position it removes some item in some position.
Lua:
function onStepOut(cid, item, pos)
    wall1 = {x=665, y=401, z=7, stackpos=1}
    getwall1 = getThingfromPos(wall1)

    if item.uid == 4356 and item.itemid == 425 and isPlayer(cid) == TRUE then
        doTransformItem(item.uid,item.itemid+1)
        doCreateItem(1304, 1, wall1)       
    else
    end

    return 1
end
 
Solution
Code:
Amr has logged in.
-------
ground tile is incorrect id
Oh, I see.

The tile you are wanting to check is the one we are standing on.
easy fix.
Lua:
local wallId = 1304
local tileId = 425
local wallPosition = Position(665, 401, 7)

function onStepOut(creature, item, pos, fromPosition)
    if not creature:isPlayer() then
        return true
    end
  
    local ground = item
    if ground:getId() ~= tileId then
        return true
    end
  
    local tile = Tile(wallPosition)
    if not tile then
        return true
    end
  
    local wall = tile:getItemById(wallId)
    if wall then
        return true
    end
  
    ground:transform(tileId + 1)
    Game.createItem(wallId, 1, wallPosition)
    return true
end
It's best to not rely on the 0.4 functions if you can help it.

try this
Lua:
local wallId = 1304
local tileId = 425
local wallPosition = Position(665, 401, 7)

function onStepOut(creature, item, pos, fromPosition)
    if not creature:isPlayer() then
        return true
    end
 
    local tile = Tile(wallPosition)
    if not tile then
        return true
    end
 
    local ground = tile:getGround()
    if ground:getId() ~= tileId then
        return true
    end
 
    local wall = tile:getItemById(wallId)
    if wall then
        return true
    end
 
    ground:transform(tileId + 1)
    Game.createItem(wallId, 1, wallPosition)
    return true
end
 
It's best to not rely on the 0.4 functions if you can help it.

try this
Lua:
local wallId = 1304
local tileId = 425
local wallPosition = Position(665, 401, 7)

function onStepOut(creature, item, pos, fromPosition)
    if not creature:isPlayer() then
        return true
    end
 
    local tile = Tile(wallPosition)
    if not tile then
        return true
    end
 
    local ground = tile:getGround()
    if ground:getId() ~= tileId then
        return true
    end
 
    local wall = tile:getItemById(wallId)
    if not wall then
        return true
    end
 
    ground:transform(tileId + 1)
    Game.createItem(wallId, 1, wallPosition)
    return true
end
Thanks, @Xikini But I think it doesn't work when I step out It remains untransformed.
And the wall doesn't appear even there's no error in the console and this how I installed it into my server
XML:
<movevent event="StepOut" uniqueid="55510" script="MyUpdate/Create_items-teleports/add_wall.lua" />
in the map editor have set the unique id to "55510".
 

Attachments

Thanks, @Xikini But I think it doesn't work when I step out It remains untransformed.
And the wall doesn't appear even there's no error in the console and this how I installed it into my server
XML:
<movevent event="StepOut" uniqueid="55510" script="MyUpdate/Create_items-teleports/add_wall.lua" />
in the map editor have set the unique id to "55510".
Added some prints.

Tell us what shows in console
Lua:
local wallId = 1304
local tileId = 425
local wallPosition = Position(665, 401, 7)

function onStepOut(creature, item, pos, fromPosition)
    print("-------")
    if not creature:isPlayer() then
        print("creature is not a player.")
        return true
    end
   
    local tile = Tile(wallPosition)
    if not tile then
        print("wall position is incorrect or tile is missing.")
        return true
    end
   
    local ground = tile:getGround()
    if ground:getId() ~= tileId then
        print("ground tile is incorrect id")
        return true
    end
   
    local wall = tile:getItemById(wallId)
    if wall then
        print("wall already exists on wallPosition.")
        return true
    end
   
    print("transforming tile & creating wall")
    ground:transform(tileId + 1)
    Game.createItem(wallId, 1, wallPosition)
    return true
end
 
Added some prints.

Tell us what shows in console
Lua:
local wallId = 1304
local tileId = 425
local wallPosition = Position(665, 401, 7)

function onStepOut(creature, item, pos, fromPosition)
    print("-------")
    if not creature:isPlayer() then
        print("creature is not a player.")
        return true
    end
  
    local tile = Tile(wallPosition)
    if not tile then
        print("wall position is incorrect or tile is missing.")
        return true
    end
  
    local ground = tile:getGround()
    if ground:getId() ~= tileId then
        print("ground tile is incorrect id")
        return true
    end
  
    local wall = tile:getItemById(wallId)
    if wall then
        print("wall already exists on wallPosition.")
        return true
    end
  
    print("transforming tile & creating wall")
    ground:transform(tileId + 1)
    Game.createItem(wallId, 1, wallPosition)
    return true
end
Code:
Amr has logged in.
-------
ground tile is incorrect id
 
Code:
Amr has logged in.
-------
ground tile is incorrect id
Oh, I see.

The tile you are wanting to check is the one we are standing on.
easy fix.
Lua:
local wallId = 1304
local tileId = 425
local wallPosition = Position(665, 401, 7)

function onStepOut(creature, item, pos, fromPosition)
    if not creature:isPlayer() then
        return true
    end
  
    local ground = item
    if ground:getId() ~= tileId then
        return true
    end
  
    local tile = Tile(wallPosition)
    if not tile then
        return true
    end
  
    local wall = tile:getItemById(wallId)
    if wall then
        return true
    end
  
    ground:transform(tileId + 1)
    Game.createItem(wallId, 1, wallPosition)
    return true
end
 
Solution
Oh, I see.

The tile you are wanting to check is the one we are standing on.
easy fix.
Lua:
local wallId = 1304
local tileId = 425
local wallPosition = Position(665, 401, 7)

function onStepOut(creature, item, pos, fromPosition)
    if not creature:isPlayer() then
        return true
    end
 
    local ground = item
    if ground:getId() ~= tileId then
        return true
    end
 
    local tile = Tile(wallPosition)
    if not tile then
        return true
    end
 
    local wall = tile:getItemById(wallId)
    if wall then
        return true
    end
 
    ground:transform(tileId + 1)
    Game.createItem(wallId, 1, wallPosition)
    return true
end
That's it!! Thank you @Xikini 🥰
 
Last edited:
Back
Top