StarvingAngler Posted July 31, 2019 Share Posted July 31, 2019 I am adding recipes for certain objects, and I have come across a problem. When I add a new recipe for a touch stone, or a merm house the game changes the usual loot that drops to match the recipe. I do not want this to happen as it makes the items drop way better loot than they should. I think it has something to do with lootdropper.lua, but I have no idea how to fix this. Can someone please help me? Link to comment Share on other sites More sharing options...
Thomas Die Posted July 31, 2019 Share Posted July 31, 2019 can you give me an example i don't understand because the loot dropper component always has specific data used to identify what should drop (this is from the merm data file) local loot = { "boards", "rocks", <------------------this basically is showing the loot that should drop and is used here "fish", } local function onhammered(inst, worker) if inst.components.burnable ~= nil and inst.components.burnable:IsBurning() then inst.components.burnable:Extinguish() end inst:RemoveComponent("childspawner") inst.components.lootdropper:DropLoot() <------------- (the code here basically makes it drop the indicated loot above) local fx = SpawnPrefab("collapse_big") fx.Transform:SetPosition(inst.Transform:GetWorldPosition()) fx:SetMaterial("wood") inst:Remove() end so i guess you could use this to change the loot which is dropped Link to comment Share on other sites More sharing options...
Serpens Posted August 1, 2019 Share Posted August 1, 2019 The lootdropper component adds when "DropLoot" is called automatically loot from the recipe to it (GetRecipeLoot within GenerateLoot within DropLoot). While you have access to nearly every loot saved within lootdropper... I see no way to acces this recipe loot, without replacing a whole lootdropper function... (at best GetRecipeLoot) So to only overwrite this function for mermhouse I would do: AddPrefabPostInit("mermhouse",function(inst) if inst~=nil and inst.components~=nil and inst.components.lootdropper~=nil then inst.components.lootdropper.GetRecipeLoot = function(self,recipe) return {} -- return an empty list for mermhouses end end end Link to comment Share on other sites More sharing options...
Ultroman Posted August 1, 2019 Share Posted August 1, 2019 Yup, that is all correct, and that works, and is probably the least intrusive way to go about it. Link to comment Share on other sites More sharing options...
Thomas Die Posted August 1, 2019 Share Posted August 1, 2019 13 hours ago, PixelSpider said: When I add a new recipe for a touch stone, or a merm house the game changes the usual loot that drops to match the recipe. but isn't the problem he doesn't want the dropped loot to match the recipe and in your function it specifies that it will match the exact recipe making it not drop half as usual but the same? Link to comment Share on other sites More sharing options...
Serpens Posted August 1, 2019 Share Posted August 1, 2019 (edited) 3 hours ago, thomas4845 said: but isn't the problem he doesn't want the dropped loot to match the recipe and in your function it specifies that it will match the exact recipe making it not drop half as usual but the same? ? he wants no loot from recipe, yes. And if I return an empty list for the recipeloot, it should lead to "no loot for recipe". Where do you see that this would lead to "all loot from recipe, instead of half loot from recipe" ? Edited August 1, 2019 by Serpens Link to comment Share on other sites More sharing options...
StarvingAngler Posted August 13, 2019 Author Share Posted August 13, 2019 On 7/31/2019 at 8:34 PM, Serpens said: The lootdropper component adds when "DropLoot" is called automatically loot from the recipe to it (GetRecipeLoot within GenerateLoot within DropLoot). While you have access to nearly every loot saved within lootdropper... I see no way to acces this recipe loot, without replacing a whole lootdropper function... (at best GetRecipeLoot) So to only overwrite this function for mermhouse I would do: AddPrefabPostInit("mermhouse",function(inst) if inst~=nil and inst.components~=nil and inst.components.lootdropper~=nil then inst.components.lootdropper.GetRecipeLoot = function(self,recipe) return {} -- return an empty list for mermhouses end end end ok but where do i put the code, at the bottom of my modmain, in the mermhouse prefab, or in the lootdropper? Link to comment Share on other sites More sharing options...
Serpens Posted August 13, 2019 Share Posted August 13, 2019 6 hours ago, PixelSpider said: ok but where do i put the code, at the bottom of my modmain, in the mermhouse prefab, or in the lootdropper? modmain, always everything that is not entirly new into modmain, never overwrite complete existing files. Link to comment Share on other sites More sharing options...
StarvingAngler Posted August 13, 2019 Author Share Posted August 13, 2019 I tried the code, but my game keeps crashing. Link to comment Share on other sites More sharing options...
Ultroman Posted August 13, 2019 Share Posted August 13, 2019 If you want us to help, you need to include the server logs and client log. See the newcomer post under the "Debugging" section on how to find these files. Attach the files to a reply here. Also, attach a zip of your mod as it was when you got the crash. Link to comment Share on other sites More sharing options...
StarvingAngler Posted August 31, 2019 Author Share Posted August 31, 2019 Renewable - Copy.zip client_log_2019-08-30-21-06-39.txt i think I did that right Link to comment Share on other sites More sharing options...
Ultroman Posted August 31, 2019 Share Posted August 31, 2019 You're overwriting game files. Both the lootdropper.lua and 4 prefabs. Why? Try removing the entire "scripts" folder from your mod, and then run it. Link to comment Share on other sites More sharing options...
StarvingAngler Posted August 31, 2019 Author Share Posted August 31, 2019 It still crash Renewable.zip client_log.txt Link to comment Share on other sites More sharing options...
Ultroman Posted August 31, 2019 Share Posted August 31, 2019 This is the first problem. The API version for DST is 10, not 1. [00:00:28]: Fontend-Loading mod: Renewable (Renewable World) Version:1.0.0 (Old API! (mod: 1 game: 10) ) Next error that has to do with a mod, is this one: RegisterComponentActions = function - ../mods/workshop-836583293/modmain.lua:53 What happens on line 53 in that mod? And is that your mod? Also, there seems to be some error in your map or something. I haven't seen this before, but maybe it's a benign thing. [00:01:10]: Error deserializing lua state for entity forest_network[100033] var: - Failed to read net var data Link to comment Share on other sites More sharing options...
StarvingAngler Posted August 31, 2019 Author Share Posted August 31, 2019 (edited) I didn't make my own modinfo because i idiot I am going to fix this and make one also the errors have to do with client mods, the mods are not causing it to crash though, the mods just send messages like that in client log. also my mod is not on steam workshop till it complete and it definitly not complete also i should do a more simple mod for my first mod Edited August 31, 2019 by PixelSpider Link to comment Share on other sites More sharing options...
Ultroman Posted August 31, 2019 Share Posted August 31, 2019 4 hours ago, PixelSpider said: also i should do a more simple mod for my first mod Maybe that's a good idea But I'd like to figure out what's wrong with your mod. Can you upload the zip like you have it now? And a log of whatever errors you are getting now? 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