Jump to content

How to get rid of extra loot?


Recommended Posts

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

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

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

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

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 by Serpens
Link to comment
Share on other sites

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

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

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

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 by PixelSpider
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...