Jump to content

Recommended Posts

I'm currently in the process of making my first character mod! Its going well so far, but this character has two aspects I need some help with coding with. 
a) Being able to consume cut grass/tufts as a food
b) Having a higher temperature

If anyone could help that would be amazing!  

14 hours ago, spag.jpg said:

a) Being able to consume cut grass/tufts as a food

Something like this, under the "master_postinit" function inside your character's prefab, should allow you to eat some items...

if inst.components.eater ~= nil then 
    table.insert(inst.components.eater.preferseating, FOODTYPE.ROUGHAGE) -- FOODTYPE.ROUGHAGE includes items such as Twigs, Cut Grass and Cut Reeds.
    table.insert(inst.components.eater.caneat, FOODTYPE.ROUGHAGE) 
    inst:AddTag(FOODTYPE.ROUGHAGE.."_eater") -- Not needed. Added in case you need to check if the character eats it. 
end
14 hours ago, spag.jpg said:

b) Having a higher temperature

Uh... What do you mean? Have them take longer to freeze?

3 hours ago, HarryPPP said:

Something like this, under the "master_postinit" function inside your character's prefab, should allow you to eat some items...


if inst.components.eater ~= nil then 
    table.insert(inst.components.eater.preferseating, FOODTYPE.ROUGHAGE) -- FOODTYPE.ROUGHAGE includes items such as Twigs, Cut Grass and Cut Reeds.
    table.insert(inst.components.eater.caneat, FOODTYPE.ROUGHAGE) 
    inst:AddTag(FOODTYPE.ROUGHAGE.."_eater") -- Not needed. Added in case you need to check if the character eats it. 
end

Uh... What do you mean? Have them take longer to freeze?

Yes! sorry i should've specified. Thanks so much for help with the first one!

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...