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

Solved Weird monster behaviour in TFS 1.1?

Ahilphino

Excellent OT User
Joined
Jun 5, 2013
Messages
1,667
Solutions
1
Reaction score
726
The monster AI in tfs 1.1 (idk about 1.0) is EXTREMELY dumb. This has discouraged me from using TFS 1.1 even though i've spent so much time with it.

A couple of examples:

If you chase any ranged mob, let's take lizard legionaire, they will turn around every time they make an attack and this causes them to barely run away even if you set their speed to 2000.

If you're getting chased by a fast monster, let's say a grim reaper - he will stop at times. Especially when you're in melee range, then just decide to run away. It will take him like one second to react and start running after you.


There's youtube videos about it a couple of posts below
 
Last edited:
which are the codes to improve monster behavior/ AI then?
how hard woul be to add tfs 0.4 monster ai?
Post automatically merged:

Geisor version.

Also found something weird. Monsters always look at you directly. And it leads to them snapping back and forth.

Fixed with Geisor additional fix above.

Geisor Version.

Geisor Version with 6 characters
can you share the order of the coommits that you followed pls?
Post automatically merged:

@Gesior.pl so then this code is the best?
Lua:
  if (hasFollowPath) {
            if (walkDelay <= 0) {
                    g_dispatcher.addTask(createTask(std::bind(&Game::updateCreatureWalk, &g_game, getID())));
                } else if(!isUpdatePathScheduled) {
                    isUpdatePathScheduled = true;
                    g_scheduler.addEvent(createSchedulerTask(walkDelay, std::bind(&Game::updateCreatureWalk, &g_game, getID())));
                }
                isUpdatingPath = true;
            }
or this one?
Code:
    if (hasFollowPath) {
            isUpdatingPath = false;
            g_dispatcher.addTask(createTask(std::bind(&Game::updateCreatureWalk, &g_game, getID())));
        }
Post automatically merged:

also what happened with this repo?
https://github.com/gesior/forgottenserver/commit/48cb292d56d36e87ab25e2bc00bcc5c61c4cc842


edit i adapted gesior code to make it work with tfs 1.5 (for me this one works pretty good the mosnter reaction is fast and attack okey too
Lua:
        if (hasFollowPath) {
            if (getWalkDelay() <= 0) {
                    g_dispatcher.addTask(createTask(std::bind(&Game::updateCreatureWalk, &g_game, getID())));
                } else if(!isUpdatePathScheduled) {
                    isUpdatePathScheduled = true;
                    //g_scheduler.addEvent(createSchedulerTask(getWalkDelay, std::bind(&Game::updateCreatureWalk, &g_game, getID())));
                    //g_scheduler.addEvent(createSchedulerTask(&Creature::getWalkDelay, std::bind(&Game::updateCreatureWalk, &g_game, getID())));
                    g_scheduler.addEvent(createSchedulerTask(200, std::bind(&Game::updateCreatureWalk, &g_game, getID())));
                }
                isUpdatingPath = true;
            }
 
Last edited:
Back
Top