Ezerald Posted January 18, 2022 Share Posted January 18, 2022 (edited) I know this sounds strange but, i added a recipe, for my character only, that gives me the possibility to craft butterflies; The problem here is that when i kill butterflies now they drop the item's recipe; The recipe require 3 nightmare fuel and 1 petal to craft a butterfly, but when i kill one it drops 2 nightmare fuel, 1 petal and 1 butterfly wings; so i was wondering, how do i fix butterflies and make them not dropping nightmare fuel nor petals? Here's my code, this is inside modmain: Spoiler local Ingredient = GLOBAL.Ingredient local RECIPETABS = GLOBAL.RECIPETABS Recipe = GLOBAL.Recipe Ingredient = GLOBAL.Ingredient TECH = GLOBAL.TECH local ezerald_recipe = AddRecipe("butterfly", {Ingredient("nightmarefuel", 3),Ingredient("petals", 1)}, RECIPETABS.MAGIC, {MAGIC=0}, nil, nil, nil, nil, "ezerald") Edited January 18, 2022 by Ezerald Link to comment https://forums.kleientertainment.com/forums/topic/136970-custom-recipe-for-crafting-a-mob/ Share on other sites More sharing options...
Leonidas IV Posted January 19, 2022 Share Posted January 19, 2022 The crafts code has this property of dropping half of its materials when hammered/killed. You can check this and remove for the butterfly. Link to comment https://forums.kleientertainment.com/forums/topic/136970-custom-recipe-for-crafting-a-mob/#findComment-1533583 Share on other sites More sharing options...
Monti18 Posted January 19, 2022 Share Posted January 19, 2022 The lootdropper component checs for the recipe and gives the loot accordingly. You could hook the GetRecipe function to stop if it gets the butterfly recipe, but this is not the optimal way. Spoiler function LootDropper:GenerateLoot() -------------- local recipe = AllRecipes[self.inst.prefab] if recipe then local recipeloot = self:GetRecipeLoot(recipe) for k,v in ipairs(recipeloot) do table.insert(loots, v) end end I think there are a lot of different spawners in the game that remove themselves as soon as they spawn something after are built. So you could make another prefab which gives the butterfly to the character that built it and then removes itself. This way, there is no recipe directly for the butterfly and the drops remain the same. 2 Link to comment https://forums.kleientertainment.com/forums/topic/136970-custom-recipe-for-crafting-a-mob/#findComment-1533645 Share on other sites More sharing options...
JadeKnightblazer Posted May 20, 2022 Share Posted May 20, 2022 (edited) How does one "You could hook the GetRecipe function", the ways I have tried it all crash the game. via inst.components.lootdropper:GetFullRecipeLoot(onmurderfn), ect. local function onmurderfn() local recipe = {} return recipe end Edited May 20, 2022 by JadeKnightblazer Link to comment https://forums.kleientertainment.com/forums/topic/136970-custom-recipe-for-crafting-a-mob/#findComment-1571893 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