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.

SquareRoot

Help with simple coding?

Recommended Posts

SquareRoot    0

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~

Share this post


Link to post
Share on other sites
Blueberrys    172

@SquareRoot

inst: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)

Share this post


Link to post
Share on other sites
SquareRoot    0

 

@SquareRoot

inst: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...

 

Share this post


Link to post
Share on other sites