• 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+ Weird monster/npc walk behavior

Cesrarr

Member
Joined
Oct 3, 2018
Messages
34
Reaction score
7
Im using Tfs 1.3, was searching about it, and found some topics:

Solved - Weird monster behaviour in TFS 1.1?
Windows - Monsters lagging/appear to be dashing

"As you can see in the first video (TFS 0.4 REV 3777), there's really nothing weird about how the monster behaves, it instantly follows you when you run away etc."

"In the second video however (LATEST TFS 1.1 REV), the monster always stops for awhile if you're running away and sometimes he just stops at random times when chasing you."

Then the solution to it was change in creature.cpp:
Code:
        if (hasFollowPath) {
            isUpdatingPath = false;
            g_dispatcher.addTask(createTask(std::bind(&Game::updateCreatureWalk, &g_game, getID())));
        }

It also solved my problem here with weird monster behavior.

Now im trying solve that behavior from NPCs when chasing any monster:


Its a npc that attack near monsters, the problem is he attack, stop, attack stop, etc.

Any idea on change it?
 
Think interval for creatures is set to 1000ms. Thats what happens here i believe.
But its not advised to change it to lower values.
 
There's any "better solution" to make npc follow target without walk delay, than decreasing creature think interval?
What impacts can cause setting a lower value to it?
 
About lag when new monster appear:
There is an event 'onCreatureAppear(cid)' in NPC. You could rewrite part of 'kill monster NPC' to make it check, if it has target and if not, then it should target monster that appeared. onCreatureAppear function in NPC:
otland/forgottenserver

Problem is that, this event only executes for Players, not all Creatures:
otland/forgottenserver
So you need to edit source files to make it work.

About lag-walk when follow monster:
I don't know what kind of walking uses this NPC. Probably it's not default 'walk to position' (controlled by engine). Looks more like 'do one step in direction to monster every "onThink" (one per second)'. It should use:
PHP:
selfMoveTo(x,y,z)
It's special NPC-only function to make it walk to some position. Pass there position of target monster every second (to update target position) and it should walk smooth.
 
Back
Top