Jump to content

modding help


Elwood

Recommended Posts

Does anyone know if more logging can be turned on to help with debugging.

I added a few items and recipes (no code, just JSON and textures) and I'm getting this crash but none of the logs tell me which key it could not find in the dictionary.

All i can do is keep deleting items using trial and error.

2018-03-23 11:47:00 AM: Critical error occurred
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
   at System.ThrowHelper.ThrowKeyNotFoundException()
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)

 

Link to comment
Share on other sites

Can't do much about the bad error message - still something that needs to be improved.

Remove the .json files one-by-one to find which one is causing it and share that (as a Gist, for example) and we can have a look at what the cause might be. As you can imagine it's difficult to debug an issue without the .json that causes it.

Link to comment
Share on other sites

I figured out the problem. I was trying to create my own version of a bow in my own domain but it couldn't see bow class from the game domain.  I ended up just extending the main bow item with variants and overiding the game:bow.  Developing a class for my own version of bow is too complex because there are no examples to work from and all the original code is obfuscated so i gave up.

see attached bow.json.  When you put this in a domain besides game it wont launch.

System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.

 

bow.json

Link to comment
Share on other sites

That would be great.  I would also like to see how a fire pit or anvil work.  I'm trying to see how possible it is to do more interactive crafting.  From the looks of it everything in-game is possible to be made using a mod.

Edited by Elwood
wrong word
Link to comment
Share on other sites

Not sure if this should be posted in the regular suggestions or in the modding thread.

Currently grid recipes require undamaged items as inputs unless they are a tool.

But to implement a concept of sharpening stones a damaged item needs to be consumed to produce an item with no damage

For input materials would it be possible to have an option to ignore durability (mutually exclusive from isTool)

Link to comment
Share on other sites

You should be able to use the same code class for a custom item without overriding the item, usually. You placed your .json file into assets/game/itemtypes/... - in the same spot as the Vanilla asset is in?

Regarding your suggestion, I believe I heard from Tyron that you can use wildcards to get that behavior. So instead of requiring "tool-axe" for example you'd use "too*-axe".

Link to comment
Share on other sites

10 hours ago, copygirl said:

You should be able to use the same code class for a custom item without overriding the item, usually. You placed your .json file into assets/game/itemtypes/... - in the same spot as the Vanilla asset is in?

Yes this is how i did it, by putting my changes in assets/game.  I just extended the bow.json and it worked.

I just tried what you suggested and it worked. I created a new bow (copy of bow.json) and named it "longbow" where variants became "longbow-simple" it worked. 

I also got the "sharpening stone" concept to work.  What i wanted to do is allow a person to unstring a bow and get the limb back to put a fresh string on. 

thanks for the help

Link to comment
Share on other sites

  • 2 years later...

I like the sharpening stone idea for my own reason I want to take an item say a pick or axe that has been damaged due to use and just repair it.

I have not tried this as I didn't think to much about it as of yet but your thread has me curious I'm going to take a random stone (doesn't matter what it is) copy it add a new name for it and do a durability on the stone and when you use the stone in the crafting grid with the damaged item it will act kind of like making fire wood with the axe. it will damage the stone like firewood would damage the axe and the input would be the damaged item/tool like a log for firewood and then the output would be the same tool but fully repaired like firewood while doing 1 durability damage to the stone. if this works I'll make an actual sharpening stone a crafting recipe for it and so on. that is if someone else hasn't already done that.

  • Like 1
Link to comment
Share on other sites

I know I made the same bad practice choices of changing game instead of making a seperate mod folder. I don't know much about vintage story and every game I've modded has been different. 

Skyrim, Kenshi, 7 days to die and vintage story are all very different from each other when it comes to modding them. what works for one doesn't work for another so I didn't know what to do in vintage story as I'm totally new to it.

the purple inventory bags you see in this screenshot are also things I added. I also added compressed coal and a coal mix that burns hotter and longer than normal charcoal the compressed coal was mainly for allowing you to mine more and take up less inventory space. all the items I've added work to some degree.

all the items and recipes I've added work except the knapping recipes and clay forming recipes I can't get to work.

I added a new berry bush called purrberry and it's mostly a copy of blueberry bush but I changed the texture and the fruit and name and well everything about it just used blueberry bush as a base to work off of and it works but I can't find it in my world. I have to spawn it in via /gamemode2 (creative) but once I place it down it grows and works perfectly fine. it as well as a few counter crops I made as an experiment work but don't spawn in the world naturally so the only way to get them is creative at the moment. I would like to fix this but don't know how yet.

I don't know why name is like that tho.

all I did is add the purr berry to the existing small bush where blueberries and cranberries are.

 

{
    code: "smallberrybush",
    class: "BlockBerryBush",
    attributes: {
        butterflyFeedByType: {
            "*-flowering": true
        },
        beeFeedByType: {
            "*-flowering": true
        },
        resetBelowTemperature: -1,
        stopBelowTemperature: 4,
        revertBlockBelowTemperature: -4
    },
    entityclass: "BerryBush",
    behaviorsByType: {
        "*-ripe": [ {name: "Harvestable", properties: { 
            harvestTime: 0.6, 
            harvestedStack: { type: "item", code: "fruit-{type}", quantity: { avg: 2.2 }  },
            harvestedBlockCode: "smallberrybush-{type}-empty"
        }} ],
    },
    variantgroups: [
        { code: "type", states: ["blueberry", "purrberry", "cranberry"] },
        { code: "state", states: ["empty", "flowering", "ripe"] },
    ],
    creativeinventory: { "general": ["*"], "flora": ["*"] },
    renderpass: "OpaqueNoCull",
    renderAlphaTest: 0.4,
    shape: { base: "block/plant/smallberrybush_{state}" },
    blockmaterial: "Plant",
    texturesByType: {
        "*-empty": {
            leaves: { base: "block/plant/berrybush/leaves/{type}*" },
            branches: { base: "block/plant/berrybush/branches/default" }
        },
        "*-flowering": {
            leaves: { base: "block/plant/berrybush/leaves/{type}*" },
            branches: { base: "block/plant/berrybush/branches/default" },
            berries: { base: "block/plant/berrybush/flowering/{type}*" },
            berriesup: { base: "block/plant/berrybush/flowering/{type}*" },
        },
        "*-blueberry-ripe": {
            leaves: { base: "block/plant/berrybush/leaves/{type}_ripe*" },
            branches: { base: "block/plant/berrybush/branches/default" },
            berries: { base: "block/plant/berrybush/ripe/{type}*" },
            berriesup: { base: "block/plant/berrybush/ripe/{type}*" },
        },
        "*-purrberry-ripe": {
            leaves: { base: "block/plant/berrybush/leaves/{type}_ripe*" },
            branches: { base: "block/plant/berrybush/branches/default" },
            berries: { base: "block/plant/berrybush/ripe/{type}*" },
            berriesup: { base: "block/plant/berrybush/ripe/{type}*" },
        },
        "*-ripe": {
            leaves: { base: "block/plant/berrybush/leaves/{type}*" },
            branches: { base: "block/plant/berrybush/branches/default" },
            berries: { base: "block/plant/berrybush/ripe/{type}*" },
            berriesup: { base: "block/plant/berrybush/ripe/{type}*" },
        },
        
    },
    sideopaque: {
        all: false
    },
    sidesolid: {
        all: false
    },
    replaceable: 3000,
    lightAbsorption: 0,
    resistance: 0.5,
    collisionbox: null,
    sounds: {
        place: "block/plant",
        break: "block/plant",
        hit: "block/plant",
    },
    rainPermeable: false,
    dropsByType: {
        "*-ripe": [
            { type: "block", code: "smallberrybush-{type}-empty", quantity: { avg: 1 }  },
            { type: "item", code: "fruit-{type}", quantity: { avg: 2.2 }  },
        ],
        "*": [
            { type: "block", code: "smallberrybush-{type}-empty", quantity: { avg: 1 }  }
        ]
    },
    materialDensity: 200,
    vertexFlags: {
        zOffset: 2
    },
    frostable: true,
    combustibleProps: {
        burnTemperature: 600,
        burnDuration: 10,
    }
}

 

it all works except not finding purrberrybush in wild

the blueberry bush and cranberry bush don't show up with weird names but purrberry does for some reason despite being in the same code.

name help.png

Link to comment
Share on other sites

sorry this is the second time it post something in the wrong topic. I don't know why it does this sometimes. this was supposed to be in a different thread where someone else was also having trouble with the name of their items showing up as "game:block-so on and so forth. but for some reason it posted here.

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.