How to delete item from player's inventory ?

1
Heya guys, was hoping someone can help me out to solve one of my issues. I've created a starter pack for new players that join my server, one of the items being "Primitive Cooking pot" with ID 1028. I was just informed that players are unable to use the item or drop it from their inventory, and sadly it takes/occupy 40 stone worth of weight.

Not sure this is the right place to ask but I thought I should give a shot. I got pretty much 0 MySQL knowledge, I was told I can only remove the item via SQL but since I am clueless I don't even know where to start.

Is there any way to solve this, other than having to delete each character and manually give them their skills back ? Because that will take me forever to do and also I don't know how to set their stats back such as str, agi, willp. (I have removed the item from the starter pack and all the new characters work as intended, but old characters lose that 40 weight)

I took the item ID from wiki : https://lifeisfeudal.gamepedia.com/Prim ... ooking_pot and I am unsure why it can't be used/dropped. Tried having characters knocked down, killed ...the cooking pot still remains in their bag and takes 40 weight.

Re: How to delete item from player's inventory ?

2
I have found this code, in case someone got the patience to walk me trough the process :
I understand that first fuction is searching for players that got specific object and second function would remove it. Do I need to create this into a .cs file and then run it ? if so, where do I specify witch item I am looking for and trying to delete ? Thanks in advance.

Code: Select all

//Searches through the player list and tries to find the player with the given id
function getPlayer(%pid)
{
   for(%id = 0; %id < ClientGroup.getCount(); %id++)
   {
      %client = ClientGroup.getObject(%id);
     
      if(%pid == %client.getCharacterId())
      {
         return %client;
      }
   }
   return 0;
}
//Remove the item to the player inventory (remove full stack)
function removeItemToPlayerInventory(%pid, %itemType)
{
   %client = getPlayer(%pid);
   if(%client != 0)
      %client.player.inventoryRemoveItem(%itemType);
}

Re: How to delete item from player's inventory ?

3
Hi,
I don't think you need any of that.
If you want to remove an item with ID 1028 from all containers (including inventories), you can run this SQL query:

Code: Select all

DELETE FROM `items` WHERE ObjectTypeID = 1028;

its probably required to restart the server afterwards, or run it while its offline.

Note that it will delete it from all inventories and storage containers but not from trading posts (if you use that mod)

Re: How to delete item from player's inventory ?

4
Thanks a lot, I will give it a go.

Edit : It doesn't work sadly, ran the query, restarted the server and the bugged item is still there.
Even later edit : This is what I see in the livemap item list for character, it lists "Primitive Cooking Pot" x20 :
Image
Not sure why this happen, what I did was : Edited the "cm_createchar.xml" from data folder and added a line for "<item id="1080" amount="1"/>" which I got from wiki.
Either the item ID from wiki is wrong or the database from pingperfect got issues.
cron