Jump to content

Recommended Posts

Hey,

 

I'm starting to mod Don't Starve. So for my learning phase, i want to create very simple mods. Despide of that, I'm still able to have bugs :indecisiveness:

 

I created a mod to craft butterfly. It work well, but i discovered that wild butterfly now drop the ingredients of my reciep ! I don't know why and i want to change that, if anyone can help me.

 

And i have another bug for this mod : for now, my butterfly doesn't require any machine to be crafted (
TECH.NONE). I want to use the prestihatitator. So i'm using the fuction TECH.MAGIC_ONE. It work well on DS RoG but crash on DST...

 

I thank you for your help and i appologize for my bad english.

I use this code :

Recipe("butterfly", {Ingredient("twigs", 1),Ingredient("berries", 2),Ingredient("cutgrass",2)}, RECIPETABS.FARM, TECH.NONE)

It work well, without any crash. I haven't any problem with other item recipes. But the fact is that butterfly is killable. So, when I kill a butterfly with my mod, i get 1 twig, 1 berrie and 1 cut grass everytime + the usual loot (butterflywings or butter).

 

I can change the loot table for butterfly on my mod, it work too. Except, i'll get the loot i asked on my mod + the ingredients of my recipe...

 

So, i need a fuction to remove theses loots.
 

STRINGS = GLOBAL.STRINGSRECIPETABS = GLOBAL.RECIPETABSRecipe = GLOBAL.RecipeIngredient = GLOBAL.IngredientTECH = GLOBAL.TECHSTRINGS.RECIPE_DESC.BUTTERFLY = "An unborn flower."Recipe("butterfly", {Ingredient("twigs", 1),Ingredient("berries", 2),Ingredient("cutgrass",2)}, RECIPETABS.FARM, TECH.NONE)

Nothing else on my mod. I deleted the part with the loot table because that  did not solve my problem. It's on the workshop if you want to try : Butterfly Effigy.

Edited by Amonarka

@Amonarka, Okay, looks like lootdropper has the call to the recipe table pretty embedded. However, it looks like it also checks the finiteuses component, so you could try doing this:

AddPrefabPostInit("butterfly", function(inst)    if GLOBAL.TheWorld.ismastersim then        inst:AddComponent("finiteuses")        inst.components.finiteuses:SetPercent(0)    endend)

This might display a percent on the butterfly, though...

 

Another approach you could use would be creating another prefab as a proxy, which upon being given to the player, gets replaced with a butterfly. That would be harder to do, though.

@SenL, Look at the lootdropper component. It checks if there's a recipe for something, and drops a percentage of its ingredients (rounded up) based on the percentage (through finiteuses). I'm guessing it's used by the deconstruction staff.

Edited by rezecib

@rezecib, it can be done easier than making prefab. For example, injecting in component. Actually it's already done.

 

I'm not sure I understand. The problem here is that adding a recipe for butterflies directly causes the ingredients to be added to the butterfly's loot drops. If you're not changing the recipe to craft a non-butterfly prefab that transforms, how else would you get around that? I'm not sure what you mean by "injecting in component".

@Maris, Yes.... In this mod it was done because I suggested doing it (did you read the thread, lol?). But what I was talking about was the fact that now butterflies display "0%". I was saying that to get around that, you probably need a proxy prefab.

Edited by rezecib

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...