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

[all TFS 8.6+] isPathable - no more placing items on walls!

zbizu

Legendary OT User
Joined
Nov 22, 2010
Messages
3,323
Solutions
26
Reaction score
2,690
Location
Poland
as in title - this function lets you check if tile is walkable (useful when you have to place items randomly in area filled with blocking objects)

this function works as isWalkable, but all you need is position so you don't need "cid" anymore!

Do not post that script on other forums without my permission

0.2/0.3/0.4/1.0:
Code:
function isPathable(pos)
     pos.stackpos = 0
     local tile = getThingfromPos(pos).uid

     if tile > 0 then
       return not hasProperty(tile, CONST_PROP_BLOCKSOLID)
     end
     return false
end



1.0 metatables:
Code:
function isPathable(pos)
    local tile = Tile(pos)

    if tile then
       return not tile:hasFlag(TILESTATE_BLOCKSOLID)
    end
    return false
end
 
Last edited:
syntax and function errors on 1st one
 
This is my edit, when I came across this issue. TFS 0.3.7

Main issue was when a tile did not exist, it would cause many errors.
The first part of this fixes that issue.. and the stackpos was not needed, so I removed it.
Code:
function isPathable(pos)
    if getTileThingByPos(pos).itemid ~= 0 then
        local tile = getThingfromPos(pos).uid    
        if hasProperty(tile, CONST_PROP_BLOCKSOLID) then
            return false
        end
        return true
    end
    return false
end
 
I need to fix this bug in my otserver which source files i have to edit? someone tell me pls
 
just add it to 050-function.lua
 
Not working.
I pasted the script at the very end - 050-function.lua
84dbaaff71de166e21c2781754e67109.png

This is my file:
050-function.lua Anything else need to add? @Cade

Engine: OTX Server 2 (Real-OTX 7.72)
///
@Felipe93 It works for you?
 

Attachments

as in title - this function lets you check if tile is walkable (useful when you have to place items randomly in area filled with blocking objects)

this function works as isWalkable, but all you need is position so you don't need "cid" anymore!

Do not post that script on other forums without my permission

0.2/0.3/0.4/1.0:
Code:
function isPathable(pos)
     pos.stackpos = 0
     local tile = getThingfromPos(pos).uid

     if tile > 0 then
       return not hasProperty(tile, CONST_PROP_BLOCKSOLID)
     end
     return false
end



1.0 metatables:
Code:
function isPathable(pos)
    local tile = Tile(pos)

    if tile then
       return not tile:hasFlag(TILESTATE_BLOCKSOLID)
    end
    return false
end
Thanks a lot, it works perfectly! (TSF 0.3.6)
 
Back
Top