Modding Help Consumable Item with Charges

Discussion in 'Starbound Modding' started by Campaigner, Dec 2, 2015.

  1. Campaigner

    Campaigner Giant Laser Beams

    I thought this would be a simple one, but I'm stumped.

    With the reward bags available from Tenant missions, you use a consumable item that puts another item into your inventory. This is nice, but with how it forces the item into your inventory and not the bar button it was once on (if it was on one), it adds a needless tediousness. While it isn't really a big deal, I want to make something's "reward" stay on the bar when it's used. So, I tried to make a consumable with charges; it didn't work. Tried mixing and matching .consumable and .miningtool (only thing with charges that I found), every result being a failed load.

    Is this possible without the use of scripting? Because I don't know how to script, and if it isn't doable then I'll just use the reward bag method instead.
     
  2. The | Suit

    The | Suit Agent S. Forum Moderator

    Well - I think the most obivious question is - why do you need charges at all?
    Isn't a stackable item enough?
     
  3. Campaigner

    Campaigner Giant Laser Beams

    It's mainly personal preference. I mean, my main mod is nothing but mundane and silly items with no real purpose. I just tend to stick with the theme.
     
  4. The | Suit

    The | Suit Agent S. Forum Moderator

    I only say it because - an item stack really solves all the issues.

    • The item will always stay in the hot bar on use.
    • It requires no scripting.

    A multi use consumable item is not actually part of the vanilla game and can only be done through a Lua script.
    Mining tool is based on durability of use and not stack.

    The simplest implementation through Lua would be one item adding charges - by using a status effect which adds to a custom resource.
    A separate item using those charges based on the existence of that resource.

    The lua script is not too complicated - there is a rough example in my Mad Experiments mod.
    When I used a consumable to check if a resource exists.
     
  5. Campaigner

    Campaigner Giant Laser Beams

    Yeah, looking at that code makes me feel stupid. I'll just stick with stacks, since coding really isn't something I should touch when I can't even comprehend the stuff.

    Thanks anyway, your mod did have a lot of cool stuff in it though.
     

Share This Page