Jump to content

Recommended Posts

Hello friends,
I am aware that there already a couple of guides on this topic but I just can't seem to make this work, so I hope that some of you can help me understand this better.
I am trying to create a prefab structure that lets the player access a custom crafting tab ONLY when they are standing next to it, every character should be able to access this prototyper so there's no need for special tags.
I've managed to create a custom recipe with AddRecipe2, and I was also able to make the custom crafting tab show up with the proper image, but I was unable to link the tab to the prefab that I want to use as the crafting station, so as of now the crafing tab is always present and the player can craft whatever recipe is inside it from anywhere, which is no good.
I won't bother posting what i coded so far because im pretty sure that it's just full of mistakes and I would like to start over, so please, if you can, try to explain this to me from the beginning.
Thank you a lot for your help!

Hi there. Sounds like you're missing the tech. I haven't actually created custom techs, so I might be off, but I think: create a new tech by adding it to the TECH constant, have your recipe require your new tech, give your crafting station the prototyper component and create a new tech tree via the Create function in techtree.lua and assign this tech tree to the crafting station's inst.components.prototyper.trees. If you don't want characters to be able to learn the recipe, it'll need nounlock=true. Good luck!

@alainmcd Hey man, thank you for your swift response, it was like you said, I was missing the tech table part, the guide I was following made no mention of this, so I was a bit lost, but I managed to get it done by looking at how a couple of other mods handled this part, and it wasn't too difficult in the end.
Many thanks again for your help, I've been hitting my head against this issues for a couple of days now x)

If anyone else is having trouble with this part, here's what I was missing, you need to put this in your modmain, just change CUSTOMCRAFT with your tech name.

local TechTree = require("techtree")
table.insert(TechTree.AVAILABLE_TECH, "CUSTOMCRAFT")

TechTree.Make = function(t)
  t = t or {}
  for i, v in ipairs(TechTree.AVAILABLE_TECH) do
      t[v] = t[v] or 0
  end
  return t
end

GLOBAL.TECH.NONE.CUSTOMCRAFT = 0
GLOBAL.TECH.CUSTOMCRAFT_ONE = { CUSTOMCRAFT = 1 }
GLOBAL.TECH.CUSTOMCRAFT_TWO = { CUSTOMCRAFT = 2 }

for k,v in pairs(TUNING.PROTOTYPER_TREES) do
    v.CUSTOMCRAFT = 0
end

TUNING.PROTOTYPER_TREES.CUSTOMCRAFT_ONE = TechTree.Make({
   CUSTOMCRAFT = 1,
})
TUNING.PROTOTYPER_TREES.CUSTOMCRAFT_TWO = TechTree.Make({
     CUSTOMCRAFT = 2,
 })

for i, v in pairs(GLOBAL.AllRecipes) do
  if v.level.CUSTOMCRAFT== nil then
    v.level.CUSTOMCRAFT = 0
  end
end

  • Like 2

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...