TFS 0.X otx2 cannot use unwalkable items like barrels, tables to make teleport to players

shass

Banned User
Joined
Dec 3, 2017
Messages
67
Reaction score
6
im using otx 2
like i menthioned in the headline
i can't use unwalkable items todo teleport to players if i use the items to make tp the player just re-log in above these items i want to make it works as in othire
can someone help me or where to look please?
 

Danger II

FluppiX.com
Joined
Nov 21, 2012
Messages
1,578
Reaction score
368
Location
Germany
\creaturescripts\scripts create a new file, call it w/e you want (e.g xxx)
Lua:
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
local function isWalkable(cid, pos)
   local closest = getClosestFreeTile(cid, pos)
   return type(closest) == "table" and doComparePositions(closest, pos)
end
function onLogin(cid)
   local position = getThingPos(cid)
   if isPathable(position) == false or isWalkable(cid, position) == false then
       doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
   end
   return true
end
Register "xxx" at login
Lua:
registerCreatureEvent(cid, "xxx")
and put it also into creaturescript.xml
Lua:
<event type="xxx" name="xxx" event="script" value="xxx.lua"/>
alternatively put into functions.lua
Lua:
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
Did work for tfs 0.4, not sure if it works with OTX2 aswell.
 
OP
shass

shass

Banned User
Joined
Dec 3, 2017
Messages
67
Reaction score
6
it's working but if the player its on a proteccion zone and log out he's instantly teleported to his temple town
no console errors
what could be wrong?
@Danger II
 
Last edited:
OP
shass

shass

Banned User
Joined
Dec 3, 2017
Messages
67
Reaction score
6
anyone that can convertthe lua to source code or share any script to solve this?
 
Top