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

TFS 1.X+ TFS 1.3 Walking and using Runes and Potions

SlayingWorld

Active Member
Joined
Jan 23, 2014
Messages
156
Reaction score
37
Location
USA
Hello all,

I've looked around and cant seem to get a good answer to this as everything is outdated.


What i'm trying to achieve:
Players to be able to be running and shooting Runes and drinking Potions.
Ex: Be able to hunt in falcons/summer elfs AOE style like RL tibia.

Basically, the problem:
Players cant drink potions or throw runes while they are walking/running in game. They actually have to pause to do any of that. I want to change that to be able to do that while running.

What i've tried:
I have changed the config.lua part

Lua:
-- Item Usage
-- Do not touch here
-- Avoid use of WIPE program to crash the distro
timeBetweenActions = 500
timeBetweenExActions = 700

to

Code:
-- Item Usage
-- Do not touch here
-- Avoid use of WIPE program to crash the distro
timeBetweenActions = 50
timeBetweenExActions = 700

But this seems to make no change at all to that problem.

If someone can point me in the right place where i can edit my sources to be able to change this.
Thanks in advance!

I don't mind paying someone also.

This is the current stuff im using:

LATEST GIT OF
OTSERVBR-GLOBAL
 
to use rune and potion while running

find this function (line 1321)
C++:
void Player::onWalk(Direction& dir)
{
    Creature::onWalk(dir);
    setNextActionTask(nullptr);
    setNextAction(OTSYS_TIME() + getStepDuration(dir));
}

change for this:
C++:
void Player::onWalk(Direction& dir)
{
    Creature::onWalk(dir);
    setNextActionTask(nullptr);
   // setNextAction(OTSYS_TIME() + getStepDuration(dir));
}

now if you want it to use rune and potion at the same time, you will have to remove the delay in the source, and add exhaust for storage in potion.lua

in source find this function:
C++:
bool Actions::useItemEx(Player* player, const Position& fromPos,
                        const Position& toPos, uint8_t toStackPos,
                        Item* item, bool isHotkey,
                        Creature* creature/* = nullptr*/) {
    DLOG_F(INFO, "Use Item Ex Player[%d], From Position:x[%d], y[%d], z[%d], "
        "To Position:x[%d], y[%d], z[%d], toStackPos[%d], Item cid:[%d], "
        "isHotkey:[%d]", player == nullptr ? 0 : player->getID(),
        fromPos.getX(), fromPos.getY(), fromPos.getZ(), toPos.getX(),
        toPos.getY(), toPos.getZ(), toStackPos, item == nullptr ?
        0 : item->getClientID(), isHotkey);

    player->setNextAction(OTSYS_TIME() + g_config.getNumber(
                                    ConfigManager::EX_ACTIONS_DELAY_INTERVAL));

    Action* action = getAction(item);
    if (action == nullptr) {
        player->sendCancelMessage(RETURNVALUE_CANNOTUSETHISOBJECT);
        DLOG_F(WARNING, "Player can't use object(no action)!");
        return false;
    }

and change for this:
C++:
bool Actions::useItemEx(Player* player, const Position& fromPos,
                        const Position& toPos, uint8_t toStackPos,
                        Item* item, bool isHotkey,
                        Creature* creature/* = nullptr*/) {
    DLOG_F(INFO, "Use Item Ex Player[%d], From Position:x[%d], y[%d], z[%d], "
        "To Position:x[%d], y[%d], z[%d], toStackPos[%d], Item cid:[%d], "
        "isHotkey:[%d]", player == nullptr ? 0 : player->getID(),
        fromPos.getX(), fromPos.getY(), fromPos.getZ(), toPos.getX(),
        toPos.getY(), toPos.getZ(), toStackPos, item == nullptr ?
        0 : item->getClientID(), isHotkey);

    player->setNextAction(g_config.getNumber(
                                    ConfigManager::EX_ACTIONS_DELAY_INTERVAL));

    Action* action = getAction(item);
    if (action == nullptr) {
        player->sendCancelMessage(RETURNVALUE_CANNOTUSETHISOBJECT);
        DLOG_F(WARNING, "Player can't use object(no action)!");
        return false;
    }

Now in potion.lua, you need add exhaust for storage, if you don't know, post your potion.lua

OBS:
timeBetweenActions = 500
timeBetweenExActions = 700 -- here you must enter the exhaust value you want for all ItemEX actions
 
to use rune and potion while running

find this function (line 1321)
C++:
void Player::onWalk(Direction& dir)
{
    Creature::onWalk(dir);
    setNextActionTask(nullptr);
    setNextAction(OTSYS_TIME() + getStepDuration(dir));
}

change for this:
C++:
void Player::onWalk(Direction& dir)
{
    Creature::onWalk(dir);
    setNextActionTask(nullptr);
   // setNextAction(OTSYS_TIME() + getStepDuration(dir));
}


i tested it, didnt work, im still having a big delay every third potion i use when poting while running, im using latest version of OTSERV-BR and the script is on player.cpp
 
Last edited:
Back
Top