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

Discussion in 'Support' started by shass, Oct 5, 2018.

  1. shass

    shass Member

    Joined:
    Dec 3, 2017
    Messages:
    65
    Likes Received:
    6
    Best Answers:
    0
    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?
     
  2. shass

    shass Member

    Joined:
    Dec 3, 2017
    Messages:
    65
    Likes Received:
    6
    Best Answers:
    0
    bump
     
  3. Danger II

    Danger II FluppiX.com

    Joined:
    Nov 21, 2012
    Messages:
    1,553
    Likes Received:
    443
    Best Answers:
    11
    \creaturescripts\scripts create a new file, call it w/e you want (e.g xxx)
    Code (Lua):
    1.  
    2. function isPathable(pos)
    3.      pos.stackpos = 0
    4.      local tile = getThingfromPos(pos).uid
    5.      if tile > 0 then
    6.        return not hasProperty(tile, CONST_PROP_BLOCKSOLID)
    7.      end
    8.      return false
    9. end
    10. local function isWalkable(cid, pos)
    11.    local closest = getClosestFreeTile(cid, pos)
    12.    return type(closest) == "table" and doComparePositions(closest, pos)
    13. end
    14. function onLogin(cid)
    15.    local position = getThingPos(cid)
    16.    if isPathable(position) == false or isWalkable(cid, position) == false then
    17.        doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
    18.    end
    19.    return true
    20. end
    Register "xxx" at login
    Code (Lua):
    1. registerCreatureEvent(cid, "xxx")
    and put it also into creaturescript.xml
    Code (Lua):
    1. <event type="xxx" name="xxx" event="script" value="xxx.lua"/>
    alternatively put into functions.lua
    Code (Lua):
    1. function isPathable(pos)
    2.     if getTileThingByPos(pos).itemid ~= 0 then
    3.         local tile = getThingfromPos(pos).uid  
    4.         if hasProperty(tile, CONST_PROP_BLOCKSOLID) then
    5.             return false
    6.         end
    7.         return true
    8.     end
    9.     return false
    10. end
    Did work for tfs 0.4, not sure if it works with OTX2 aswell.
     
  4. shass

    shass Member

    Joined:
    Dec 3, 2017
    Messages:
    65
    Likes Received:
    6
    Best Answers:
    0
    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: Oct 8, 2018
  5. shass

    shass Member

    Joined:
    Dec 3, 2017
    Messages:
    65
    Likes Received:
    6
    Best Answers:
    0
    bump
     
  6. shass

    shass Member

    Joined:
    Dec 3, 2017
    Messages:
    65
    Likes Received:
    6
    Best Answers:
    0
    bump
     
  7. shass

    shass Member

    Joined:
    Dec 3, 2017
    Messages:
    65
    Likes Received:
    6
    Best Answers:
    0
    anyone that can convertthe lua to source code or share any script to solve this?
     
  8. shass

    shass Member

    Joined:
    Dec 3, 2017
    Messages:
    65
    Likes Received:
    6
    Best Answers:
    0
    bump
     
  9. shass

    shass Member

    Joined:
    Dec 3, 2017
    Messages:
    65
    Likes Received:
    6
    Best Answers:
    0
    bump
     

Share This Page

Loading...