Modding Help Random outputs possible in recipes?

Discussion in 'Starbound Modding' started by Kyrosiris, Dec 17, 2013.

  1. Kyrosiris

    Kyrosiris Scruffy Nerf-Herder

    So there's a common refrain from a lot of players of "I have a ton of sand/fine sand/cobblestone/dirt/etc. and nothing to do with it but trash it!". One of the neat conveniences in Terraria was the Extractionator - a device that took "worthless" silt and slush and turned it into random outputs - pre-hardmode ores, small amounts of cash, etc.

    I want to recreate this, in a way, as part of a bigger mod (tl,dr: crush sandstone into saltpeter, make bombs from it once you have obtained a bomb for the first time), in so much as this material extractor would let you put in some quantity of dirt, fine sand, whatever and get something out of it, defined by treasure tables, I guess.

    The question then becomes, can you get random outputs from a recipe, given static inputs? If so, how?
     
    bluecollarart likes this.
  2. Stevil Knevil

    Stevil Knevil Space Spelunker

    Hmmm, my hunch would be that 'random' recipes won't work. Perhaps you could make something that doesn't craft as such, but instead it could destroy the contents and then use world.placeObject() (I think there's a function called something like that!) to randomly generate a result
     
  3. Kyrosiris

    Kyrosiris Scruffy Nerf-Herder

    Eurgh, that would probably be significantly out of my depth. Unfortunate.
     
  4. Stevil Knevil

    Stevil Knevil Space Spelunker

    I had a little look at doing it and the API doesn't seem like there's a way of even hacking this at the moment :(
     
  5. tifel100

    tifel100 Void-Bound Voyager

    I think there is an item in game that does something similiar but with ores?

    I'll search through the files, if I find it i'll edit this post.
     
  6. Westeller

    Westeller Space Penguin Leader

    .recipe files are static. You're not getting one to spit out random items.
    At least, I don't think it's possible.

    You probably could, however, make an object that spat out random items using an attached .lua script and world.spawnItem calls.
     
  7. Stevil Knevil

    Stevil Knevil Space Spelunker

    Yeah - like I said, the API is not quite rich enough for this yet, I couldn't find a way of getting a container to destroy it's contents.
     

Share This Page