Search the Community
Showing results for tags 'spawning'.
I'm trying to modify the code for the corn prefab, so that instead of only getting one popcorn for cooking it, you get three. I've cobbled together some code but it doesn't seem to be working. I'm having trouble working out the trigger for the item spawn so that it only goes off when it's added to the inventory from cooking and not any other reason. This is the code I have local function popcorn(prefab) if self.oncooked ~= nil then self.oncooked(self.inst, cooker, chef) end if self.product ~= nil then local poppedcorn = SpawnPrefab("corn_cooked") popcorn.components.stackable.stacksize = 2 if poppedcorn ~= nil then if owner.components.inventory and not owner.components.inventory:IsFull() then owner.components.inventory:GiveItem(poppedcorncorn) elseif owner.components.container and not owner.components.container:IsFull() then owner.components.container:GiveItem(poppedcorncorn) else inst.components.lootdropper:DropLootPrefab(poppedcorncorn) end return poppedcorn end end end AddPrefabPostInit("corn", popcorn) It's cobbled together from the coconut code from Shipwrecked and the cooking code from the cookable component. Am I just not calling things right? Any help is appreciated.
Bees seem to be pretty rare when you first start the game. In my latest game I only had 2 hives in the whole world. I hadn't run across the killer bees yet, so not knowing they were different than the regular bees (even though they were red) i collected 4 of them and then broke the hive. Upon realizing that i couldn't use the 4 bees I collected to craft a hive i went exploring with for another hive. When I found another hive (i had picked up some pig bros) no bees were flying around so i ran up and punched the hive. About 8 killer bees and then 1 yellow bee came out and while I was running around dealing with the bees the pigs killed the hive. That was unfortunately the last hive in my world. So now I am at day 36 and have no hives and only one yellow bee. So here's my suggestion... -Suggestion 1 -You should either be able to tame killer bees (maybe with a special hive that doesn't require bees to craft) or just be able to craft a killer bee hive. I think the killer bee hive would work the best, even though it will be a little tougher to get the honey since the killer bees do extra damage. -Suggestion 2 -Another option would be to have bees very rarely spawn from flowers. -Suggestion 3- One more possibility would be if you collect and planted enough flowers in an area then a bee hive would eventually spawn if no other were on the map. The main reason for the suggestion is now i feel i have to start my world over since i wont have access to honey, all the foods you can craft from honey and sleeping darts. But if either of the suggestions above were implemented it would not be a world killer if you mess up your bees in the early game.