Modding Help How to add an item to a preexisting loot pool

Discussion in 'Starbound Modding' started by Jandroan, Jan 28, 2017.

Tags:
  1. Jandroan

    Jandroan Subatomic Cosmonaut

    Ok, i'm trying to create a mod, but i can't figure out how to add an item to a preexisting loot pool. In this particular case i'm trying to add new unique weapons to be found like other uniques in the universe.

    Honestly, i'm really new to modding and don't have a clue how to do most things.

    From what i understand i need to make a .patch file to the part of the common.treasurepools file that focuses on unique weapons, but i really don't have a clue how to do that.
     
  2. IHart

    IHart Scruffy Nerf-Herder

    Jandroan likes this.
  3. Jandroan

    Jandroan Subatomic Cosmonaut

    ok, so here's what i came up with, as of yet its not working.

    [
    {
    "op" : "add",
    "path : "/uniqueWeapon/2/pool/-",
    "value" : {"weight" : 1.0, "item" : "pnwavianbroadsword"}
    }
    ]

    im trying to put the item: "pnwavianbroadsword" in the level 6 uniques section of the loot pool.
     
  4. IHart

    IHart Scruffy Nerf-Herder

    What is the filename, what folder is it in, in what way does it not work.
     
  5. bk3k

    bk3k Oxygen Tank

    Kinda like this.
    Code:
    [
      {
        "op": "add",
        "path": "/uniqueWeapon/2/1/pool/-",
        "value": { "weight": 1, "item": "pnwavianbroadsword" }
      }
    ]
    
    In case you don't understand why that works and your patch doesn't
    Suppose I took this
    Code:
      "uniqueWeapon" : [
        [0, {
          "pool" : [
            // level 2 uniques
            {"weight" : 1.0, "item" : "boomerang"},
            {"weight" : 1.0, "item" : "chakram"},
            {"weight" : 1.0, "item" : "ropewhip"},
            {"weight" : 1.5, "item" : "gauntlet"},
            {"weight" : 1.0, "item" : "flamethrower"},
            {"weight" : 1.0, "item" : "poisonbow"},
            {"weight" : 1.0, "item" : "pollenpump"}
          ]
        }],
        [2.9, {
          "pool" : [
            // include a chance for these since they're needed for later upgrades
            {"weight" : 0.5, "item" : "boomerang"},
            {"weight" : 0.5, "item" : "chakram"},
            {"weight" : 0.75, "item" : "gauntlet"},
    
            // level 4 uniques
            {"weight" : 1.0, "item" : "vinewhip"},
            {"weight" : 1.0, "item" : "wormgun"},
            {"weight" : 1.0, "item" : "wormerang"},
            {"weight" : 1.0, "item" : "gristlegun"},
            {"weight" : 1.0, "item" : "soulseeker"},
            {"weight" : 1.0, "item" : "electricrailgun"},
            {"weight" : 1.0, "item" : "timepierce"},
            {"weight" : 1.0, "item" : "eyesword"},
            {"weight" : 1.0, "item" : "intestinewhip"},
            {"weight" : 0.2, "item" : "gnomegun"}
          ]
        }],
        [4.9, {
          "pool" : [
            // level 6 uniques
            {"weight" : 1.0, "item" : "supernovaglove"},
            {"weight" : 1.0, "item" : "astrosabredeluxe"},
            {"weight" : 1.0, "item" : "energywhip"},
            {"weight" : 1.0, "item" : "teslastaff"},
            {"weight" : 1.0, "item" : "magnorbs"},
            {"weight" : 1.0, "item" : "tentaclegun"},
            {"weight" : 1.0, "item" : "exmachina"},
            {"weight" : 1.0, "item" : "energypickaxe"},
            {"weight" : 1.0, "item" : "evileye"},
            {"weight" : 1.0, "item" : "remotegrenadelauncher"},
            {"weight" : 1.0, "item" : "doomcannon"}
          ]
        }]
      ],
    and made it 17.9% less insane line this
    Code:
      "uniqueWeapon" : [
        [
          0,
          {
            "pool" : [
              {"weight" : 1.0, "item" : "boomerang"},
              {"weight" : 1.0, "item" : "chakram"},
              {"weight" : 1.0, "item" : "ropewhip"},
              {"weight" : 1.5, "item" : "gauntlet"},
              {"weight" : 1.0, "item" : "flamethrower"},
              {"weight" : 1.0, "item" : "poisonbow"},
              {"weight" : 1.0, "item" : "pollenpump"}
            ]
          }
        ],
        [
          2.9,
          {
            "pool" : [
              {"weight" : 0.5, "item" : "boomerang"},
              {"weight" : 0.5, "item" : "chakram"},
              {"weight" : 0.75, "item" : "gauntlet"},
              {"weight" : 1.0, "item" : "vinewhip"},
              {"weight" : 1.0, "item" : "wormgun"},
              {"weight" : 1.0, "item" : "wormerang"},
              {"weight" : 1.0, "item" : "gristlegun"},
              {"weight" : 1.0, "item" : "soulseeker"},
              {"weight" : 1.0, "item" : "electricrailgun"},
              {"weight" : 1.0, "item" : "timepierce"},
              {"weight" : 1.0, "item" : "eyesword"},
              {"weight" : 1.0, "item" : "intestinewhip"},
              {"weight" : 0.2, "item" : "gnomegun"}
            ]
          }
        ],
        [
          4.9,
          {
            "pool" : [
              {"weight" : 1.0, "item" : "supernovaglove"},
              {"weight" : 1.0, "item" : "astrosabredeluxe"},
              {"weight" : 1.0, "item" : "energywhip"},
              {"weight" : 1.0, "item" : "teslastaff"},
              {"weight" : 1.0, "item" : "magnorbs"},
              {"weight" : 1.0, "item" : "tentaclegun"},
              {"weight" : 1.0, "item" : "exmachina"},
              {"weight" : 1.0, "item" : "energypickaxe"},
              {"weight" : 1.0, "item" : "evileye"},
              {"weight" : 1.0, "item" : "remotegrenadelauncher"},
              {"weight" : 1.0, "item" : "doomcannon"}
            ]
          }
        ]
      ]
    Does it become easier to read the pathing?
     
    Last edited: Jan 28, 2017
    Jandroan and IHart like this.
  6. Jandroan

    Jandroan Subatomic Cosmonaut

    The game always crashes on startup.

    the filename of the item's file is pnwavianbroadsword.activeitem.activeitem. its in PlayableNPCWeapons\items\active\weapons\melee\broadsword
    the patch file is in PlayableNPCWeapons/treasure. and is named common.treasurepools.patch

    i also uploaded the .log file if that will help.
    starbound.log
     

    Attached Files:

  7. bk3k

    bk3k Oxygen Tank

    Does it crash with the patch I provided?
     
    Jandroan likes this.
  8. Jandroan

    Jandroan Subatomic Cosmonaut

    wait a sec, IT ACTUALLY WORKS, i just tried copy-pasting your patch and it worked! for some reason it didn't when i manually retyped it, don't know what was different but THANK YOU! i hopefully can get the rest of the mod working now
     
  9. IHart

    IHart Scruffy Nerf-Herder

    The difference highlights the importance of precision in pathing and patching and coding in general.

    Where your code read
    Code:
    "/uniqueWeapon/2/pool/-"
    it should have been
    Code:
    "/uniqueWeapon/2/1/pool/-"
    bk3k caught this where i did not, good thing we have lots of eyes.

    Review the pathing guide portion of The Suits modding guide, and utilize tools like http://chbrown.github.io/rfc6902/ to ensure you get your desired output.
     

Share This Page