Aurorance Posted April 4, 2021 Share Posted April 4, 2021 I have seen a tutorial about making a character gain more/less value on the specific food, the example looks like this AddPrefabPostInit("carrot", function(inst) if GetPlayer().prefab == "character" then inst.components.edible.healthvalue = 2 inst.components.edible.hungervalue = 0 inst.components.edible.sanityvalue = -3 end end) However, this only works on the specified food (carrot), and I want it works on every food. What should I edit to make it works? Also, I want to combine it with the perk below AddPrefabPostInit("nightmarefuel", function(inst) if GetPlayer().prefab == "gojo" then inst:AddComponent("edible") inst.components.edible.foodtype = "MEAT" inst.components.edible.healthvalue = 5 inst.components.edible.hungervalue = 10 inst.components.edible.sanityvalue = 10 end end) I make my character (named gojo) can eat nightmare fuels. If I want to make Gojo gain half of the values only when eating anything, except nightmare fuel (still 5,10,10 respectively) what and where(character pretab or modmian.lua?) should I add in the lua file? Sorry if the questions are unclear. P.S. learning how to create a character mod recently (from 0 knowledge of coding), I hope someone can help me through answering my frequently-asked noob questions through discord. I will be very thankful for that if someone can help me! Link to comment Share on other sites More sharing options...
DecDuck Posted April 4, 2021 Share Posted April 4, 2021 Use: inst.components.eater:SetAbsorptionModifiers(0.5, 0.5, 0.5) in the character file. Then just make that values for nightmare fuel double 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now