Jump to content

Recommended Posts

Finding the cause is really a headache for me, even if it's not harmful (maybe)
The character I created caused the world to drop "2 butterfly wings" when someone killed a butterfly. Whether my custom character was used or not. 

But I removed the code that caused the "double loot".
Why did it happen?

A little contradictory.
My goal is to make the "double loot" controllable.
And know where the code is.

 

Previously used codes

Quote

 

  • local function onkilled(inst, data) 
  •          local victim = data.victim
  •          if victim~= nil and victim:HasTag("monster") then
  •              data.victim.components.lootdropper:DropLoot()
  •         end
  •     end

 

 

under   master_postinit

Quote

inst:ListenForEvent("killed", onkilled)

 

I'm not sure if it's related because I deleted it.

 

 

Sorry for my weird language.

testpantacle.rar

In your main/lootdrop_api.lua, the LootDropper:GenerateLoot() method of the lootdropper component has been modified, which causes any character to receive double the loot. You can enter c_announce(TUNING.TESTPANTACLE_EXTRADROP) in the console to confirm that the modification to these components is still in effect.

  • Like 1
3 hours ago, yanecc said:

In your main/lootdrop_api.lua, the LootDropper:GenerateLoot() method of the lootdropper component has been modified, which causes any character to receive double the loot. You can enter c_announce(TUNING.TESTPANTACLE_EXTRADROP) in the console to confirm that the modification to these components is still in effect.

Thank you for replying to me.

Ah yes I forgot it too but this is not it. I used the command you told me and it did not find it and later I tried deleting the main folder but it is still the same. 

It seems like this only happens to butterflies.

Edited by pantacle
I've found a problem. 
It's because I made a crafting recipe, addrecipe, addrecipe 2 or GLOBAL.Recipe 
butterfly Therefore, unusual errors like double drops occur.

I found the reason why butterfly droploot 2x, but I don't understand why that is.

It's because I created a recipe for crafting butterflies to come back to life.
```    AddRecipe2("butterfly", 
        {
            GLOBAL.Ingredient("butterflywings", 2),
            GLOBAL.Ingredient(GLOBAL.CHARACTER_INGREDIENT.HEALTH, 25),
        },
        GLOBAL.TECH.NONE,
        { product = "butterfly", builder_tag = "panda", numtogive = 1 },
        { "CHARACTER" }
    )  ```


Edited by pantacle

Any prefab that has a recipe that matches in name to its prefab name will drop half the recipe ingredients as its loot, that's how it works for craftable structures for example. This is likely what's also happening here.

The solution is simple, simply rename your recipe. You already have the product as "butterfly", so the recipe will return a Butterfly just fine even if the name doesn't match.

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
×
  • Create New...