• 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+ Lost Woods

Leo32

Getting back into it...
Joined
Sep 21, 2007
Messages
987
Solutions
14
Reaction score
532
I have a lost woods style quest with an endless repeating wood.
3x3 copy of an area that teleports you to the other side until you either leave via the exit or walk the appropriate directions to get to the end.

Using an onStepIn or onStepOut movements trigger means the teleport happens immediately on leaving the previous square, which leaves a jarring screen-hop.
(In a perfect scenario for the teleport to 'look' seamless, you want it to occur after you've moved into the teleport square and the walking animation has finished, but not too slow as to happen after you take the next step).

The way I've overcome is via using creature:getSpeed() and adding a variable delay to the player:teleport - depending on their speed.
This seems to work fine, but this is a local environment so I have 0 lag and therefore can't theorize if this even work in production where ping delays are involved and how that messes with things.

I'm wondering if there is a smarter way of doing this that I'm just not aware of?
 
Unless you want to wait until they step out of the sqm, then this is the correct way to do it.
In the delayed function execution, I would verify the position is correct, and I would re-initialize the Player object, as the userdata may not exist. (etc if they die mid-movement).
So passing player GUID, and then redeclare the player object instead of passing along the player object directly through etc addEvent.

I'm curious at to what formula you use to measure the event delay using the players speed. Does creature:getSpeed() return sqm movement speed in milli-seconds, or are you playing with an algorythm?
 
Nice, it seems i am not the only one with that idea....
To me it feels a bit too much... i just used a simple teleport...

But it might be nice to use some mapgen mechanisms, or if i remember correctly @Delusion made functions to paste mapping pieces...
maybe if you use it wisely you could make something 'endless'
 
Unless you want to wait until they step out of the sqm, then this is the correct way to do it.
In the delayed function execution, I would verify the position is correct, and I would re-initialize the Player object, as the userdata may not exist. (etc if they die mid-movement).
So passing player GUID, and then redeclare the player object instead of passing along the player object directly through etc addEvent.

I'm curious at to what formula you use to measure the event delay using the players speed. Does creature:getSpeed() return sqm movement speed in milli-seconds, or are you playing with an algorythm?

I'm using the tile/speed breakpoints to calculate the delay:

creature:getSpeed() gets the players absolute speed.

I'm not sure if the TFS tilespeed breakpoints are 1:1, although they seem to be as the tileSpeed is part the shared tibia assets.
And I've just eyeballed the delay in ms depending on the breakpoint.

It works, but its not exactly clean for my standards, hence the post.
The fail-safe is using the next SQM as a hard teleport - for if players do janky stuff and try to move and logout while the delay is in effect etc etc.
I'm sure there is probably a big brain way if you know the exact ms it takes for a player to walk 1SQM (depending on the breakpoint), but it just wasn't worth the effort, as I haven't seen that sort of info posted anywhere else and trying to get it exact would take a good day or two of trial and error testing.

Unless you want to wait until they step out of the sqm

This seems to be worse in action as you teleport them immediately on trying to move, which 'juts' them back and teleports them to the new position.
Meaning they need to move twice to get off that square, didn't feel right.

Nice, it seems i am not the only one with that idea....
To me it feels a bit too much... i just used a simple teleport...

But it might be nice to use some mapgen mechanisms, or if i remember correctly @Delusion made functions to paste mapping pieces...
maybe if you use it wisely you could make something 'endless'

I got actually got a response from @Delusion on discord @Animera and he hasn't got an idea of a better implementation, so its what I've settled with.

Pasting new map/tiles on the fly would be super dangerous.
You're already pretty limited with the 3x3 map you can construct already, as you want to keep the tiles in a perfect grid to ensure the tiles and decoration you place on them are in the sweet-spot where their randomized sprites "line-up" and are identical on the adjacent grid.

If you're implementing this yourself, I would recommend also making it so players cannot place items on the ground in the area.
I would also not have creatures there, save it for the end/solution area. As it ruins the illusion due to the nature of teleporting from one end to the other.
 
Last edited:
Back
Top