AtackTR Posted June 11, 2017 Share Posted June 11, 2017 I want the create a edible item. When you eat, get health and hunger point but i want this item to drop when some of the items are exhausted and some buildings are demolished. Link to comment Share on other sites More sharing options...
Lumina Posted June 11, 2017 Share Posted June 11, 2017 So for example, if someone destroy a science machine, you want the item to be added to the loot ? Link to comment Share on other sites More sharing options...
AtackTR Posted June 11, 2017 Author Share Posted June 11, 2017 (edited) Yes or you can pick it up on ground but i want this for exhausted items too. Edited June 11, 2017 by AtackTR Link to comment Share on other sites More sharing options...
Lumina Posted June 12, 2017 Share Posted June 12, 2017 Ok. I don't know what exhausted items is. So the first step would be to create your edible item. I suggest you to take example on mod like "waiter 101" ( https://steamcommunity.com/sharedfiles/filedetails/?id=381565292 ) This way you have a template to follow (modded items are a little different to game item, so it will be easier). When your item is done, you probably have to use addprefabpostinit to add the item to the drop list of the structure you want. Take a look here for some example, you'll see a prefabpostinit function here. Link to comment Share on other sites More sharing options...
mikey99222 Posted June 12, 2017 Share Posted June 12, 2017 Hey. local function OnEat(inst, food) if food.prefab == "redgem" or food.prefab == "bluegem" then inst.components.hunger:DoDelta(100) inst.components.health:DoDelta(50) end end Will give you 100 hunger and 50 sanity for eating a redgem or a bluegem. Just edit it as you will Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now