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

Do the fast push game.cpp

cabrera2608

New Member
Joined
Dec 21, 2018
Messages
110
Solutions
1
Reaction score
4
As the title says, I'm looking for the line of the sources trying to make the move faster, but it does not work.
I leave a video of how I want to put it....

C++:
bool Game::playerMoveCreature(uint32_t playerId, uint32_t movingCreatureId,
    const Position& movingCreaturePos, const Position& toPos, bool delay)
{
    Player* player = getPlayerByID(playerId);
    if(!player || player->isRemoved() || player->hasFlag(PlayerFlag_CannotMoveCreatures))
        return false;

    if(!player->canDoAction())
    {
        SchedulerTask* task = createSchedulerTask(player->getNextActionTime(),
            boost::bind(&Game::playerMoveCreature, this, playerId, movingCreatureId, movingCreaturePos, toPos, true));
        player->setNextActionTask(task);
        return false;
    }

    Creature* movingCreature = getCreatureByID(movingCreatureId);
    if(!movingCreature || movingCreature->isRemoved() || !player->canSeeCreature(movingCreature))
        return false;

    player->setNextActionTask(NULL);
    if(!Position::areInRange<1,1,0>(movingCreaturePos, player->getPosition()) && !player->hasCustomFlag(PlayerCustomFlag_CanMoveFromFar))
    {
        //need to walk to the creature first before moving it
        std::list<Direction> listDir;
        if(getPathToEx(player, movingCreaturePos, listDir, 0, 1, true, true))
        {
            Dispatcher::getInstance().addTask(createTask(boost::bind(&Game::playerAutoWalk,
                this, player->getID(), listDir)));
            SchedulerTask* task = createSchedulerTask(std::max((int32_t)SCHEDULER_MINTICKS, player->getStepDuration()),
                boost::bind(&Game::playerMoveCreature, this, playerId, movingCreatureId, movingCreaturePos, toPos, true));

            player->setNextWalkActionTask(task);
            return true;
        }

        player->sendCancelMessage(RET_THEREISNOWAY);
        return false;
    }
    else if(delay)
    {
        uint32_t delayTime = g_config.getNumber(ConfigManager::PUSH_CREATURE_DELAY);
        if(delayTime > 0)
        {
            SchedulerTask* task = createSchedulerTask(delayTime,
                boost::bind(&Game::playerMoveCreature, this, playerId, movingCreatureId, movingCreaturePos, toPos, false));
            player->setNextActionTask(task);
            return true;
        }
    }

Video
 
You need to look inside creature.cpp for void Creature::eek:nCreatureMove:
C++:
//diagonal extra cost
lastStepCost = 3;
And for int64_t Creature::getStepDuration(Direction dir) const:
C++:
stepDuration *= 3;

Change them to 1.
 
You need to look inside creature.cpp for void Creature::eek:nCreatureMove:
C++:
//diagonal extra cost
lastStepCost = 3;
And for int64_t Creature::getStepDuration(Direction dir) const:
C++:
stepDuration *= 3;

Change them to 1.

if it worked friend, but now corner now all very fast.
any solution?
 
If you want only pushing then reverse changes and inside game.cpp function Game::playerMoveCreature find:
C++:
SchedulerTask* task = createSchedulerTask(std::max((int32_t)SCHEDULER_MINTICKS, player->getStepDuration()),
And change player->getStepDuration() to 1. Not tested but should do the work.
 
If you want only pushing then reverse changes and inside game.cpp function Game::playerMoveCreature find:
C++:
SchedulerTask* task = createSchedulerTask(std::max((int32_t)SCHEDULER_MINTICKS, player->getStepDuration()),
And change player->getStepDuration() to 1. Not tested but should do the work.

I still can not push fast.
use tfs 0.4
 
Probably because of this:
C++:
uint32_t delayTime = g_config.getNumber(ConfigManager::PUSH_CREATURE_DELAY);
You have delay set in config.
 
[QUOTE = "margoh, post: 2564807, miembro: 179653"]
Probably because of this:
[código = cpp]
uint32_t delayTime = g_config.getNumber (ConfigManager :: PUSH_CREATURE_DELAY);
[/código]
You have delay set in config.
[/CITAR]
friend so I have it
some solution to the friend push?
I'm desperate :c
 
please I still can not solve it, and I can not find any post related to it
already try in game.cpp and in confi.lua and nothing
 
options:
config.lua -> change the value of
Code:
pushCreatureDelay
game.cpp -> search the function
Code:
Game::playerMoveThing
here you can notice the following
37685
"delay" is the interval on milliseconds, is possible what that value doesn't exists, but you can change that value for other, per example 400 ms
example:
37686
 
So setting the config one's delay to "0" and the source one's delay to "0 are the fastest Close 1SQM/Distance 2SQM push can be done in a server?
 
i'm still not successful, tthe player is yhave delay, hopefully someone can help me
 
guys i still don't succeed
someone could help me I would really appreciate it.
 
do you have to just change createschedulertask(delay, to createschedulertask(Milliseconds here?,
 
Yeah that one works but it has some relation with 1 SQM push so when lowering delay for 2SQM they delay for 1SQM will be lowered too.
 
You must also do the same with this function:
Code:
void Game::playerMoveCreature(Player* player, Creature* movingCreature, const Position& movingCreatureOrigPos, Tile* toTile)
 
Back
Top