Jump to content

Help with simple coding?


Recommended Posts

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

 

@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...

 

Link to comment
Share on other sites

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.

×
  • Create New...