auto pickup
#1

Hello, does anyone have the complete code and without any bugs? ^^

#2

Inside of Battle_NPCDropItem.cpp around line 234



default:

                        {

                            bool bAvailableDrop = true;

                            if (bAvailableDrop)

                                dropItem = gserver->m_itemProtoList.CreateItem(df->m_proto->m_item[tableindex], -1, 0, 0, 1);

                            //    dropItem = df->m_pArea->DropItem(df->m_proto->m_item[tableindex], df, 0, 0, 1, true);

                            else

                                dropItem = NULL;

                        }

                        break;

                    } // switch (df->m_proto->m_item[tableindex])



and then around line 265 we create an if clause which only creates the drop when it cant be added to the inventory and if it returns true we also need to add the line we commented out above again



if (opc->m_inventory.addItem(dropItem) == false)

                {

                    dropItem = df->m_pArea->DropItem(df->m_proto->m_item[tableindex], df, 0, 0, 1, true);

                    CNetMsg::SP rmsg(new CNetMsg);

                    ItemDropMsg(rmsg, df, dropItem);

                    df->m_pArea->SendToCell(rmsg, GET_YLAYER(dropItem), dropItem->m_cellX, dropItem->m_cellZ);

                }



These are the changes to be done for auto picking up normal drops. if you want it to also work for jewels or hardcoded drops you need to change the according parts as well.

#3

this worked but the mobs drop the item on the ground and into my inventory, how to fix this?

#4

.

#5


1 hour ago, kdy said:




this worked but the mobs drop the item on the ground and into my inventory, how to fix this?




mb, I forgot the line 234, this worked ty

#6

Hello.

Does this also work with items that are in the drop list?

Because with this code only items that are in the NPC drop list are automatically picked up.

#7

what do you mean by "in the drop list"?

#8


On 4/23/2024 at 1:04 PM, Desarija said:




what do you mean by "in the drop list"?




t_npc_drop_all

these items are not automatically canceled.

#9


On 4/25/2024 at 9:25 PM, Matt Hias said:




t_npc_drop_all



these items are not automatically canceled.




GAMELOG << init("MOB DROP ALL ITEM")



search for this line in Battle_NPCDropItem.cpp. Above that you have the code that is responsible for dropping items from said table



Forum Jump:


Users browsing this thread: 3 Guest(s)