IcyTheWhite Posted August 12, 2015 Author Share Posted August 12, 2015 This should fix it:if inst.guanodropped == true then inst.guanodropped = nilelse if math.random() < 0.5 then inst.components.lootdropper:SpawnLootPrefab("bird_egg") inst.guanodropped = nil endendNow the question is how to get rid of the 2nd egg that has a spawn chance on fruits, vegetables and seeds too?(Get rid of it on "seeds" only, since they're overlapping.) Link to comment Share on other sites More sharing options...
DarkXero Posted August 12, 2015 Share Posted August 12, 2015 Now the question is how to get rid of the 2nd egg that has a spawn chance on fruits, vegetables and seeds too? The old birdcage behaviour only spawns eggs for meat.So now you should be good to go. Link to comment Share on other sites More sharing options...
IcyTheWhite Posted August 13, 2015 Author Share Posted August 13, 2015 (edited) DarkXero, I don't know if I'm writing these comments clear enough, but probably not. English isn't my main language and sometimes I'm struggling to express what I have in mind. No, I'm not yet good to go, since I want eggs drop with 33% chance for everything. Seeds (not the specific ones), fruits and veggies.Although by adding the upper function, which gives 50% chance to drop an egg IF guano doesn't drop, there's also the second 33% chance to drop an egg whether or not the guano has dropped. How to get rid of this 33% chance for "seeds" only, while keeping this chance for fruits or vegetables?An additional condition has to be put in this function: if math.random() < 0.33 then inst.components.lootdropper:SpawnLootPrefab("bird_egg") endwhere it won't spawn an egg if the used food to feed the bird was "seeds". Edit:Would this work? (You've shown me this code in previous functions): local foodtype = food.components.edible.foodtype if foodtype == GLOBAL.FOODTYPE.FRUIT or foodtype == GLOBAL.FOODTYPE.VEGGIE then if math.random() < 0.33 then inst.components.lootdropper:SpawnLootPrefab("bird_egg") end end Edited August 13, 2015 by IcyTheWhite Link to comment Share on other sites More sharing options...
IcyTheWhite Posted August 13, 2015 Author Share Posted August 13, 2015 @DarkXero, I know I've been quite complicated and maybe annoying too for the past few days, but in all honesty you've helped me a lot, not only with the code, but you've also with understanding of how things work a little more. There's just so much useful information in this topic that I can come back anytime and use it in something I would be working on. So that said, I'm crediting you in my mod as a very, very helpful person. Thanks a lot and have a nice day! Link to comment Share on other sites More sharing options...
DarkXero Posted August 13, 2015 Share Posted August 13, 2015 @IcyTheWhite: local function ExtraDigest(inst, food) local foodtype = food.components.edible.foodtype -- If the bird was given a fruit/veggie -- 1-2 special seeds will spawn if foodtype == GLOBAL.FOODTYPE.FRUIT or foodtype == GLOBAL.FOODTYPE.VEGGIE then -- We add an extra seed so we end up dropping 2-3 seeds local seed_name = string.lower(food.prefab .. "_seeds") if GLOBAL.Prefabs[seed_name] then inst.components.lootdropper:SpawnLootPrefab(seed_name) end -- Then, since se don't have either guano, egg, or normal seeds from the old behaviour -- (Before, egg would spawn for meat, and guano from special/normal seeds) -- 1/3 chance for egg if math.random() < 0.33 then inst.components.lootdropper:SpawnLootPrefab("bird_egg") else -- 1/3 chance for normal seeds if math.random() < 0.33 then inst.components.lootdropper:SpawnLootPrefab("seeds") else -- Neither egg or normal seeds dropped, we toss a guano for the other 1/3 inst.components.lootdropper:SpawnLootPrefab("guano") end end else -- Here we were given special/normal seeds -- 1/3 chance the old behaviour dropped a guano if inst.guanodropped == true then -- We do nothing, guano was dropped inst.guanodropped = nil else -- No guano -- We try again, add some extra chance to near 1/2 if math.random() < 0.17 then inst.components.lootdropper:SpawnLootPrefab("guano") else -- No guano for 1/2, so we toss some seeds for the other 1/2 inst.components.lootdropper:SpawnLootPrefab("seeds") end end end end Link to comment Share on other sites More sharing options...
IcyTheWhite Posted August 13, 2015 Author Share Posted August 13, 2015 Haha alright man, thanks! You've helped enough. It's all working as intended now for DST and DS single player as well.I'll be uploading it tonight. 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