Jump to content

Recommended Posts

Hello everyone, I have a problem with altas/tex file when I try to craft my custom item in the game.

 

- I launch the game

- I try to craft my item

- the game crash with the error below

 

I read this thread but not help me to solve my problem

http://forums.kleientertainment.com/topic/51402-guide-modding-practices-introdution-to-atlas-and-tex-files/

http://forums.kleientertainment.com/topic/50005-help-custom-item-not-working/page-2

 

I can send you my project if you can help me

 

post-709818-0-69918800-1444562772_thumb.

log.txt

Textures for items in the inventory are normally taken from inventoryimages.tex, an array of all of the in-inventory textures in the game. You will need to override this when you add new items. After this line:

inst:AddComponent("inventoryitem")

Add these lines:

inst.components.inventoryitem.imagename = "youritem"inst.components.inventoryitem.atlasname = "images/youritem.xml"

You will also need to load the texture files in the prefab's assets, like this:

Assets = {    Asset("ANIM", "anim/youritem.zip"), --This is the animation for your item while it is on the ground    Asset("ATLAS", "images/youritem.xml"),    Asset("IMAGE", "images/youritem.tex")}

The Assets table must be included as the third parameter to the Prefab function. 

Nice ! It work thank you so much !

A last question, you know I try to add a new wall type in the game, when the player craft it he need 6 marbles fragments and he get only one wall, how set this number to 6 ?

 

My code line for add the craft :

 

AddRecipe("wall_pomarble_item", {Ingredient("marble", 6)}, RECIPETABS.TOWN, TECH.SCIENCE_TWO, nil, nil, nil, nil, nil, "images/inventoryimages/wall_pomarble_item.xml", "wall_pomarble_item.tex")

Check out recipe.lua, it defines the Recipe class:

Recipe = Class(function(self, name, ingredients, tab, level, placer, min_spacing, nounlock, numtogive, builder_tag, atlas, image)

Ignore self, it is added to the beginning of the arguments automatically.

  • name - This specifies the prefab produced.
  • ingredients - This is a list of Ingredient class instances, specifying the ingredients used in the recipe.
  • tab - This specifies the tab where the recipe is found.
  • level - This specifies the level of tech the recipe is, which determines what machine you need to make it.
  • placer - This specifies the prefab used for placing a structure, leave nil for normal recipes.
  • min_spacing - I'm not quite sure what this does, but obviously something to do with spacing.
  • nounlock - Set this to true to make the recipe not unlock when you craft it, forcing the player to be next to an appropriate machine to craft.
  • numtogive - This is the one you were looking for, it sets the number of items created by the recipe.
  • builder_tag - This specifies a special tag that the player crafting the recipe must have. This is used for character specific crafting, like Wickerbottom's books, or Wigfreid's weapons.
  • atlas - Specifies the atlas file used for the recipe's icon.
  • image - Specifies the texture file used for the recipe's icon.

I should mention, you should really be posting these questions in the forum for Don't Starve Together, as that is what you are modding. This forum is for the singleplayer version, Don't Starve.

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