• 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+ Converting from 0.3.7 to 1.4.1

Shalaby

Time has made me wiser, but no more patient.
Joined
Feb 17, 2011
Messages
230
Solutions
6
Reaction score
68
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

Xikini

I whore myself out for likes
Senator
Joined
Nov 17, 2010
Messages
6,245
Solutions
545
Reaction score
4,489
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
 
OP
OP
Shalaby

Shalaby

Time has made me wiser, but no more patient.
Joined
Feb 17, 2011
Messages
230
Solutions
6
Reaction score
68
Location
Egypt
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

Xikini

I whore myself out for likes
Senator
Joined
Nov 17, 2010
Messages
6,245
Solutions
545
Reaction score
4,489
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
 
OP
OP
Shalaby

Shalaby

Time has made me wiser, but no more patient.
Joined
Feb 17, 2011
Messages
230
Solutions
6
Reaction score
68
Location
Egypt
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
 

Xikini

I whore myself out for likes
Senator
Joined
Nov 17, 2010
Messages
6,245
Solutions
545
Reaction score
4,489
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
OP
OP
Shalaby

Shalaby

Time has made me wiser, but no more patient.
Joined
Feb 17, 2011
Messages
230
Solutions
6
Reaction score
68
Location
Egypt
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:
Top