Modding Help Using a .patch file to add a new pool to a pre-existing .treasurepools file?

Discussion in 'Starbound Modding' started by Axonium, Aug 12, 2016.

  1. Axonium

    Axonium Poptop Tamer

    So I'm trying to make my mod Android Fluffalo compatible with other mods that add custom harvestable animals, per request by an inspired user via Reddit, but for some reason that's incredibly difficult. For the most part I've just been using variations of this treasure\monsterharvest.treasurepools.patch:
    Code:
    [
      {
        "op": "add",
        "path": "/roboFluffaloHarvest/1/pool/-",
        "value": {
          "weight" : 1.0, "item" : "stickofram"
        }
      }
    ]
    Here's the error that pops up when I use that particular snippet of code:
    Code:
    [19:57:13.038] [Error] Exception while invoking lua function 'update'. (LuaException) Error code 2, [string "/monsters/monster.lua"]:162: Lua Error in monster type 'robofluffalo'
    [string "/scripts/behavior.lua"]:185: [sequence] error: [string "/scripts/behavior.lua"]:178: [dropMonsterHarvest] error: [string "/scripts/actions/monsters/farmable.lua"]:49: (TreasureException) Unknown treasure pool 'roboFluffaloHarvest'  
    However, no matter what I try, the game either crashes on startup (previous attempts) or the Fluffalo dies when you try to harvest it (aforementioned attempt). Google hasn't been any help for whatever reason, so would anyone here know?
    (also yes this is just copied and pasted over from this, but don't tell anyone, okay?)
     
  2. The | Suit

    The | Suit Agent S. Forum Moderator

    Code:
    [
        {
            "op" : "add",
            "path" : "/basicMonsterTreasure/0/1/pool/-",
            "value" : { "weight" : 1.0, "pool" : "kienergydrop" }    
          
        }
    ]
    
    An example of the patch I gave to another user.

    Edit:
    Confirm patches here before trying them in game,
    http://json-schema-validator.herokuapp.com/jsonpatch.jsp
     
  3. Axonium

    Axonium Poptop Tamer

    That's not quite what I was trying to do. basicMonsterTreasure already exists within its file. I'm trying to add a completely new pool to monsterharvest.treasurepools, not add an item to another pool such as electricFluffaloHarvest or poisonFluffaloHarvest. Is there any way to do that?
     
  4. The | Suit

    The | Suit Agent S. Forum Moderator

    if you are making a completely new pool - it is generally better to create your own custom treasure pool file.
    All treasure pool files are just merged into one in the game.
    They are simply kept in separate files for sake of organization.

    If you are hellbent on patching it though, it is pretty simple.
    Code:
    [{
    "op" : "add",
    "path" : "/robofluffalo",
    "value" : [ [1, { "pool" : [ {"weight" : 1.0, "item" : "staticcell"} ] } ] ]
    } ]
    
    The mistake you made is - you are trying to patch something that did not exist.
     
  5. Axonium

    Axonium Poptop Tamer

    Works like a charm! Thank you!
     
  6. amirmiked12

    amirmiked12 Spaceman Spiff

    w
    What does weight mean in here?
     
  7. projectmayhem

    projectmayhem Ketchup Robot

    weight is "how likely" it is. 1.0 weight would spawn more often than 0.50 weight if they are in the same pool.



    This website is a godsend for making patches
    http://chbrown.github.io/rfc6902/
     
  8. amirmiked12

    amirmiked12 Spaceman Spiff

    Oh tnx
     

Share This Page