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

Action/GOD - Click and Drag

SpoYeR

Junior Scripter
Joined
Jun 16, 2014
Messages
14
Reaction score
0
So in the past during the 8.6 Version i noticed that gods could click and drag items without standing next to them. but now that the version is 10.41 that is no longer a function.

If anyone knows how to fix this i would be glad to know :)
 
Yes ghettobird this was in next to all 8.6 versions, probaby source code i'll check it out later today!
 
I did it before in my test server but I don't really remember how, but I remember it had to do with source files, you could open/close doors when you're in temple for example & take chests when ur not next to them (only Admin account can do that...), I'll make some research and get back to you ASAP :)
 
In game.cpp you can find:
Code:
if (!Position::areInRange<1, 1>(playerPos, mapFromPos)) {
        //need to walk to the item first before using it
        std::list<Direction> listDir;
        if (player->getPathTo(item->getPosition(), listDir, 0, 1, true, true)) {
            g_dispatcher.addTask(createTask(std::bind(&Game::playerAutoWalk,
                                            this, player->getID(), listDir)));

            SchedulerTask* task = createSchedulerTask(400, std::bind(&Game::playerMoveItem, this,
                                  playerId, fromPos, spriteId, fromStackPos, toPos, count));
            player->setNextWalkActionTask(task);
        } else {
            player->sendCancelMessage(RET_THEREISNOWAY);
        }
        return;
    }

You could add a player flag and use it like this:

Code:
if (!Position::areInRange<1, 1>(playerPos, mapFromPos) && !player->hasFlag(PlayerFlag_CanMoveItemsFromFar))
 
In game.cpp you can find:
Code:
if (!Position::areInRange<1, 1>(playerPos, mapFromPos)) {
        //need to walk to the item first before using it
        std::list<Direction> listDir;
        if (player->getPathTo(item->getPosition(), listDir, 0, 1, true, true)) {
            g_dispatcher.addTask(createTask(std::bind(&Game::playerAutoWalk,
                                            this, player->getID(), listDir)));

            SchedulerTask* task = createSchedulerTask(400, std::bind(&Game::playerMoveItem, this,
                                  playerId, fromPos, spriteId, fromStackPos, toPos, count));
            player->setNextWalkActionTask(task);
        } else {
            player->sendCancelMessage(RET_THEREISNOWAY);
        }
        return;
    }

You could add a player flag and use it like this:

Code:
if (!Position::areInRange<1, 1>(playerPos, mapFromPos) && !player->hasFlag(PlayerFlag_CanMoveItemsFromFar))
Sorry if i respond quite stupid but where in that sentance should i add/make the flag? still a beginner at editing
 
Code:
if (!Position::areInRange<1, 1>(playerPos, mapFromPos) && !player->hasFlag(PlayerFlag_CanMoveItemsFromFar))
        //need to walk to the item first before using it
        std::list<Direction> listDir;
        if (player->getPathTo(item->getPosition(), listDir, 0, 1, true, true)) {
            g_dispatcher.addTask(createTask(std::bind(&Game::playerAutoWalk,
                                            this, player->getID(), listDir)));

            SchedulerTask* task = createSchedulerTask(400, std::bind(&Game::playerMoveItem, this,
                                  playerId, fromPos, spriteId, fromStackPos, toPos, count));
            player->setNextWalkActionTask(task);
        } else {
            player->sendCancelMessage(RET_THEREISNOWAY);
        }
        return;
        }

That's what @Elime meant I guess :p
 
Code:
if (!Position::areInRange<1, 1>(playerPos, mapFromPos) && !player->hasFlag(PlayerFlag_CanMoveItemsFromFar))
        //need to walk to the item first before using it
        std::list<Direction> listDir;
        if (player->getPathTo(item->getPosition(), listDir, 0, 1, true, true)) {
            g_dispatcher.addTask(createTask(std::bind(&Game::playerAutoWalk,
                                            this, player->getID(), listDir)));

            SchedulerTask* task = createSchedulerTask(400, std::bind(&Game::playerMoveItem, this,
                                  playerId, fromPos, spriteId, fromStackPos, toPos, count));
            player->setNextWalkActionTask(task);
        } else {
            player->sendCancelMessage(RET_THEREISNOWAY);
        }
        return;
        }

That's what @Elime meant I guess :p
What i mean is how do i make a custom flag and how do i attach it to god+
 
Sorry if i respond quite stupid but where in that sentance should i add/make the flag? still a beginner at editing
Sorry, I should be more specific.

You can add player flags in const.h.
The last one should be:
Code:
PlayerFlag_IsAlwaysPremium = 137438953472
Just after it you can add:
Code:
PlayerFlag_CanMoveItemsFromFar = 274877906944
To add the new flag to your GM/GOD group go to the groups table in your database. There you will see the flags number for each group. Now take the flags number from your GM/GOD group and add the new flag to it.
example:
Say that the GM/GOD flags number is 272227082232
The new flag is: 274877906944
Now I add them together: 272227082232 + 274877906944 = 547104989176
So the MG/GOD flags number should be changed to 547104989176.
 
Last edited:
Sorry, I should be more specific.

You can add player flags in const.h.
The last one should be:
Code:
PlayerFlag_IsAlwaysPremium = 137438953472
Just after it you can add:
Code:
PlayerFlag_CanMoveItemsFromFar = 274877906944
To add the new flag to your GM/GOD group go to the groups table in your database. There you will see the flags for each group. Now take the flag number from your GM/GOD group and add the new flag to it.
example:
Say that the GM/GOD flags number is 272227082232
The new flag is: 274877906944
Now I add them together: 272227082232 + 274877906944 = 547104989176
So the MG/GOD flags number should be changed to 547104989176.
I just tried that. didn't work still recieving the "There is no way" message :(


EDIT 1 : Sorry made a mistake tried changing in groups.xml. but in the database i have no table called groups
 
I just tried that. didn't work still recieving the "There is no way" message :(


EDIT 1 : Sorry made a mistake tried changing in groups.xml. but in the database i have no table called groups

Ok, a lot has changed since 0.2.14 I guess. Changing it in groups.xml is probably the new way of doing it though.
Thinking about it you could probably go with:
Code:
if (!Position::areInRange<1, 1>(playerPos, mapFromPos) && !player->isAccessPlayer())

and skip the player flag.
 
Ok, a lot has changed since 0.2.14 I guess. Changing it in groups.xml is probably the new way of doing it though.
Thinking about it you could probably go with:
Code:
if (!Position::areInRange<1, 1>(playerPos, mapFromPos) && !player->isAccessPlayer())

and skip the player flag.
Tried it. didn't work either :/
 
Tried it. didn't work either :/
How did you test it? This will only enable you to move items around at a distance. You can still not move an item to a bag and not from different levels.

And just in case, I just have to ask... Did you actually compile the code? =P
 
How did you test it? This will only enable you to move items around at a distance. You can still not move an item to a bag and not from different levels.

And just in case, I just have to ask... Did you actually compile the code? =P
I just tried pasting #if (!Position::areInRange<1, 1>(playerPos, mapFromPos) && !player->isAccessPlayer())# inside game.cpp and then combining the the custom flag with my god flag
 
I just tried pasting #if (!Position::areInRange<1, 1>(playerPos, mapFromPos) && !player->isAccessPlayer())# inside game.cpp and then combining the the custom flag with my god flag
You have to recompile after editing the sources. You can search the forum for a compiling guide.
 
BUMP

I have tried what @Elime mentioned and it worked (partially).

But there are still some issues:
( as an Admin: )
  1. Can't move an item which is on another level.
  2. Can't move creatures from anywhere.
  3. Can't move from movable items from Corner to Corner (of visible area).
(TFS 1.3)
@StreamSide
 
Last edited:
For anyone coming across this post looking for the same for either TFS 1.3 or OTBR:
Use this:
Lua:
!player->isAccessPlayer() &&

 
Back
Top