Jump to content

How to make recipe exclusive to specific character?


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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...