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

C++ Add a turn delay for NPCs in Avesta distribution

Raffe123

New Member
Joined
Nov 17, 2013
Messages
6
Reaction score
0
Is this possible? Right now they're responding WAY to fast when facing the player. Any C++ experts got any ideas?




This is the piece of code I need to edit
Code:
int NpcScriptInterface::luaFaceCreature(lua_State *L)
{
    // facePlayer(cid)
    uint32_t cid = popNumber(L);

    ScriptEnviroment* env = getScriptEnv();

    Npc* npc = env->getNpc();
    if (npc) {
        Creature* creature = env->getCreatureByUID(cid);
        if (creature) {
            g_game.internalCreatureTurn(npc, npc->getDir(creature));
        }
    }

    return 1;
}
 
Possible to use something like this?
Code:
createSchedulerTask(400, boost::bind(&Game::internalCreatureTurn, .................));

so the npc would take e.g 400 ms to turn to player...
should work right?
edit:
Im pretty sure it would be way easier to use edited that with lua, in NPC file system..
 
Back
Top