Modding Help Remove inventory item

Discussion in 'Starbound Modding' started by rex41043, Oct 25, 2016.

  1. rex41043

    rex41043 Void-Bound Voyager

    Hi, I've noticed on the wiki there are LUA functions documenting how to add a item to a players inventory but I have yet to find one to remove an item from a players inventory. Does this exist?
     
  2. bk3k

    bk3k Oxygen Tank

    There are a few. Look in starbound/doc/lua/player.md
    That folder is full of documentation.
    And if you find the documentation not all that clear, you can use something like notepad++'s find in files feature to find actual examples of the code in use.
    Just point it to where you extracted packed.pak and search for that function name you have questions about.
     
  3. Errors4l

    Errors4l Spaceman Spiff

    Note that the player table is only available in specific scripts. For example, you don't have access to it in tech scripts but you do have access to it in script panes (scripted interface).
    The player table one is player.consumeItem(itemDescriptor)
    If you want to remove items through an active item it is possible to make the item open an invisible interface. This interface would then take the item(s) and close itself.
     

Share This Page