Modding Help Multiple different outputs for one recipe and/or a zero input

Discussion in 'Starbound Modding' started by Your Buddy Bill, Feb 13, 2014.

  1. Your Buddy Bill

    Your Buddy Bill Existential Complex

    So, I'm trying to create an adventure map. It's pretty cool, but I need some mods to make it work properly.
    I caught on to JSON pretty quickly, but now I'm running into a problem.
    I want it such that when the player uses a "cellmateria" at a custom "microscope" crafting station, they get to keep the "cellmateria" but they ALSO get a new item, "cellsample".
    I originally planned for the "microscope" to be like a Furnace: One input and one output. My plan was to make the process consume 0 cellmateria.
    Unfortunately, as I found out next, an input of 0 in the furnace results in the crafting process not happening.
    "Ok", I thought, "I'll try it in the crafting table interface".
    First I tried it with the same 0 input.
    I made a copper pickaxe require just 0 copper bars, and nothing else.
    When I tried to craft one while holding some copper bars, I crashed with a "divide by zero" error.
    Interestingly, when I tried to craft one while NOT holding copper bars, it allowed me to craft them, albeit in increments of 0 or 1.
    But anyway, clearly the 0 input wouldn't work.
    So I tried making a double-output. It would consume the original item, but give the player a replacement AND a new item to boot.
    Yeah, that crashed the game on startup.
    Does anyone have any other ideas for workarounds so that you can get as many as you want of Item B at no cost as long as you have Item A on you?
     
  2. Your Buddy Bill

    Your Buddy Bill Existential Complex

    Update: About to try setting the required number into negatives. Expecting crash. I'll let you know if this works.
    Edit: That doesn't work. Starbound is set up such that negatives wrap around to nine-digit numbers or something, i know it was around 49 million now required instead of just negative 1.
     
  3. G3rman

    G3rman Big Damn Hero

    Why don't you just make the recipe give the player back a "cell sample" and a "cellmateria". They are consuming the original but they are still getting it back. I don't see the significance in the 0 input necessity.

    Woops, tried it. Check the log though, it doesn't make any sense to crash.
     
    Last edited: Feb 13, 2014
  4. DJ_Ditz3

    DJ_Ditz3 Scruffy Nerf-Herder

    I'm guessing you're setting up some kind of research mod?
    He tried that. Evidently it crashed on startup.
    In that scenario I suggest looking at the Starbound.log for what the error is, whether it's a coding error or simply not possible with starbound's current engine.
    EDIT: My suggestion would be to craft a place-able item that, when activated, is destroyed and drops the cell sample and cell materia.
     
  5. Your Buddy Bill

    Your Buddy Bill Existential Complex

    Yeah, looks like it's simply not possible with this engine. Dang nabbit dangit.
    And it's not so much a "research mod" as it is an adventure map. All the big bads are screwing over their respective peoples, you the player have gotten away but find yourself stranded above an unknown planet with only enough power to teleport to the surface, no going back (using an unused Tech Station object to exchange techs), the player interaction with the environment is limited in that you can't break or place anything (you don't even have a matter manipulator) so to make up for that ALMOST FREAKING EVERYTHING is going to be interactive in some way, and along the way the players learn the history of this bizarre planet and gain items that, when used properly, will allow them to solve all the big problems going down.
     
  6. Your Buddy Bill

    Your Buddy Bill Existential Complex

    As to the "not making sense to crash", from what I can tell, the game determines (among other things) what icon to use for the recipe based on what the output is. I guess it can't handle more than one output for that, but I will keep tinkering.

    Here's the error:

    Error: Exception raised during Root finishInitialization: RecipeException: Recipe missing required ingredient: VariantException: Improper conversion to VariantMap from list in get("output")
    00A6D898 (/Users/builder/starbound-slave/releasebuilder-windows/build/source/core/StarVariant.hpp:13)
    00835E8B (/Users/builder/starbound-slave/releasebuilder-windows/build/source/core/StarVariant.cpp:558)
    005D3F62 (/Users/builder/starbound-slave/releasebuilder-windows/build/source/game/StarRecipeDatabase.cpp:30)
    ... (2)
    004FDAFE (/Users/builder/starbound-slave/releasebuilder-windows/build/source/game/StarRoot.cpp:209)
    0040494C (/Users/builder/starbound-slave/releasebuilder-windows/build/source/client/StarClientApplication.cpp:305)
    0098243C (/Users/builder/starbound-slave/releasebuilder-windows/build/source/core/StarThread_windows.cpp:74)
    757F336A kernel32.dll
    77969F72 ntdll.dll
    77969F45 ntdll.dll

    005D4809 (/Users/builder/starbound-slave/releasebuilder-windows/build/source/game/StarRecipeDatabase.hpp:15)
    004FDAFE (/Users/builder/starbound-slave/releasebuilder-windows/build/source/game/StarRoot.cpp:209)
    0040494C (/Users/builder/starbound-slave/releasebuilder-windows/build/source/client/StarClientApplication.cpp:305)
    0098243C (/Users/builder/starbound-slave/releasebuilder-windows/build/source/core/StarThread_windows.cpp:74)
    757F336A kernel32.dll
    77969F72 ntdll.dll
    77969F45 ntdll.dll

    Warn: Perf: ClientApplication::update millis: 6527
    Warn: Perf: StarApplicationBase::run.innerLoop.update millis: 6527
    Warn: Perf: StarApplicationBase::run.innerLoop millis: 6544
    Info: Shutting down Star::Root
    Error: StarException: An error occurred during loading: RecipeException: Recipe missing required ingredient: VariantException: Improper conversion to VariantMap from list in get("output")
    00A6D898 (/Users/builder/starbound-slave/releasebuilder-windows/build/source/core/StarVariant.hpp:13)
    00835E8B (/Users/builder/starbound-slave/releasebuilder-windows/build/source/core/StarVariant.cpp:558)
    005D3F62 (/Users/builder/starbound-slave/releasebuilder-windows/build/source/game/StarRecipeDatabase.cpp:30)
    ... (2)
    004FDAFE (/Users/builder/starbound-slave/releasebuilder-windows/build/source/game/StarRoot.cpp:209)
    0040494C (/Users/builder/starbound-slave/releasebuilder-windows/build/source/client/StarClientApplication.cpp:305)
    0098243C (/Users/builder/starbound-slave/releasebuilder-windows/build/source/core/StarThread_windows.cpp:74)
    757F336A kernel32.dll
    77969F72 ntdll.dll
    77969F45 ntdll.dll

    005D4809 (/Users/builder/starbound-slave/releasebuilder-windows/build/source/game/StarRecipeDatabase.hpp:15)
    004FDAFE (/Users/builder/starbound-slave/releasebuilder-windows/build/source/game/StarRoot.cpp:209)
    0040494C (/Users/builder/starbound-slave/releasebuilder-windows/build/source/client/StarClientApplication.cpp:305)
    0098243C (/Users/builder/starbound-slave/releasebuilder-windows/build/source/core/StarThread_windows.cpp:74)
    757F336A kernel32.dll
    77969F72 ntdll.dll
    77969F45 ntdll.dll

    00404DBD (/Users/builder/starbound-slave/releasebuilder-windows/build/source/client/StarClientApplication.cpp:319)
    00406957 (/Users/builder/starbound-slave/releasebuilder-windows/build/source/client/StarClientApplication.cpp:388)
    0040A6C4 (/Users/builder/starbound-slave/releasebuilder-windows/build/source/application/StarApplicationBase.cpp:200)
    00407E74 (/Users/builder/starbound-slave/releasebuilder-windows/build/source/client/main.cpp:38)
    004EC0C1 (\SDL-1.2.15/./src/main/win32/SDL_win32_main.c:318)
     
  7. Your Buddy Bill

    Your Buddy Bill Existential Complex

    And if it helps any more (i.e. i overlooked something blatant) here's the recipe file in question:
    {
    "input" : [
    { "item" : "copperbar", "count" : 1 }
    //pair of commented out items here
    //the list of size one is not the problem, as the error specifically mentions the output as the issue
    ],
    "output" :
    [
    { "item" : "copperpickaxe", "count" : 1 },
    { "item" : "stonepickaxe", "count" : 1 }
    ],
    "groups" : [ "anvil", "tools", "all" ]
    }
     
  8. Your Buddy Bill

    Your Buddy Bill Existential Complex

    Now trying using a list in the output section, with only one thing inside. If it crashes again, it means it can't handle a LIST in the outputs. If it doesn't crash, it means it can handle a list but it can't handle more than one item in said list.
    Edit: Aaaaaand we crashed!
    This means it can't handle a list in the output section. Engine problem. Any other ideas?
     
  9. Your Buddy Bill

    Your Buddy Bill Existential Complex

    Hmmm. Part of the reason I don't want the things destroyed is that I want to make this at least moderately idiot-proof (but if you put all your tech chips in the trash can, that's unwinnable by insanity), and there's a few "red herring" crafting recipes that don't actually do anything useful, but if a player spends every last Animal Pelt making Mixed Samples or Skin Cell Samples without ever using the Stain Remover to get the Bloodstain off the pelt, they'd never be able to get the necessary-to-win Floran Blood Sample.
    Also because really it should just be taking off a little fragment of the input and examining it to make the sample. To make a blood sample, you don't need to put all your blood in one jar. You can save some of your blood and use some of it for some other thing later on.
     
  10. Your Buddy Bill

    Your Buddy Bill Existential Complex

    Testing what happens if I just put multiple lines marked as output... ok, it just gives me a parsing error with the json file.
    Testing a 0 input alongside a normal input... well, it's still a divide by 0 error.
    Seriously I could use a hand here. If anyone knows how to make a 0 input work or make a multi-output work, I'd love to know about it. Like, is there a way to make an item's count not decrement upon being consumed, or some weird-ass lua hook that would let me stuff the input back in the input slot in a furnace?
     
  11. mikeloeven

    mikeloeven Big Damn Hero

    I would say crafting recipes need to support dynamic logic. essentially allow a crafting item to replace individual recipies with a large logic statement that can allow them to have multiple effects based on the meta data read from the items put into the crafting system.

    kinda like what minecraft does with NBT

    wishlist

    1: crafting recipe can see and read metadata from items placed inside without knowing ahead of time what that source item is

    2: support for large very advanced logic statements with full math function libraries and variable assignments. allow a crafting recipe to think (good for recyclers (percentages and such) that need to calculate output based on pixel value or initial recipie)

    3: support for multiple output grids (again needed for advanced crafting or a recycle system)


    in essence a crafting api with comprehensive function library
     
    Last edited: Jun 4, 2014
    Your Buddy Bill and prodamn like this.

Share This Page