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

C++ Modify InGame range to pickup/move items TFS 1.3

ObsidianQ

Member
Joined
Jan 26, 2017
Messages
100
Solutions
1
Reaction score
10
TFS 1.3 (master)
Hello!


I have a small issue, i can't pick up those crystal coins or move them somewhere else from the position I am. (To make it clear, the item is not the issue, they just represent my max range to move or pick up items)


unknown.png


I can throw anything from my inventory or below/near me inside the burst arrow zone (That's fine, just making a point: I can throw anything i want anywhere on my screen as i wish)

The only issue is when i want to move that crystal coin, i have to walk 1 step closer so i can pick it up or move it somewhere else on the screen.

That means, i only can pick up or move items in a 7x7 radio.
From the 8x8 and beyond, i can't.

@Static_ says it may be something to do with Map::getPathMatching
Because it is used inside of Game::playerMoveItem (player->getPathTo)


game.cpp
Code:
if (!Position::areInRange<1, 1>(playerPos, mapFromPos)) {
        //need to walk to the item first before using it
        std::forward_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::playerMoveItemByPlayerID, this,
                                 player->getID(), fromPos, spriteId, fromStackPos, toPos, count));
            player->setNextWalkActionTask(task);
        } else {
            player->sendCancelMessage(RETURNVALUE_THEREISNOWAY);
        }
        return;
    }

That's what we have so far, does someone mind to help please?
TFS 1.3 (master)
 
Last edited:
I found at item.h (TFS Sources)
Code:
int32_t getThrowRange() const final {
            return (isPickupable() ? 15 : 2);
        }

Which modifies the range to throw an item, horizontally it allows to have a 15sqm distance but i don't know what the 2 means...
I tried to change it to 1 in case it divides the 15 for the range to pickup and letting me pickup items in all the 15sqm range but didn't work out :(

Anyways i feel one step closer
help :(

Edit: this wasn't a correct clue
 
Last edited:
I found at item.h (TFS Sources)
Code:
int32_t getThrowRange() const final {
            return (isPickupable() ? 15 : 2);
        }

Which modifies the range to throw an item, horizontally it allows to have a 15sqm distance but i don't know what the 2 means...
I tried to change it to 1 in case it divides the 15 for the range to pickup and letting me pickup items in all the 15sqm range but didn't work out :(

Anyways i feel one step closer
help :(

Rules for the Support board
#2

If the item is "pickupable", in other words you can put the item in a container, ex your backpack then it's 15 sqms otherwise it's 2 sqms.
 
Rules for the Support board
#2

If the item is "pickupable", in other words you can put the item in a container, ex your backpack then it's 15 sqms otherwise it's 2 sqms.

Thanks for the reply!

Do you have any idea of how to limit vertical throw range, is it possible?
Also, how to expand the pickup radio as i explain? To pickup those crystal coins i have to step 1 sqm closer to them, i need to modify that
 
Thanks for the reply!

Do you have any idea of how to limit vertical throw range, is it possible?
Also, how to expand the pickup radio as i explain? To pickup those crystal coins i have to step 1 sqm closer to them, i need to modify that

No sorry no ide.
But check the source code of 0.3.6 / 0.4 there was a flag for GMs etc to where they could pick up and move items from any location, if you find that code it might give you some help.
 
No sorry no ide.
But check the source code of 0.3.6 / 0.4 there was a flag for GMs etc to where they could pick up and move items from any location, if you find that code it might give you some help.

Thank you, that's a great clue to follow, is there any github repo with those sources?
I have no idea which file could have that flag or how to find it, a github repo could make it easier searching definitions on the search bar
 
it's harder to reimplement that feature into 1.2, i've tried it like a month ago
tile queryAdd works incredibly weird and i'm 99% sure it's rigged (queryadd wouldn't take my flag param correctly and it resulted in me being unable to throw a creature on a solid object)
maybe i could try again but i honestly can't be bothered
just look for PlayerCustomFlag_CanThrowAnywhere in this repo: GitHub - peonso/forgottenserver036pl1: Old TFS 0.3.6pl1 (Crying Damson) - an opentibia server
look at the code context for that flag and try to reimplement it in 1.2
 
@Flatlander Can you help me with this? Since i applied your adding tiles tutorial everything is beautiful. But i found this kind of "bug" where the player is limited to it's original tiles area to move or pick up items by distance, i need to extend it to the same tiles i added to my screen.
 
it's harder to reimplement that feature into 1.2, i've tried it like a month ago
tile queryAdd works incredibly weird and i'm 99% sure it's rigged (queryadd wouldn't take my flag param correctly and it resulted in me being unable to throw a creature on a solid object)
maybe i could try again but i honestly can't be bothered
just look for PlayerCustomFlag_CanThrowAnywhere in this repo: GitHub - peonso/forgottenserver036pl1: Old TFS 0.3.6pl1 (Crying Damson) - an opentibia server
look at the code context for that flag and try to reimplement it in 1.2
@Vulcan_ did you managed to make it work into 1.3? I mean the throw anywhere
 
Back
Top