Announcement

Collapse
No announcement yet.

[How-To | Troubleshooting] - Adding/Editing an item with a custom inventory

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [How-To | Troubleshooting] - Adding/Editing an item with a custom inventory

    There are a few tutorials on this but I wanted to also show how to work through an issue by thinking diagnostically.

    I have been a programmer for years, but I have little to no experience with graphics engines. I am building a mod called primitive plus which adds more items (nerfed in most cases) for a more immersive primitive experience. Let's get down to business! For this piece of tI am making a modded crop plot that will take an alternative type of fertilizr (bonemeal). Bone meal is a mixture of finely and coarsely ground animal bones and slaughter-house waste products. It is used as an organic fertilizer for plants.

    There are a few tutorials on this but i'll give my take on it. This assumes you have already set up a folder and created a custom PrimalGameData. Also, I am not saying this is the best practice for doing these things. This is just an example of one way to do it and how to troubleshoot through issues

    Primary Objectives
    1. Add New Structure Type - (Crop Plot)
    2. Add New Consumable - (Fertilizer)
    3. Allow New Inventory Item in New Structure Type


    Add New Structure Type
    I hadn't read any tutorials on this and started digging into the game myself. I read the basics on setting up a mod folder and game data but that was it. The rest was through experimenting and rational thinking.
    1.Find the item you want to clone.

    First thing I did was find the item I wanted to modify. The easiest way was by searching through the "GAME" folder. If you want to clone an item, there will be a "EngramEntry_" item and an accompanying "PrimalItem_" file to copy (for most basic items) for more complex items you will need to copy more. It cant hurt to copy them all and then get rid of what you don't use if you aren't sure what you'll need (This will get easier in time)! In my case I am editing a place-able structure with an inventory so I also need to grab the static model (Not the actual mesh). The reason for this is because I want to edit the inventory of the static model which can only be done inside the static model object. In contrast to the custom fertilizer I'm making (in which I didn't need to edit the static model)
    Click image for larger version

Name:	capture_finditem.PNG
Views:	1
Size:	137.0 KB
ID:	1158684

    2.Configure the copied files.
    1. Copy these over to your custom mod folder.
    2. Rename files appropriately.
    3. Edit your EngramEntry_ file and search for "Blue Print Entry" and change to your custom PrimalItem from above (This is telling the game to assign your new item vs. the old one you are replacing)


    Click image for larger version

Name:	updateprimal.PNG
Views:	1
Size:	66.4 KB
ID:	1158685
    3.Configure your PrimalItem.
    1. Open your PrimalItem entry and look for "Structure To Build". In my case I need to select my custom static model I spoke of above. You will not need to do this for all mods.
    2. Make any other edits. Areas of interest might be "Base Crafting Resource Requirements" (Changes mats needed to craft object), "Crafting Requires Inventory Component" (Changes which item crafts the object), "Item Stat Infos " (Changes armor rating, etc)


    Click image for larger version

Name:	staticmesh.PNG
Views:	1
Size:	91.6 KB
ID:	1158686
    3.Configure your static mesh. (OPTIONAL)
    This is mostly for buildable objects in which you want to customize
    1. Open your static mesh entry and look for "Consumes Primal Item". This is where you want to select your custom PrimalItem above.
    2. We will need to edit this file again later.


    Add New Consumable
    After going through the process above, this process would be almost identical except I didn't need to edit the static mesh. Complete steps 1, 2, and 3 of "Creating New Structure Type" to add a new fertilizer to the game. Be sure to model it after the existing fertilizer to prevent the need of making a lot of changes

    **Extra Steps**
    You will notice that fertilizer has no specific engram since its made as a byproduct of poo and thatch. Since my new fertilizer wouldn't be made in a compost bin, but crafted at a mortal and pestle, I had to give it a new engram. I modeled it after the narcotic "EngramEntry_" thinking that it already used the moral and pestle so again, less to configure.

    Allow New Item Type In Inventory
    This is where I got a bit lost. I tested prior to this and was able to get my crop plot in the game but it wouldn't take my new fertilizer. I didn't see any properties attached to the "PrimalItem" or "EngramEntry" that allowed me to change what items could be stored in it.

    This is where you have to use the resources around you. There is a nifty feature called "View References" (Asset --> View References) that allows you to see everything connected to a particular object. I used it first on the PrimalItem which pointedback to the static mesh I edited. Ok, that seemed to be linked properly and didn't show any unknown objects I hadnt edited yet. I decided to open the static mesh to see everything referenced in it. On the right side, I saw an item prefixed "PrimalInventory_". Interesting, I hadn't edited that one yet.
    Click image for larger version

Name:	references.PNG
Views:	1
Size:	208.6 KB
ID:	1158689

    I make copies of those files, rename, and open to edit the parameters. Eureka!!! There are the values I need to edit!! For anyone that needs to edit the values of an inventory (Torch, Campfire, Reservoir, etc), you will need to make edits in the "PrimalInventory" files.

    After this point it took a bit of clicking around to find out where I needed to change this reference. On the static mesh, click on the Components" icon in the top right to see the existing "PrimalInventory" file. You simply need to replace this with yours.

    PROFIT
    Well not exactly. Loaded the game up and I was able to see my new crop plot in my inventory but when I went to place it on the ground, it wouldn't place. What gives!?!? I keep digging around in the reference viewer until I find something named "StructurePlacerBlueprint". This seemed like the root to my problem. Everything else seemed to be working fine, I just couldn't place my new item.

    While I thought this was the right thing to edit, turns out it was not

    Clarification: As JasonFJ pointed out, you want to add the new items to "Additional Structures to Place" in your custom PrimalGameData.

    That's where you will want to add your new structures. After adding my new items, I was good to go!

    Hopefully this is of help to someone. And hopefully it shows that just by intuitive thinking and experimenting, you too can make mods without a ton of background in video game modding.
    Attached Files
    Last edited by ComplexMinded; 08-01-2015, 10:27 PM. Reason: JasonFJ correction
    Wildcard Mod Liaison | Creator of Primitive+ Survival

    #2
    Nice walkthrough. One small correction I noticed at the end... you don't modify the StructurePlacerBlueprint... you use the Additional Structures to Place in PrimalGameData.

    Comment


      #3
      Thanks for that!
      Wildcard Mod Liaison | Creator of Primitive+ Survival

      Comment


        #4
        Adding this to the [INFO/LINKS] stickied thread! Great job with this

        Comment

        Working...
        X