Scoobie101 Posted April 17, 2016 Share Posted April 17, 2016 Hello! I'm making my first mod character and everything is going good. I have textures, sounds, perks, everything is working nicely. However, just to finish up my character I wanted to give her some bonus perks that aren't as obvious just to make her feel more unique. I want her to have extra sanity gain from eating sweet foods like honey, taffy, pumpkin cookies, etc. I've been through quite a few topics on the forums and nothing seems to be working for me. There seems to be a lot of ways of doing this and it's kinda confusing and overwhelming... Link to comment Share on other sites More sharing options...
RyanandLink Posted April 17, 2016 Share Posted April 17, 2016 Ah! I know how to do this! My character actually has this perk when eating fruits such as berries, etc. local OldEat = inst.components.eater.Eat inst.components.eater.Eat = function(self, food) if food and food.components.edible and food.prefab == "berries" then food.components.edible.sanityvalue = 2 end return OldEat(self, food) end and then you replace "berries" with your food item and sanityvalue to what you want keep in mind that (I think) it adds up! You add this in your character's prefab file, in local master_postinit = function(inst) Link to comment Share on other sites More sharing options...
Scoobie101 Posted April 17, 2016 Author Share Posted April 17, 2016 Finally! Wow, posted and answered in the same day! I didn't want to make my own post because I thought it would take like, a week for a helpful answer! It works like a charm, thanks for the help :3 Also, It doesn't add up, I changed the number to 20 for taffy (which gives 15 sanity) and I got 20 instead of 35. Which is fine in my case :3 Link to comment Share on other sites More sharing options...
Aquaterion Posted April 17, 2016 Share Posted April 17, 2016 2 minutes ago, Scoobie101 said: Finally! Wow, posted and answered in the same day! I didn't want to make my own post because I thought it would take like, a week for a helpful answer! It works like a charm, thanks for the help :3 Also, It doesn't add up, I changed the number to 20 for taffy (which gives 15 sanity) and I got 20 instead of 35. Which is fine in my case :3 you could do food.components.edible.sanityvalue = food.components.edible.sanityvalue + 2 so that way you keep the food's current sanity value and add the 2 as well, in case you wanted to know. 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