Do the fast push game.cpp

cabrera2608

Member
Joined
Dec 21, 2018
Messages
65
Best answers
0
Reaction score
2
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
689
Best answers
9
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

Member
Joined
Dec 21, 2018
Messages
65
Best answers
0
Reaction score
2
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
689
Best answers
9
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

Member
Joined
Dec 21, 2018
Messages
65
Best answers
0
Reaction score
2
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
689
Best answers
9
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

Member
Joined
Dec 21, 2018
Messages
65
Best answers
0
Reaction score
2
[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

Member
Joined
Dec 21, 2018
Messages
65
Best answers
0
Reaction score
2
HELP ME!
still having a 2 second delay when moving
 
OP
C

cabrera2608

Member
Joined
Dec 21, 2018
Messages
65
Best answers
0
Reaction score
2
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
448
Best answers
41
Reaction score
270
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
 

M0ustafa

Î Àm ŁĕğẹňĎ
Support Team
Joined
Mar 4, 2017
Messages
817
Best answers
81
Reaction score
285
Location
Egypt
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

Member
Joined
Dec 21, 2018
Messages
65
Best answers
0
Reaction score
2
i'm still not successful, tthe player is yhave delay, hopefully someone can help me
 
OP
C

cabrera2608

Member
Joined
Dec 21, 2018
Messages
65
Best answers
0
Reaction score
2
guys i still don't succeed
someone could help me I would really appreciate it.
 

Yaboihunna

Member
Joined
Mar 27, 2019
Messages
125
Best answers
0
Reaction score
1
do you have to just change createschedulertask(delay, to createschedulertask(Milliseconds here?,
 

M0ustafa

Î Àm ŁĕğẹňĎ
Support Team
Joined
Mar 4, 2017
Messages
817
Best answers
81
Reaction score
285
Location
Egypt
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.
 
OP
C

cabrera2608

Member
Joined
Dec 21, 2018
Messages
65
Best answers
0
Reaction score
2
do you have to just change createschedulertask(delay, to createschedulertask(Milliseconds here?,
Is it an answer or is it a question? xd
even change the value from sources and i don't succeed :c
 

Sarah Wesker

ค∂vαηcε รүηтαx ❤
Joined
Mar 16, 2017
Messages
448
Best answers
41
Reaction score
270
Location
London
You must also do the same with this function:
Code:
void Game::playerMoveCreature(Player* player, Creature* movingCreature, const Position& movingCreatureOrigPos, Tile* toTile)
 
Top