SquareRoot Posted June 7, 2015 Share Posted June 7, 2015 Hello!I'm making a character mod, but I don't know much about coding. I'm done with pretty much everything but I can't figure out how to make a certain perk work - I need my character to lose sanity every time they eat vegetables. Could I ask for a tip?Thanks a lot~ Link to comment Share on other sites More sharing options...
Blueberrys Posted June 7, 2015 Share Posted June 7, 2015 @SquareRootinst:ListenForEvent("oneat", function(inst, data) -- When you eat something if data.food.components.edible.foodtype == "VEGGIE" then -- If it's a veggie inst.components.sanity:DoDelta(-10) -- Decrease sanity endend) Link to comment Share on other sites More sharing options...
SquareRoot Posted June 7, 2015 Author Share Posted June 7, 2015 @SquareRootinst:ListenForEvent("oneat", function(inst, data) -- When you eat something if data.food.components.edible.foodtype == "VEGGIE" then -- If it's a veggie inst.components.sanity:DoDelta(-10) -- Decrease sanity endend)Sorry to bother, but where do I place this? I tried adding it to modmain.lua and it didn't work- Apologies for the stupid questions ahh... Link to comment Share on other sites More sharing options...
Blueberrys Posted June 7, 2015 Share Posted June 7, 2015 @SquareRoot In a place where the inst variable refers to your player instance. Usually, that's in your player file, inside the "fn" function. Link to comment Share on other sites More sharing options...
SquareRoot Posted June 8, 2015 Author Share Posted June 8, 2015 Oh! Okay!Thanks a lot!! Link to comment Share on other sites More sharing options...
Recommended Posts
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.