Jump to content

Recommended Posts

I want to do like this: after eating my custom food(for example "cake") i want to get in the inventory some items(for example cutgrass). I tryed to add component lootable, workable, but still dont know how to make this. Any ideas?

Edited by Artemmm91
inst.components.edible:SetOnEatenFn(function(inst, eater)
	if eater and eater.components.inventory then
		eater.components.inventory:GiveItem(SpawnPrefab("cutgrass"))
	end
end)

this would go in your customprefab.lua

If you wanted this to work only for a specific character then it would require to be a little different

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