How to delete item from player's inventory ?

General discussion about Life is Feudal: Your Own, The main section and backbone of the forums.

Cotison12
 
Posts: 2
Joined: 02 Jun 2020, 03:09

How to delete item from player's inventory ?

Post by Cotison12 » 02 Jun 2020, 03:21

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 few days ago that players are unable to use the item or drop it from their inventory, and sadly it takes/occupy 40 stone worth of weight.

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've got no idea how to give them their attribute points back.

I took the item ID from wiki : https://lifeisfeudal.gamepedia.com/Prim ... ooking_pot

Made a similar topic on steam, so far someone answered saying I should delete the item from SQL but I am clueless when it comes to that. Please help.


Cotison12
 
Posts: 2
Joined: 02 Jun 2020, 03:09

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

Post by Cotison12 » 05 Jun 2020, 01:41

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);
}

Return to General Discussion