Modding Help Replacing inventory items using a .lua activated by a consumable

Discussion in 'Starbound Modding' started by ThePhoenix, Jan 31, 2015.

  1. ThePhoenix

    ThePhoenix Void-Bound Voyager

    My current goal with a mod I am working on is to be able to replace some "box" items in the player's inventory with the "contents", triggered by a consumable. The box items and contents items are non-stackable and each "box" is simply supposed to be replaced 1:1 with the item it is the box of. I don't want any randomization or mystery.

    (I know I could just use a crafting interface, but this approach fits the feel of the mod better and I have already done the pixel-art for it. Also the items are default items and I don't want to risk giving players access to any pre-existing crafting recipes for the items by trying to give them access to the recipes I made - it seems recipe access is on a per-item level not a per-recipe level.)

    I have got it all done and functional other than the .lua file, which I am stuck on. I have no experience with Lua. From looking at the documentation thread, I guess the @function containerSwapItems is what I need to use, assuming it works on player inventories. But I haven't got a clue where to start.

    Could someone more familiar with Lua please give me some assistance?
     
  2. The | Suit

    The | Suit Agent S. Forum Moderator

    You don't have access to players inventory as far as I remember.
    Your best non Lua option is to see how gift box was made.

    and just use the lua coded already used by gift box.
    This way you can modify the treasure list and have it drop any item from a list
    Without having to worry about lua.
     
  3. ThePhoenix

    ThePhoenix Void-Bound Voyager

    Ah. Ok. I'll try a different approach.

    Edit: I'm going to make them placable and smashable. That will work.

    Edit 2: Yep, that worked.
     
    Last edited: Jan 31, 2015

Share This Page