• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

[TFS 1.2] Remove speed cap

guiismiti

Well-Known Member
Joined
May 19, 2014
Messages
313
Solutions
3
Reaction score
67
Hi,

I've been trying to remove the speed cap on TFS 1.2 without success.

What I tried:
Changing 1500 to 15000 (just a testing value) on player.h
Code:
#define PLAYER_MAX_SPEED 15000

Changing updateBaseSpeed() to this
Code:
        void updateBaseSpeed() {
            //if (!hasFlag(PlayerFlag_SetMaxSpeed)) {
                baseSpeed = vocation->getBaseSpeed() + (2 * (level - 1));
            //} else {
            //    baseSpeed = PLAYER_MAX_SPEED;
            //}
        }

Changing this PlayerFlag in const.h, from 1 to 0
Code:
    PlayerFlag_SetMaxSpeed = 0 << 29,

No changes on speed - I tested more than enough times, and a level 600 player with or without strong haste has the same speed as a level 1000 player, with or without strong haste too.

The only way I managed to change the speed somehow was to change the basespeed on vocations.xml, but it looks like the increase there is just a constant increase for all levels.

I'm tired of playing on a level 600 that walks like a 200~300.


Thanks in advance.
 
See this in player.h?
https://github.com/otland/forgotten...0f9c28ddce7ac59bf8714a2bf2/src/player.h#L1242
Code:
Vocation* vocation
It is a pointer to the Vocation's class, the asterisk ( * ) lets you know this

That arrow takes the value on the left and points it to the method on the right
Code:
->


The only way I managed to change the speed somehow was to change the basespeed on vocations.xml, but it looks like the increase there is just a constant increase for all levels.
vocation->getBaseSpeed()
Code:
baseSpeed = vocation->getBaseSpeed() + (2 * (level - 1));
This says, get the player's level, subtract 1 from level, multiply by 2 and then get the player's vocation base speed and add it, then store it in baseSpeed.
https://github.com/otland/forgotten...0f9c28ddce7ac59bf8714a2bf2/src/player.h#L1309
.
 
Last edited:
Editing the sources requires more then a powerful machine, the right compiler, and changing some values around, you need to have an extensive background in C++.

Do I have a background in C++?
No, but neither do you.. so stop messing with the sources and take your curiosity to requests before you break the server if you haven't already..
 
Got something, but still not solved
I changed the "new" speed formula (logarithmic) to the old linear formula.

creature.cpp
Logarithmic formula
Code:
double Creature::speedA = 857.36;
double Creature::speedB = 261.29;
double Creature::speedC = -4795.01;


uint32_t calculatedStepSpeed;
calculatedStepSpeed = floor((Creature::speedA * log((stepSpeed / 2) + Creature::speedB) + Creature::speedC) + 0.5);

Linear formula (I replaced and adjusted the entire function, not just these lines)
Code:
uint32_t stepSpeed = getStepSpeed();

And, like I mentioned:
player.h
Removed the limit on baseSpeed
Code:
        void updateBaseSpeed() {
            //if (!hasFlag(PlayerFlag_SetMaxSpeed)) {
                baseSpeed = vocation->getBaseSpeed() + (2 * (level - 1));
            //} else {
            //    baseSpeed = PLAYER_MAX_SPEED;
            //}
        }

Raised PLAYER_MAX_SPEED
Code:
#define PLAYER_MAX_SPEED 15000


The result is - when I use the minimap, the speed has no more limit, just like I wanted. But when I use the arrows to walk, it is still limited.
What am I missing?
 

Similar threads

Back
Top