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

Push Delay

Zehusss

..
Joined
Apr 16, 2012
Messages
46
Solutions
2
Reaction score
0
hi , when pushing a player from distance it takes 0 seconds instead of 2 i tried to complie many times but it still dont work. i can push instantly from distance. i use tfs 0.4 rev 3777
 
Solution
Try changing this:
Code:
            Dispatcher::getInstance().addTask(createTask(boost::bind(&Game::playerAutoWalk,
                this, player->getID(), listDir)));
            SchedulerTask* task = createSchedulerTask(player->getStepDuration(),
                boost::bind(&Game::playerMoveCreature, this, playerId, movingCreatureId, movingCreaturePos, toPos));
to this:
Code:
            Dispatcher::getInstance().addTask(createTask(boost::bind(&Game::playerAutoWalk,
                this, player->getID(), listDir)));
            SchedulerTask* task = createSchedulerTask(player->getStepDuration()+g_config.getNumber(ConfigManager::PUSH_CREATURE_DELAY),
                boost::bind(&Game::playerMoveCreature, this, playerId...
Keep in mind, that GM have no push delays. Try to push as normal character.
Also in config.lua there's:
Code:
pushCreatureDelay = 2 * 1000
 
i use normal characters , already edited config it works fine when i'm close to other character it takes 2 seconds but when im far away (from distance ) it takes 0 seconds
 
Last edited:
already edited config it works fine when i'm close to other character it takes 2 seconds but when im far away (from distance ) it takes 0 seconds
Such thing happens only if you are doing it as a GM. Check your data/XML/groups.xml

Keep in mind, when you are a normal character, and you push someone who is few sqm away from you, then your character dashes into this creature and pushes it without delay. Such behavior was always on both Open Tibia and on RL Cipsoft's Tibia. Always, and this isn't a bug!
Also on RL Tibia there's technique to push character even 2 SQM at once without delay. Just look for some videos 'how to pk push' etc.
 
so there is no way to make it take 1 second atleast ? poeple using bot to push like that it's easy to get trapped by this way
 
Such thing happens only if you are doing it as a GM. Check your data/XML/groups.xml

Keep in mind, when you are a normal character, and you push someone who is few sqm away from you, then your character dashes into this creature and pushes it without delay. Such behavior was always on both Open Tibia and on RL Cipsoft's Tibia. Always, and this isn't a bug!
Also on RL Tibia there's technique to push character even 2 SQM at once without delay. Just look for some videos 'how to pk push' etc.
Very inaccurate information.
The distance push is bugged in 0.4 r3777 everybody knows it.
By default the distance push is supposed to scale down the delay depending on the distance between the pusher and the target.
With this rev 1 sqm distance will remove the delay completely, which is not how tibia normally works.
On RL Tibia there's techniques to push a character 10 sqm without delay, so what? it's not relevant.

but what do I know, after all your knowledge is lightyears ahead of mine.
 
Very inaccurate information.
The distance push is bugged in 0.4 r3777 everybody knows it.
By default the distance push is supposed to scale down the delay depending on the distance between the pusher and the target.
With this rev 1 sqm distance will remove the delay completely, which is not how tibia normally works.
On RL Tibia there's techniques to push a character 10 sqm without delay, so what? it's not relevant.

but what do I know, after all your knowledge is lightyears ahead of mine.

Changing this would be a source edit. Are you willing to do a source edit?

Code:
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;
       }
   }
Here is the code for pushing creatures in your version of TFS. (Or it should be very similar)
Mine shows it will still have a delay after traveling to the location to push a character.

If yours has "false" instead of true at the end of this line then that is why there is no delay after moving:
Code:
           SchedulerTask* task = createSchedulerTask(std::max((int32_t)SCHEDULER_MINTICKS, player->getStepDuration()),
               boost::bind(&Game::playerMoveCreature, this, playerId, movingCreatureId, movingCreaturePos, toPos, true));
 
Last edited:
I edited my above post. Hope it helps.
mine code is different here it is :
Code:
if(Creature* movingCreature = thing->getCreature())
    {
        uint32_t
 = g_config.getNumber(ConfigManager::PUSH_CREATURE_DELAY);
        if(Position::areInRange<1,1,0>(movingCreature->getPosition(), player->getPosition()) && delay > 0
               && !player->hasCustomFlag(PlayerCustomFlag_CanThrowAnywhere))
        {
            SchedulerTask* task = createSchedulerTask(delay, boost::bind(&Game::playerMoveCreature, this,
                player->getID(), movingCreature->getID(), movingCreature->getPosition(), toCylinder->getPosition()));
            player->setNextActionTask(task);
        }
        else
            playerMoveCreature(playerId, movingCreature->getID(), movingCreature->getPosition(), toCylinder->getPosition());
    }
    else if(thing->getItem())
        playerMoveItem(playerId, fromPos, spriteId, fromStackpos, toPos, count);

    return true;
}

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

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

        player->setNextActionTask(task);
        return false;
    }

    Creature* movingCreature = getCreatureByID(movingCreatureId);
    if(!movingCreature || movingCreature->isRemoved() || movingCreature->getNoMove())
        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(player->getStepDuration(),
                boost::bind(&Game::playerMoveCreature, this, playerId, movingCreatureId, movingCreaturePos, toPos));

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

        player->sendCancelMessage(RET_THEREISNOWAY);
        return false;
    }
 
flatlander is correct, you will have to edit the createSchedulerTask or add your conditions
on cip tibia as cade says
By default the distance push is supposed to scale down the delay depending on the distance between the pusher and the target.
 
Try changing this:
Code:
            Dispatcher::getInstance().addTask(createTask(boost::bind(&Game::playerAutoWalk,
                this, player->getID(), listDir)));
            SchedulerTask* task = createSchedulerTask(player->getStepDuration(),
                boost::bind(&Game::playerMoveCreature, this, playerId, movingCreatureId, movingCreaturePos, toPos));
to this:
Code:
            Dispatcher::getInstance().addTask(createTask(boost::bind(&Game::playerAutoWalk,
                this, player->getID(), listDir)));
            SchedulerTask* task = createSchedulerTask(player->getStepDuration()+g_config.getNumber(ConfigManager::PUSH_CREATURE_DELAY),
                boost::bind(&Game::playerMoveCreature, this, playerId, movingCreatureId, movingCreaturePos, toPos));

It should basically add your push delay to the end of the walk.
 
Solution
Back
Top