HomePortalFAQSearchMemberlistUsergroupsRegisterLog in
Meet the new KITO admins & hear their plans here.
You can use google search to find threads and posts here now. Example

Share | 
 

 Picking item up

Go down 
AuthorMessage
dev_begin

avatar

Game username : devr
Male Posts : 7
Join date : 2018-03-27
Location : Russia

PostSubject: Picking item up   Fri May 04, 2018 11:04 pm

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 Very Happy
-------------------------------
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.");
Back to top Go down
 
Picking item up
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Keeping I.T. Open :: SUPPORT :: Support-
Jump to: