takoyamaa Posted September 25, 2017 Share Posted September 25, 2017 (edited) Hi! I don't know if this is a bit of a dumb question, but I'm creating a character mod and I got the art down and all the quotes too. The thing I need to do now is give my character his assigned traits. I want him to be able to read wickerbottoms books, be able to eat raw meat with no sanity loss and 3 points of hunger, as well as eat any sweet foods (cookies, ice cream, taffy, etc) with a bit of a bigger bonus, but the thing is i don't know how to make that happen...i just see all the things for the art and the speech files and what not. Help would be appreciated bc im dumb. Edited September 25, 2017 by takoyamaa Link to comment Share on other sites More sharing options...
ptr Posted September 26, 2017 Share Posted September 26, 2017 I believe you should do some code reading on character mods and relative posts first... Or, what you need is to find a teammate... Link to comment Share on other sites More sharing options...
Lumina Posted September 26, 2017 Share Posted September 26, 2017 Look at wickerbottom.lua and look also at waxwell.lua. Both character are able to read books so you could try to guess what you need to be able to make your character able to read book. Note : being able to read book and to craft them are two different things. Link to comment Share on other sites More sharing options...
. . . Posted September 26, 2017 Share Posted September 26, 2017 (edited) For reading Wickerbottom books put this inside YOURCHARACTER.lua inside the master_postinit Spoiler inst:AddComponent("reader") To be able to eat raw meat with no Sanity penalty & bonus 3 points of hunger put this inside YOURCHARACTER.lua inside the master_postinit Spoiler inst.components.eater.Eat_orig = inst.components.eater.Eat function inst.components.eater:Eat(food) if food and food.components.edible and food.components.edible.foodtype == FOODTYPE.MEAT and self:CanEat(food) then if food.components.edible.sanityvalue < 0 then food.components.edible.sanityvalue = 0 inst.components.hunger:DoDelta(3) end end return inst.components.eater:Eat_orig(food) end To get more bonus from eating sweet foods you should put this inside YOURCHARACTER.lua inside the master_postinit Spoiler inst.components.eater:SetOnEatFn(Eat_Sweets) this is also for the sweet bonus put this inside YOURCHARACTER.lua outside the master_postinit Spoiler local function Eat_Sweets(inst, food) local sweets = --add whatever food you want boost from, it needs to be its name which you can spawn it in with console commands { jellybean = true, butterflymuffin = true, icecream = true, taffy = true, waffles = true, pumpkincookie = true, } if sweets[food.prefab] then inst.components.health:DoDelta(5) --replace 5 with whatever boost you would want inst.components.hunger:DoDelta(5) inst.components.sanity:DoDelta(5) inst.components.talker:Say("I love sweets~!") end end I think that should all work ! Edited September 26, 2017 by SuperDavid Link to comment Share on other sites More sharing options...
takoyamaa Posted September 27, 2017 Author Share Posted September 27, 2017 5 hours ago, SuperDavid said: For reading Wickerbottom books put this inside YOURCHARACTER.lua inside the master_postinit Hide contents inst:AddComponent("reader") To be able to eat raw meat with no Sanity penalty & bonus 3 points of hunger put this inside YOURCHARACTER.lua inside the master_postinit Hide contents inst.components.eater.Eat_orig = inst.components.eater.Eat function inst.components.eater:Eat(food) if food and food.components.edible and food.components.edible.foodtype == FOODTYPE.MEAT and self:CanEat(food) then if food.components.edible.sanityvalue < 0 then food.components.edible.sanityvalue = 0 inst.components.hunger:DoDelta(3) end end return inst.components.eater:Eat_orig(food) end To get more bonus from eating sweet foods you should put this inside YOURCHARACTER.lua inside the master_postinit Hide contents inst.components.eater:SetOnEatFn(Eat_Sweets) this is also for the sweet bonus put this inside YOURCHARACTER.lua outside the master_postinit Hide contents local function Eat_Sweets(inst, food) local sweets = --add whatever food you want boost from, it needs to be its name which you can spawn it in with console commands { jellybean = true, butterflymuffin = true, icecream = true, taffy = true, waffles = true, pumpkincookie = true, } if sweets[food.prefab] then inst.components.health:DoDelta(5) --replace 5 with whatever boost you would want inst.components.hunger:DoDelta(5) inst.components.sanity:DoDelta(5) inst.components.talker:Say("I love sweets~!") end end I think that should all work ! Ok everything seems fine but i keep getting this error message and idk why : ( i tried checking it a couple of times help!! Link to comment Share on other sites More sharing options...
. . . Posted September 27, 2017 Share Posted September 27, 2017 Did you put local function Eat_Sweets(inst, food) local sweets = --add whatever food you want boost from, it needs to be its name which you can spawn it in with console commands { jellybean = true, butterflymuffin = true, icecream = true, taffy = true, waffles = true, pumpkincookie = true, } if sweets[food.prefab] then inst.components.health:DoDelta(5) --replace 5 with whatever boost you would want inst.components.hunger:DoDelta(5) inst.components.sanity:DoDelta(5) inst.components.talker:Say("I love sweets~!") end end ABOVE your master_postinit ? Link to comment Share on other sites More sharing options...
Lumina Posted September 27, 2017 Share Posted September 27, 2017 Also, when you have an error attach your mod (a .zip file with all your mod content) and copy the part of the mod causing the crash (here it should be your character .lua file). You can find more information about the error in the log. Link to comment Share on other sites More sharing options...
takoyamaa Posted September 30, 2017 Author Share Posted September 30, 2017 (edited) On 9/26/2017 at 8:05 PM, SuperDavid said: Did you put local function Eat_Sweets(inst, food) local sweets = --add whatever food you want boost from, it needs to be its name which you can spawn it in with console commands { jellybean = true, butterflymuffin = true, icecream = true, taffy = true, waffles = true, pumpkincookie = true, } if sweets[food.prefab] then inst.components.health:DoDelta(5) --replace 5 with whatever boost you would want inst.components.hunger:DoDelta(5) inst.components.sanity:DoDelta(5) inst.components.talker:Say("I love sweets~!") end end ABOVE your master_postinit ? ok everything works now without much error! Also this post was gonna ask u how to craft the books but i just figured it out! thanks for your help! Edited September 30, 2017 by takoyamaa 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