Do the fast push game.cpp

cabrera2608

New Member
Joined
Dec 21, 2018
Messages
24
Reaction score
0
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
 

margoh

{{ user.title }}
Joined
Apr 1, 2013
Messages
684
Reaction score
229
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.
 
OP
C

cabrera2608

New Member
Joined
Dec 21, 2018
Messages
24
Reaction score
0
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?
 

margoh

{{ user.title }}
Joined
Apr 1, 2013
Messages
684
Reaction score
229
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.
 
OP
C

cabrera2608

New Member
Joined
Dec 21, 2018
Messages
24
Reaction score
0
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
 

margoh

{{ user.title }}
Joined
Apr 1, 2013
Messages
684
Reaction score
229
Probably because of this:
C++:
uint32_t delayTime = g_config.getNumber(ConfigManager::PUSH_CREATURE_DELAY);
You have delay set in config.
 
OP
C

cabrera2608

New Member
Joined
Dec 21, 2018
Messages
24
Reaction score
0
[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
 
OP
C

cabrera2608

New Member
Joined
Dec 21, 2018
Messages
24
Reaction score
0
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
 

Sarah Wesker

ค∂vαηcε รүηтαx ❤
Joined
Mar 16, 2017
Messages
412
Reaction score
236
Location
London
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
 

Mustafa1337

Î Àm ŁĕğẹňĎ
Joined
Mar 4, 2017
Messages
375
Reaction score
92
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?
 
OP
C

cabrera2608

New Member
Joined
Dec 21, 2018
Messages
24
Reaction score
0
i'm still not successful, tthe player is yhave delay, hopefully someone can help me
 
Top