. . . Posted June 11, 2016 Share Posted June 11, 2016 (edited) Hello, I need help! I'm trying to make my character not take any penalties from eating humanmeat so I tried this to offset the penalty but if his at 20 health eating the humanmeat kills him? Is there something I can do to remove "humanmeat", "humanmeat_cooked" & "humanmeat_dried" is side effects? inst:ListenForEvent("oneat", function(inst, data) if data.food.prefab == "humanmeat" then inst.components.health:DoDelta(20) inst.components.sanity:DoDelta(33) end end) Help would be appreciated . Edited June 11, 2016 by SuperDavid Link to comment https://forums.kleientertainment.com/forums/topic/68087-how-to-make-character-not-get-penalty-on-eating-humanmeat/ Share on other sites More sharing options...
Aquaterion Posted June 11, 2016 Share Posted June 11, 2016 (edited) This should work for the health, so keep the current code for the sanity part(remove the health line) --modmain.lua local humanmeats = { "humanmeat", "humanmeat_cooked", "humanmeat_dried" } for k,v in pairs(humanmeats) do AddPrefabPostInit(v, function(inst) if not GLOBAL.TheWorld.ismastersim then return inst end inst.components.edible:SetGetHealthFn(function(inst, eater) if eater:HasTag("adam") then -- replace with a tag for your character return 0 end return nil --nil will make it default to its original health value end) end) end Edited June 11, 2016 by Aquaterion Link to comment https://forums.kleientertainment.com/forums/topic/68087-how-to-make-character-not-get-penalty-on-eating-humanmeat/#findComment-782438 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