• 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+ Old elevation parcel block

johnsamir

Active Member
Joined
Oct 13, 2009
Messages
232
Solutions
1
Reaction score
35
Location
Nowhere
Hello

I'm trying to add old elevation system for tfs 1.3 8.6

I have added these two commits and it partially works, when i stack two parcels it block players path, but it seems like the player is intending to walk over the parcel again and again. I have tested with otclientv8 and that is what is occurring. Can somebody help me ? with mehah otclient is just kicking me after few seccond of trying it.

I think also i might be something related to otclient? the newers versions doesn't check if servers is 7.40 or 7,72 for elevation as it used to do
now the code is a bit different, it might be the same for mehah otc or otcv8
 
Last edited:
Solution
Lua:
 nextWalkDir = nil
  removeEvent(autoWalkEvent)
  autoWalkEvent = nil
  local preWalked = false
  local playerTile = player:getTile()
   if toTile and toTile:isWalkable() then
    if not player:isServerWalking() and not ignoredCanWalk then
        if (playerTile and (toTile:getElevation() - playerTile:getElevation() <= 1) or (playerTile:getElevation() > 3)) then
            player:preWalk(dir)
            preWalked = true
        end
    end
  else
    local playerTile = player:getTile()
    if (playerTile and playerTile:hasElevation(3) and canChangeFloorUp(toPos)) or canChangeFloorDown(toPos) or (toTile and toTile:isEmpty() and not toTile:isBlocking()) then
      player:lockWalk(100)
    elseif player:isServerWalking() then...
OP
OP
J

johnsamir

Active Member
Joined
Oct 13, 2009
Messages
232
Solutions
1
Reaction score
35
Location
Nowhere
UP !
Now i have been testing with this code. and it partially works( it blocks height. but it looks like the players is trying to walk over the parcel anyway) too this is better because it allows to disable /enable the hehight block feature. but i think this is might be caused by client side
im using tfs 1.3 protocol 8.6
giphy.gif

this is how is working in the server
 

kay

Legendary OT User
Joined
Apr 23, 2013
Messages
899
Solutions
9
Reaction score
1,199
Location
32316,31942,7
YouTube
TibiantisOnline
OP
OP
J

johnsamir

Active Member
Joined
Oct 13, 2009
Messages
232
Solutions
1
Reaction score
35
Location
Nowhere
You're only changing it on the server's side. You need to change it in the client as well, otherwise it will keep trying to proceed a pre-walk.
Check this thread: Wrong behaviour when walking into stacked items (like 2 or more parcels) (https://otland.net/threads/wrong-behaviour-when-walking-into-stacked-items-like-2-or-more-parcels.276474/)
yes, that guy is helping me. He gave me a code that i don't know if it works, because after added it to walking.lua i can't walk with arrows at all. Could you help me in the thread that you have shown please?
Lua:
 if toTile and toTile:isWalkable() then
     local playerTile = player:getTile()
 if (playerTile and (toTile:hasElevation() - playerTile:hasElevation() <= 1) or (playerTile:hasElevation() > 3))
    player:preWalk(dir)
      preWalked = true
      else player:lockWalk(100)
      end
    if not player:isServerWalking() and not ignoredCanWalk then
      player:preWalk(dir)
      preWalked = true
    end
also i can't just walk, it only tries to walk when im infront of stacked parcels(and it is still jumping) but if i try to walk in other direction it doesn't do anything
 
Last edited:

kay

Legendary OT User
Joined
Apr 23, 2013
Messages
899
Solutions
9
Reaction score
1,199
Location
32316,31942,7
YouTube
TibiantisOnline
yes, that guy is helping me. He gave me a code that i don't know if it works, because after added it to walking.lua i can't walk with arrows at all. Could you help me in the thread that you have shown please?
Lua:
 if toTile and toTile:isWalkable() then
     local playerTile = player:getTile()
 if (playerTile and (toTile:hasElevation() - playerTile:hasElevation() <= 1) or (playerTile:hasElevation() > 3))
    player:preWalk(dir)
      preWalked = true
      else player:lockWalk(100)
      end
    if not player:isServerWalking() and not ignoredCanWalk then
      player:preWalk(dir)
      preWalked = true
    end
I don't use otc, but I believe it should be getElevation. I guess hasElevation only returns true or false. That's what this method name indicates at least.
 
OP
OP
J

johnsamir

Active Member
Joined
Oct 13, 2009
Messages
232
Solutions
1
Reaction score
35
Location
Nowhere
I don't use otc, but I believe it should be getElevation. I guess hasElevation only returns true or false. That's what this method name indicates at least.
ok i was palcing the code in the wrong line i guess now i placed it few lines below and i can walk now, but the code itself does not works i tried changing hasElevation to getElevation but is not working , and ain't no getting errors in console either.

Lua:
    local playerTile = player:getTile()
    if (playerTile and playerTile:hasElevation(3) and canChangeFloorUp(toPos)) or canChangeFloorDown(toPos) or (toTile and toTile:isEmpty() and not toTile:isBlocking()) then
      local playerTile = player:getTile()
 if (playerTile and (toTile:hasElevation() - playerTile:getElevation() <= 1) or (playerTile:getElevation() > 3)) then
      player:lockWalk(100)
    elseif player:isServerWalking() then
      g_game.stop()
      return
    elseif not toTile then
      player:lockWalk(100) -- bug fix for missing stairs down on map
    else
      if g_app.isMobile() and dir <= Directions.West then
        turn(dir, ticks > 0)
      end
      return -- not walkable tile
    end
  end
end
 
OP
OP
J

johnsamir

Active Member
Joined
Oct 13, 2009
Messages
232
Solutions
1
Reaction score
35
Location
Nowhere

Terotrificy

Well-Known Member
Joined
Oct 18, 2020
Messages
236
Solutions
9
Reaction score
78
Location
Santiago, Chile.
Lua:
 nextWalkDir = nil
  removeEvent(autoWalkEvent)
  autoWalkEvent = nil
  local preWalked = false
  local playerTile = player:getTile()
   if toTile and toTile:isWalkable() then
    if not player:isServerWalking() and not ignoredCanWalk then
        if (playerTile and (toTile:getElevation() - playerTile:getElevation() <= 1) or (playerTile:getElevation() > 3)) then
            player:preWalk(dir)
            preWalked = true
        end
    end
  else
    local playerTile = player:getTile()
    if (playerTile and playerTile:hasElevation(3) and canChangeFloorUp(toPos)) or canChangeFloorDown(toPos) or (toTile and toTile:isEmpty() and not toTile:isBlocking()) then
      player:lockWalk(100)
    elseif player:isServerWalking() then
      g_game.stop()
      return
    elseif not toTile then
      player:lockWalk(100) -- bug fix for missing stairs down on map
    else
      if g_app.isMobile() and dir <= Directions.West then
        turn(dir, ticks > 0)
      end
      return -- not walkable tile
    end
  end
 
Solution
OP
OP
J

johnsamir

Active Member
Joined
Oct 13, 2009
Messages
232
Solutions
1
Reaction score
35
Location
Nowhere
Lua:
 nextWalkDir = nil
  removeEvent(autoWalkEvent)
  autoWalkEvent = nil
  local preWalked = false
  local playerTile = player:getTile()
   if toTile and toTile:isWalkable() then
    if not player:isServerWalking() and not ignoredCanWalk then
        if (playerTile and (toTile:getElevation() - playerTile:getElevation() <= 1) or (playerTile:getElevation() > 3)) then
            player:preWalk(dir)
            preWalked = true
        end
    end
  else
    local playerTile = player:getTile()
    if (playerTile and playerTile:hasElevation(3) and canChangeFloorUp(toPos)) or canChangeFloorDown(toPos) or (toTile and toTile:isEmpty() and not toTile:isBlocking()) then
      player:lockWalk(100)
    elseif player:isServerWalking() then
      g_game.stop()
      return
    elseif not toTile then
      player:lockWalk(100) -- bug fix for missing stairs down on map
    else
      if g_app.isMobile() and dir <= Directions.West then
        turn(dir, ticks > 0)
      end
      return -- not walkable tile
    end
  end
Thank you a ton !
 
Top