Jump to content

Recommended Posts

I'm making a character mod and i want it to be able to consume rocks and flint it picks up.
I know there's a Topic like this already but I'm very new to lua and modding DST altogether, so, if anyone would be so kind
as to help and explain bit by bit how this can be done, it'll be much appreciated... :3

Link to comment
https://forums.kleientertainment.com/forums/topic/133237-help-with-eating-rocks/
Share on other sites

It's actually quite simple! Put this code below the "master_postinit" function in your character's file:

if inst.components.eater ~= nil then
	table.insert(inst.components.eater.preferseating, FOODTYPE.ELEMENTAL) -- FOODTYPE.ELEMENTAL are pretty much all rocks in the game, including gems.
	table.insert(inst.components.eater.caneat, FOODTYPE.ELEMENTAL)
	inst:AddTag(FOODTYPE.ELEMENTAL.."_eater") -- Add a tag in case you want to check if a character can eat rocks.
end

I'm not sure if this is the best way of doing this, but I did what the "eater" component did for WX-78 eating gears.

Edited by HarryPPP
  • Health 1
On 9/3/2021 at 10:30 PM, HarryPPP said:

It's actually quite simple! Put this code below the "master_postinit" function in your character's file:


if inst.components.eater ~= nil then
	table.insert(inst.components.eater.preferseating, FOODTYPE.ELEMENTAL) -- FOODTYPE.ELEMENTAL are pretty much all rocks in the game, including gems.
	table.insert(inst.components.eater.caneat, FOODTYPE.ELEMENTAL)
	inst:AddTag(FOODTYPE.ELEMENTAL.."_eater") -- Add a tag in case you want to check if a character can eat rocks.
end

I'm not sure if this is the best way of doing this, but I did what the "eater" component did for WX-78 eating gears.

THANKS SO SO MUCH, it worked instantly and helped me so much.
I also used another topic to change each prefabs' bonuses and this is shaping up to be great, thank you so much!

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