Basically im trying to create a parameter (onThrow) where i could be able to check if an item is being moving to a container that stands on the floor or viceversa.
This in order to block some items to not being able to throw to the floor or containers on the floor.
With those lines i've added, it works as expected, expecified items cannot be thrown to containers that are on the floor but, there is a problem, when im standing on top of a backpack/container which is on the floor and i try to move an item which is inside of my backpack the code "thinks" that im trying to move the item to the backpack/container that im standing on and then it gets blocked.
Also tried with ground instead of getTopDownItem but didn't work properly either.
Anyone could explain me how to get only the container on the floor?
TFS 0.3.7
This in order to block some items to not being able to throw to the floor or containers on the floor.
C++:
CreatureEventList throwEvents = player->getCreatureEvents(CREATURE_EVENT_THROW);
for(CreatureEventList::iterator it = throwEvents.begin(); it != throwEvents.end(); ++it)
{
Item* toContainer = toCylinder->getItem();
Item* fromContainer = fromCylinder->getItem();
Item* fromGround = fromCylinder->getTile()->getTopDownItem();
Item* toGround = toCylinder->getTile()->getTopDownItem();
if(!(*it)->executeThrow(player, item, count, fromPos, toPos, (fromContainer ? fromContainer : 0), (toContainer ? toContainer : 0), fromGround, toGround, fromStackpos) && !deny)
deny = true;
}
With those lines i've added, it works as expected, expecified items cannot be thrown to containers that are on the floor but, there is a problem, when im standing on top of a backpack/container which is on the floor and i try to move an item which is inside of my backpack the code "thinks" that im trying to move the item to the backpack/container that im standing on and then it gets blocked.
Also tried with ground instead of getTopDownItem but didn't work properly either.
Anyone could explain me how to get only the container on the floor?
Gyazo Screen Video
gyazo.com
TFS 0.3.7
Last edited: