Jump to content

Recommended Posts

eh just copying and pasting a previous post I did, cause why not.

Anyways to make a recipe only accessable to the modded character is simple as putting the recipe code in the character lua, under the main function where all his stats are like so:

local fn = function(inst) --main character function

local armor_device = Recipe("customhatimade", { Ingredient("purplegem", 1),  Ingredient("goldnugget",10) }, RECIPETABS.SCIENCE, {SCIENCE=2})
    armor_device.atlas = "images/inventoryimages/customhatimade.xml"

inst.components.health:SetMaxHealth(200) --reference on where the code goes
    inst.components.hunger:SetMax(200)
    inst.components.sanity:SetMax(200)

end

If the mod crashes when you do this you might need this in the modmain:

local TECH = GLOBAL.TECH
local Ingredient = GLOBAL.Ingredient
local RECIPETABS = GLOBAL.RECIPETABS
local require = GLOBAL.require
local STRINGS = GLOBAL.STRINGS
local resolvefilepath = GLOBAL.resolvefilepath
local ACTIONS = GLOBAL.ACTIONS
local Action = GLOBAL.Action

Hmmm dam I use to be good at this but ill give it a try....

AddComponentPostInit("builder", function(Builder, inst)
    --local addsomerecipe = Builder:AddRecipe
    --function Builder:AddRecipe(rec)
        if inst.prefab == "wilson" then

local armor_device = Recipe("customhatimade", { Ingredient("purplegem", 1),  Ingredient("goldnugget",10) }, RECIPETABS.SCIENCE, {SCIENCE=2})
    armor_device.atlas = "images/inventoryimages/customhatimade.xml"

end
    end
end)

can't remember if the notes are right or what else I have to include, been too long.

Edited by K1NGT1GER609

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...