Starbound

Starbound

RPG Growth
This topic has been locked
MalefactorIX Jan 14, 2019 @ 2:54pm
[Fixed] Treasurepool.patch is locking out other mods which add to them
Edit:

Issue was found to be unrelated to this mod and has be corrected. Thanks for your help!
Last edited by MalefactorIX; Jan 17, 2019 @ 12:42pm
< >
Showing 1-15 of 20 comments
Zancuno Jan 14, 2019 @ 3:03pm 
I'm from the Lucario Race Mod and can confirm this. I have been tinkering with the code for a while because this has locked my essence of aura out from dropping. I noticed that you probably used { because it is a single pool you are adding but I found this in the base game files:

"adultpoptopVaultTreasure" : [ [1, { "fill" : [ {"pool" : "essenceDrop"} ], "pool" : [ {"weight" : 0.994, "item" : "sharpenedclaw"}, {"weight" : 0.006, "item" : "adultpoptopaf"} ], "poolRounds" : [ [0.80, 0], [0.20, 1] ], "allowDuplication" : false }] ],

even single pool fill commands are an array. I hope this helps
Zancuno Jan 15, 2019 @ 5:51am 
Originally posted by Azure Fang:

Originally posted by Chaika? Yes. Chaika.:

Because Steam doesn't notify if a new discussion was created.
Chaika? Yes. Chaika.  [developer] Jan 16, 2019 @ 4:31pm 
Wait, no, how is this an error? The test is checking if fill exists, and it does, so it adds the object to the fill array.
Last edited by Chaika? Yes. Chaika.; Jan 16, 2019 @ 4:38pm
Chaika? Yes. Chaika.  [developer] Jan 16, 2019 @ 4:47pm 
Originally posted by Malefact☢rix DBug:
Here's what you did did:
[ { "op": "test", "path": "/largefishtreasure/0/1/fill", "inverse": false }, { "op": "add", "path": "/largefishtreasure/0/1/fill/-", "value": {"pool": "experienceorbpool"} //Not an array } ]

Here's what should have been done:
[ { "op": "test", "path": "/largefishtreasure/0/1/fill", "inverse": false }, { "op": "add", "path": "/largefishtreasure/0/1/fill/-", "value": [{"pool": "experienceorbpool"} ] //Proper array } ]

Cheers.

Note: Mod priority affects which mods are and aren't affected.
[ { "op": "test", "path": "/largefishtreasure/0/1/fill", "inverse": false }, { "op": "add", "path": "/largefishtreasure/0/1/fill/-", "value": { "pool": "experienceorbpool" } } ], [ { "op": "test", "path": "/largefishtreasure/0/1/fill", "inverse": true }, { "op": "add", "path": "/largefishtreasure/0/1/fill", "value": [{ "pool": "experienceorbpool" }] } ],

This is the full line of code for each treasure patch. Can you explain what the error is exactly, or did you guys jump the gun?
MalefactorIX Jan 16, 2019 @ 8:39pm 
Originally posted by Chaika? Yes. Chaika.:
This is the full line of code for each treasure patch. Can you explain what the error is exactly, or did you guys jump the gun?
After correcting the array, we no longer had the issue on our end. The issue was that the patch file(s) were overwritting the modifications made by other mods due to the missing brackets on the array. This caused all mods loaded after (or before) RPG Growth to have their changes wiped.
Last edited by MalefactorIX; Jan 16, 2019 @ 8:41pm
Zancuno Jan 16, 2019 @ 8:58pm 
Originally posted by Chaika? Yes. Chaika.:
Originally posted by Malefact☢rix DBug:
Here's what you did did:
[ { "op": "test", "path": "/largefishtreasure/0/1/fill", "inverse": false }, { "op": "add", "path": "/largefishtreasure/0/1/fill/-", "value": {"pool": "experienceorbpool"} //Not an array } ]

Here's what should have been done:
[ { "op": "test", "path": "/largefishtreasure/0/1/fill", "inverse": false }, { "op": "add", "path": "/largefishtreasure/0/1/fill/-", "value": [{"pool": "experienceorbpool"} ] //Proper array } ]

Cheers.

Note: Mod priority affects which mods are and aren't affected.
[ { "op": "test", "path": "/largefishtreasure/0/1/fill", "inverse": false }, { "op": "add", "path": "/largefishtreasure/0/1/fill/-", "value": { "pool": "experienceorbpool" } } ], [ { "op": "test", "path": "/largefishtreasure/0/1/fill", "inverse": true }, { "op": "add", "path": "/largefishtreasure/0/1/fill", "value": [{ "pool": "experienceorbpool" }] } ],

This is the full line of code for each treasure patch. Can you explain what the error is exactly, or did you guys jump the gun?
Basically saying, having the experience pool as { } makes it to where you are making every fill by patch just your XP orbs. The { } is not an array. An array allows you to have multiple options for the code to pull from. Arrays in JSON use [ ], without that the code cannot recognise it as an array. Having the { } adds the XP Orbs as an pool inserted into fill yes, but without the array, nothing else can be inserted into the fill line. Having it set up as [ { } ] makes it an array and thus things can be added to the fill line by other patches. Without the array, you basically put a lock on the fill line to only allow your mod to use it. Having just { } instead of [ { } ] makes your XP Orbs the only option the fill line can drop.

[ ] = array = a bracket set in JSON that defines a list that code can chose keys from. Also allows additional keys to be added to the list.

" " = key

{ } = a bracket set in JSON that is used to contain additional parameters for a key.

[ ] = list

{ } = single key with parameters

TL;DR { } is a single option. [ ] creates a list that can have things added to it:

[ list
{Single thing},
{Single thing},
{Thing added from another patch file}
] end list
Last edited by Zancuno; Jan 16, 2019 @ 9:53pm
Chaika? Yes. Chaika.  [developer] Jan 16, 2019 @ 10:03pm 
Originally posted by Zancuno:
Originally posted by Chaika? Yes. Chaika.:
[ { "op": "test", "path": "/largefishtreasure/0/1/fill", "inverse": false }, { "op": "add", "path": "/largefishtreasure/0/1/fill/-", "value": { "pool": "experienceorbpool" } } ], [ { "op": "test", "path": "/largefishtreasure/0/1/fill", "inverse": true }, { "op": "add", "path": "/largefishtreasure/0/1/fill", "value": [{ "pool": "experienceorbpool" }] } ],

This is the full line of code for each treasure patch. Can you explain what the error is exactly, or did you guys jump the gun?
Basically saying, having the experience pool as { } makes it to where you are making every fill by patch just your XP orbs. The { } is not an array. An array allows you to have multiple options for the code to pull from. Arrays in JSON use [ ], without that the code cannot recognise it as an array. Having the { } adds the XP Orbs as an pool inserted into fill yes, but without the array, nothing else can be inserted into the fill line. Having it set up as [ { } ] makes it an array and thus things can be added to the fill line by other patches. Without the array, you basically put a lock on the fill line to only allow your mod to use it. Having just { } instead of [ { } ] makes your XP Orbs the only option the fill line can drop.

[ ] = array = a bracket set in JSON that defines a list that code can chose keys from. Also allows additional keys to be added to the list.

" " = key

{ } = a bracket set in JSON that is used to contain additional parameters for a key.

[ ] = list

{ } = single key with parameters

TL;DR { } is a single option. [ ] creates a list that can have things added to it:

[ list
{Single thing},
{Single thing},
{Thing added from another patch file}
] end list

That doesn't make any sense. The json should be adding a key,value pair to the end of an already existing array, not overwriting a previous array and making it a pair. If changing it fixed the issue, there has to be some other thing at play here.

Also, you explaining in detail the difference between arrays and json objects like I don't know is kind of insulting.
Hiran Jan 16, 2019 @ 10:46pm 
If what you wrote is correct then game should handle both fill as {} and [ {},{} ] tables.
Chaika? Yes. Chaika.  [developer] Jan 17, 2019 @ 3:56am 
Here, I even tested it with a config file of my own, which you can do so too if you want.

testTreasure.config
{ "test1" : { "fill" : [{"pool" : "ancientEssenceOrWhatever"}] }, "test2" : {} }

testTreasure.config.patch
[ [ { "op": "test", "path": "/test1/fill", "inverse": false }, { "op": "add", "path": "/test1/fill/-", "value": { "pool": "experienceorbpool" } } ], [ { "op": "test", "path": "/test1/fill", "inverse": true }, { "op": "add", "path": "/test1/fill", "value": [ { "pool": "experienceorbpool"} ] } ], [ { "op": "test", "path": "/test2/fill", "inverse": false }, { "op": "add", "path": "/test2/fill/-", "value": { "pool": "experienceorbpool" } } ], [ { "op": "test", "path": "/test2/fill", "inverse": true }, { "op": "add", "path": "/test2/fill", "value": [ { "pool": "experienceorbpool"} ] } ] ]

Output:
{ "test1": { "fill": [ {"pool":"ancientEssenceOrWhatever"}, {"pool":"experienceorbpool"} ] }, "test2": { "fill": [ {"pool":"experienceorbpool"} ] } }

I know the difference between Objects and Arrays/Lists, and I know what Key/Value pairs are, so your lengthy explanation, maybe despite good intentions, comes off as rude and condescending.
Last edited by Chaika? Yes. Chaika.; Jan 17, 2019 @ 3:59am
Chaika? Yes. Chaika.  [developer] Jan 17, 2019 @ 4:13am 
I took it further just to ensure my point by adding this to my monster treasure pool patch:
//Test [ { "op": "test", "path": "/generatedFlyingMonsterTreasure/0/1/fill", "inverse": false }, { "op": "add", "path": "/generatedFlyingMonsterTreasure/0/1/fill/-", "value": {"item" : ["ivrpgscrollinfernal", 1]} } ], [ { "op": "test", "path": "/generatedFlyingMonsterTreasure/0/1/fill", "inverse": true }, { "op": "add", "path": "/generatedFlyingMonsterTreasure/0/1/fill", "value": [ {"item" : ["ivrpgscrollinfernal", 1]} ] } ], //

Lo and behold, level 1 flying monsters start dropping both Experience Orbs and Infernal Scrolls, despite having patched in both separately, thus apparently 'over-writing' the fill array.

When I change to the 'fix' you suggest, it immediately crashes the area once you kill the monster in question, as it attempts to read a completely wrong datatype.
MalefactorIX Jan 17, 2019 @ 4:48am 
Originally posted by Chaika? Yes. Chaika.:
When I change to the 'fix' you suggest, it immediately crashes the area once you kill the monster in question, as it attempts to read a completely wrong datatype.
That's odd because it's working as it should be for me with the fix.
Chaika? Yes. Chaika.  [developer] Jan 17, 2019 @ 4:50am 
Originally posted by Zancuno:
Originally posted by Chaika? Yes. Chaika.:
[ { "op": "test", "path": "/largefishtreasure/0/1/fill", "inverse": false }, { "op": "add", "path": "/largefishtreasure/0/1/fill/-", "value": { "pool": "experienceorbpool" } } ], [ { "op": "test", "path": "/largefishtreasure/0/1/fill", "inverse": true }, { "op": "add", "path": "/largefishtreasure/0/1/fill", "value": [{ "pool": "experienceorbpool" }] } ],

This is the full line of code for each treasure patch. Can you explain what the error is exactly, or did you guys jump the gun?
Basically saying, having the experience pool as { } makes it to where you are making every fill by patch just your XP orbs. The { } is not an array. An array allows you to have multiple options for the code to pull from. Arrays in JSON use [ ], without that the code cannot recognise it as an array. Having the { } adds the XP Orbs as an pool inserted into fill yes, but without the array, nothing else can be inserted into the fill line. Having it set up as [ { } ] makes it an array and thus things can be added to the fill line by other patches. Without the array, you basically put a lock on the fill line to only allow your mod to use it. Having just { } instead of [ { } ] makes your XP Orbs the only option the fill line can drop.

[ ] = array = a bracket set in JSON that defines a list that code can chose keys from. Also allows additional keys to be added to the list.

" " = key

{ } = a bracket set in JSON that is used to contain additional parameters for a key.

[ ] = list

{ } = single key with parameters

TL;DR { } is a single option. [ ] creates a list that can have things added to it:

[ list
{Single thing},
{Single thing},
{Thing added from another patch file}
] end list

Also, I took the liberty to install your mod and took a look at your monster patch file:
{ "op" : "add", "path": "/basicMonsterTreasure/0/1/fill", "value" : [ {"pool" : "eauraDrop"} ] }, { "op" : "add", "path": "/flyingMonsterTreasure/0/1/fill", "value" : [ {"pool" : "eauraDrop"} ] }, { "op" : "add", "path": "/noMeatMonsterTreasure/0/1/fill", "value" : [ {"pool" : "eauraDrop"} ] }, { "op" : "add", "path": "/largefishtreasure/0/1/fill", "value" : [ {"pool" : "eauraDrop"} ] }

So let's see... You aren't testing to see if "fill" already exists. Well that's no good, because then it will replace whatever fill already exists. If you have multiple mods that patch treasure like this, the last one to load will always simply erase what was previously there. That's why my patch files have explicit tests to prevent this from happening. Take a look:

[{ "op": "test", "path": "/erchiushorrorTreasure/0/1/fill", "inverse": false }, { "op": "add", "path": "/erchiushorrorTreasure/0/1/fill/-", "value": { "item": ["experienceorb", 250] } } ], [{ "op": "test", "path": "/erchiushorrorTreasure/0/1/fill", "inverse": true }, { "op": "add", "path": "/erchiushorrorTreasure/0/1/fill", "value": [{ "item": ["experienceorb", 250] } ] } ],

So in this case, we use the "op" : "test" and "inverse" : false line to test if "fill" exists. If it does, we add our JSON object to the fill array usig "path" : "/erchiushorrorTreasure/0/1/fill/-".

The next test sets "inverse" to true: in that case, if "fill" was not found, we set "fill" to an array containing our JSON object.

By doing each patch like this, we ensure we never overwrite anyone's "fill" or any value for that matter, and we also prevent bad patch errors, etc.

It's a bit embarrassing that you went on an entire 'teaching' charade, but failed to apply tests to your patch files to ensure you don't overwrite other people's work.

I don't know how you guys 'fixed' the issue by changing my code, because that would most certainly crash the game whenever the game then tries to load the completely botched fill pool, most likely now containing [{}, [{}]]
Chaika? Yes. Chaika.  [developer] Jan 17, 2019 @ 4:51am 
Originally posted by Malefact☢rix DBug:
Originally posted by Chaika? Yes. Chaika.:
When I change to the 'fix' you suggest, it immediately crashes the area once you kill the monster in question, as it attempts to read a completely wrong datatype.
That's odd because it's working as it should be for me with the fix.

What treasure patches are you working with, and when does your mod load. If you changed it to what you wrote, you'd most certainly ruin the fill array unless another mod overwrites it.
MalefactorIX Jan 17, 2019 @ 4:57am 
Originally posted by Chaika? Yes. Chaika.:
What treasure patches are you working with, and when does your mod load. If you changed it to what you wrote, you'd most certainly ruin the fill array unless another mod overwrites it.
I'm going to retest all the mods that overwrite the files in question some time later today and I'll get back with you so I can give you a more concrete answer.
Chaika? Yes. Chaika.  [developer] Jan 17, 2019 @ 5:01am 
Originally posted by Malefact☢rix DBug:
Originally posted by Chaika? Yes. Chaika.:
What treasure patches are you working with, and when does your mod load. If you changed it to what you wrote, you'd most certainly ruin the fill array unless another mod overwrites it.
I'm going to retest all the mods that overwrite the files in question some time later today and I'll get back with you so I can give you a more concrete answer.

Awesome. Thanks for at least not being super condescending like Zancuno. I assume we both know how to code/mod, and things fall through the cracks all the time, so it was entirely possible I had made a mistake somewhere, but those lengthy, dumbed down instructions by Zancuno kind of hit a nerve.

Hope you find the issue, and please do let me know if there really isn't anything else causing it.
< >
Showing 1-15 of 20 comments
Per page: 1530 50