Jump to content

Diet Modification Help


Naidingo

Recommended Posts

I am trying to make my character have negative affects from eating fruits/veggies and be able to eat monster meat just like regular meat. This is the coding I have written for it at the moment, but it does not work. It doesn't crash the game but none of the affects I tried to write are going off and not sure what the problem is. Is anyone able to help point out what I did wrong?

 

 

post-588148-0-67247400-1423439298_thumb.

Link to comment
https://forums.kleientertainment.com/forums/topic/50744-diet-modification-help/
Share on other sites

@Naidingo Defining a local function won't do anything. You need to override whichever function you're trying to change.

I recommend you read more on lua scope, and see the Eater component ("..\scripts\components\eater.lua") to find which function you want to override.

@Naidingo, welcome!

 

Here's a bit of code to get you started.

inst.components.eater.old_Eat = inst.components.eater.Eatinst.components.eater.Eat = function(self, food)    -- Do your stuff here        inst.components.eater:old_Eat(food)end

Read the "Tables as objects (and how to modify their functions nicely)" section of this guide for more information.

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