• 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!

How to set NPC walkInterval to 1000?

tylerdurden

New Member
Joined
Jan 10, 2022
Messages
7
Reaction score
0
hello i make old tibia and i cannot manage npc to walk like in old tibia. they walked fast like every second. now they walk slow. now they walk like 2 seconds because walkinterval is 2000 but if i set walkinterval to 1000 it doesnt work. i dont want speed only time between moves so walk interval
sorry my english i so bad :(
 
Last edited:

glapa93

Member
Joined
Nov 26, 2021
Messages
30
Reaction score
9
Hmmm...
In TFS you can not set walk interval to and below 1000 milisecons because I believe it is related to onThink function in npc.cpp. It's quite bugged because of this fact as you can only set the NPC speed tobe greater than 1000. It also results in movin slower. If you set walkInterval to let's say 5000, the speed of your character will not only be 5000 miliseconds but also wait 5000 before making next step.

You would have to set your own "if" instruction to execute "addEventWalk" below 1 second in void Npc::eek:nThink and then in bool Npc::getNextStep to execute every 2 second, so it means in real 1 seconds as onThink executed walkEvent and getNextStep executed walking after 1 seconds. So it looks like 1 second.

I no longer use TFS but I would try something like this:
C++:
change to:
bool Npc::getNextStep(Direction& dir, uint32_t& flags)
{

    if (Creature::getNextStep(dir, flags)) {
        return true;
    }

    if (walkTicks == 0) {
        return false;
    }

    if (focusCreature != 0) {
        return false;
    }

    int time_passed = getTimeSinceLastMove();

    if (time_passed >= 2000) // + step duration?
    {
        return getRandomStep(dir);

    }  
    //return getRandomStep(dir);

}

and change to:

C++:
void Npc::onThink(uint32_t interval)
{
    Creature::onThink(interval);

    if (npcEventHandler) {
        npcEventHandler->onThink();
    }

    int time_passed = getTimeSinceLastMove();

    if (!isIdle && time_passed < 1000) // or step duration?
    {
        addEventWalk();
    }
}

Let me know if it works I havent got time now to test it. I am on my phone on holiday
 
Last edited:

glapa93

Member
Joined
Nov 26, 2021
Messages
30
Reaction score
9
Send me the tallbar files with formulas because I need to pay attention to the the ground speed etc. I know that even Nostalrius got it wrong. My brain is too small now. Im drunk af under a palm tree.
 
Last edited:

glapa93

Member
Joined
Nov 26, 2021
Messages
30
Reaction score
9
monster.cpp:
bool Monster::getNextStep(Direction& direction, uint32_t& flags){

if (!followCreature || !hasFollowPath)
if (getTimeSinceLastMove() > 800) { // minotaur walks constantly on desert, snow etc but stops for a moment on tiles like black marble floor etc
getRandomStep(getPosition(), direction);
}
}

Note: NPC and monsters walk faster in new Tibia aswell. It's not just about old Tibia. The Forgottenserver is bugged.
 

Attachments

  • minotaur walk 4.gif
    minotaur walk 4.gif
    891 KB · Views: 11 · VirusTotal
  • minotaur walk 5.gif
    minotaur walk 5.gif
    2.6 MB · Views: 11 · VirusTotal
  • minotaur walk 7.gif
    minotaur walk 7.gif
    361.6 KB · Views: 11 · VirusTotal
Last edited:
OP
OP
T

tylerdurden

New Member
Joined
Jan 10, 2022
Messages
7
Reaction score
0
bool Monster::getNextStep(Direction& direction, uint32_t& flags) {

bool result = false;
if (listWalkDir.empty() && (!followCreature || !hasFollowPath)) {
if (getTimeSinceLastMove() >= 800)
{
randomStepping = true;
result = getRandomStep(getPosition(), direction);
}
}
else if (followCreature || !listWalkDir.empty())
{
randomStepping = false;
result = Creature::getNextStep(direction, flags);
if (result) {
flags |= FLAG_PATHFINDING;
}
else {
if (ignoreFieldDamage) {
ignoreFieldDamage = false;
updateMapCache();
}

if (attackedCreature && attackedCreature == followCreature) {
if (isFleeing()) {
result = getDanceStep(getPosition(), direction, false, false);
}
else if (mType->info.staticAttackChance < static_cast<uint32_t>(uniform_random(1, 100))) {
result = getDanceStep(getPosition(), direction);
}
}
}
}

return result;
}

its not working because function returns every result variable and skips getTimeSinceLastMove... :(
 
Last edited:
Top