Hi everyone. Having troubleshooting with picking item up. So: there is 1 button "equip" by default. I added my own and called it "Pick up". I want it to place item to stash immidiately without equipping.
at first I check what i'm clicking on:
- Code:
MagixItem *tItem = mItemManager->getByObjectNode(mCurrentObject);
if (!tItem)return;
If it's not an item I don't care about it. then I make my char run to it:
- Code:
mUnitManager->getPlayer()->setAutoAttack(0);
mUnitManager->getPlayer()->setTarget(tItem->getPosition(), TARGET_RUNTO);
then I should make my game to take this item and place it to stash. I found a sendItemstash void, which moves item from equipped items to stash and it seems to be what I need. So:
- Code:
if (tItem != "" && !mItemManager->isStashFull())
{
if (!mGameStateManager->isCampaign())mNetworkManager->sendItemStash(/*WHAT TO PLACE HERE?*/);
}
else mChatManager->message("Your stash is full.");
My 1st question is in 1st line. In original sendItemStash void tItem is string with name of item.
- Code:
tItem != ""
. So, I dont have an idea of gettins my item's name. Secons question is in code

-------------------------------
UPD:
It's working now: I can pick up item and it appears in stash, but it's still on the ground.
- Code:
MagixItem *tItem = mItemManager->getByObjectNode(mCurrentObject);
if (!tItem)return;
mUnitManager->getPlayer()->setAutoAttack(0);
mUnitManager->getPlayer()->setTarget(tItem->getPosition(), TARGET_RUNTO);
const String tItemName = mDef->getItemName(tItem->getMesh());
if (tItemName != "" && !mItemManager->isStashFull())
{
if (!mGameStateManager->isCampaign())mItemManager->pushStash(tItemName);
}
else mChatManager->message("Your stash is full.");