Recommended Posts

MemphisMyst    1

I was wondering if it would be possible to create a character who only eats nightmare fuel to sustain his hunger, but loses a little sanity every time he eats it. Would this be possible?

Edited by MemphisMyst

Share this post


Link to post
Share on other sites
MemphisMyst    1

Would anyone know if there is a null option that i could use for inst.components.eater:SetDiet? Cause if there is would that be able to work if i add nightmare fuel as a edible afterwards?

Share this post


Link to post
Share on other sites
MemphisMyst    1
1 hour ago, MemphisMyst said:

Would anyone know if there is a null option that i could use for inst.components.eater:SetDiet? Cause if there is would that be able to work if i add nightmare fuel as a edible afterwards?

Would it work if i put this in modmain.lua

local FOODTYPE = GLOBAL.FOODTYPE
FOODTYPE.SHADOW = "SHADOW"

AddComponentPostInit("eater", function(self)
	function self:SetCanEatShadows()
		table.insert(self.preferseating, FOODTYPE.SHADOW)
		table.insert(self.caneat, FOODTYPE.SHADOW)
		self.inst:AddTag(FOODTYPE.SHADOW.."_eater")
	end
end)

AddPrefabPostInit("nightmarefuel", function(inst)
	if not GLOBAL.TheWorld.ismastersim then
		return inst
	end
	inst:AddComponent("edible")
	inst.components.edible.foodtype = FOODTYPE.SHADOW
	inst.components.edible.healthvalue = 5--CHANGE THESE 3 VALUES TO ANYTHING YOU WANT
	inst.components.edible.hungervalue = 10
	inst.components.edible.sanityvalue = 15
end)

and then this in my master_postinit

inst.components.eater:SetDiet({FOODGROUP.SHADOW})

Share this post


Link to post
Share on other sites
MemphisMyst    1

So i tried to get it to work but it happens to error out every time that I try to launch as the character. Would anyone be able to give me assistance with getting the character functional and make him only eat nightmare fuel? Thanks for any pointers that you may be able to assist with.

Share this post


Link to post
Share on other sites
MemphisMyst    1

I already got it figured out; I didn't want to assign the nightmare fuel as a meat which was the issue. I have the character now fully functional and able to only eat nightmare fuel. Nothing else.

Share this post


Link to post
Share on other sites

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
Sign in to follow this