As the title says i have a problem with base speed in tfs 1.4.2 i have done changes in player.h and protocolgame.cpp
changes in player.h
i belive this part is correct, i want all levels have the same speed
changes in protocolgame.cpp
This part is what have me confused because i found another tread where they say change from "getBaseSpeed() / 2 " to "getBaseSpeed() / 1 "in protocolgame but i find it on multiple spots and it returns negative speed if i leave it as is atm.
When i added this the speed got set correctly but i got lagwalking that way so i reverted to /2 everywhere and went with 2x values in vocations.xml and increased PLAYER_MAX_SPEED to be twice as high i want maxspeed to be
changes in player.h
Lua:
static constexpr int32_t PLAYER_MAX_SPEED = 3000;
static constexpr int32_t PLAYER_MIN_SPEED = 10;
Lua:
void updateBaseSpeed() {
if (!hasFlag(PlayerFlag_SetMaxSpeed)) {
baseSpeed = vocation->getBaseSpeed();
} else {
baseSpeed = PLAYER_MAX_SPEED;
}
}
changes in protocolgame.cpp
Lua:
msg.add<uint16_t>(player->getBaseSpeed()/1);
Lua:
void ProtocolGame::sendChangeSpeed(const Creature* creature, uint32_t speed)
{
NetworkMessage msg;
msg.addByte(0x8F);
msg.add<uint32_t>(creature->getID());
msg.add<uint16_t>(creature->getBaseSpeed() / 1);
msg.add<uint16_t>(speed / 1);
writeToOutputBuffer(msg);
}
Post automatically merged:
Code:
msg.add<uint16_t>(creature->getStepSpeed() / 1);
Last edited: