Jump to content

Recommended Posts

i was tryng to make a recipe for my custom character in "modmain.lua" that cost healt

it looks like this:

Recipe("synch", { Ingredient("twigs", 2), Ingredient("flint", 2), Ingredient(CHARACTER_INGREDIENT.HEALTH, 10)}, RECIPETABS.WAR, TECH.NONE, nil, nil, nil, nil, "images/inventoryimages/synch.xml", "synch.tex")

but everytime i start the game it crashes

 

someone can help me plz?

Edited by Vecto0r

Did the log say anything helpful?

Assuming all needed GLOBAL references are made local, try

AddRecipe("synch", { Ingredient("twigs", 2), Ingredient("flint", 2), Ingredient(CHARACTER_INGREDIENT.HEALTH, 10)}, RECIPETABS.WAR, TECH.NONE, nil, nil, nil, nil, nil, "images/inventoryimages/synch.xml", "synch.tex")

(one extra nil parameter for builder_tag.

Edited by Muche
4 hours ago, Muche said:

Did the log say anything helpful?

Assuming all needed GLOBAL references are made local, try


AddRecipe("synch", { Ingredient("twigs", 2), Ingredient("flint", 2), Ingredient(CHARACTER_INGREDIENT.HEALTH, 10)}, RECIPETABS.WAR, TECH.NONE, nil, nil, nil, nil, nil, "images/inventoryimages/synch.xml", "synch.tex")

(one extra nil parameter for builder_tag.

my GLOBAL references is


local require = GLOBAL.require
local STRINGS = GLOBAL.STRINGS

GLOBAL.STRINGS.CHARACTER_TITLES.victor_dracul = "The Vampire"
GLOBAL.STRINGS.CHARACTER_NAMES.victor_dracul = "Victor Dracul"
GLOBAL.STRINGS.CHARACTER_DESCRIPTIONS.victor_dracul = "* An Evil Vampire, Which Love Fruits."
GLOBAL.STRINGS.CHARACTER_QUOTES.victor_dracul = "\"The Master of Vampires.\""
GLOBAL.STRINGS.CHARACTERS.VICTOR_DRACUL = {}
GLOBAL.STRINGS.CHARACTERS.VICTOR_DRACUL.DESCRIBE = {}

------------------------------------
-------------ITEMS------------------


local Ingredient = GLOBAL.Ingredient
local RECIPETABS = GLOBAL.RECIPETABS
local STRINGS = GLOBAL.STRINGS
local TECH = GLOBAL.TECH

i get same error look

Untitled.jpg

6 minutes ago, Aquaterion said:

I didnt say that, it should work for ds as well.

local Ingredient = GLOBAL.Ingredient
local RECIPETABS = GLOBAL.RECIPETABS
local STRINGS = GLOBAL.STRINGS
local TECH = GLOBAL.TECH
local character_ingredient = GLOBAL.CHARACTER_INGREDIENT


STRINGS.NAMES.SYNCH = "Synch"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.SYNCH = "He Loves Blood Taste."
STRINGS.RECIPE_DESC.SYNCH = "The Thirst Blade."

--Recipe("synch", { Ingredient("twigs", 2), Ingredient("flint", 2)}, RECIPETABS.WAR, TECH.NONE, nil, nil, nil, nil, "images/inventoryimages/synch.xml", "synch.tex")
Recipe("synch", { Ingredient("twigs", 2), Ingredient("flint", 2), Ingredient(character_ingredient.HEALTH, 10)}, RECIPETABS.WAR, TECH.NONE, nil, nil, nil, nil, nil, "images/inventoryimages/synch.xml", "synch.tex")
------------------------------------

my code is like this now but dont worked, i get same error

1 minute ago, Vecto0r said:

local Ingredient = GLOBAL.Ingredient
local RECIPETABS = GLOBAL.RECIPETABS
local STRINGS = GLOBAL.STRINGS
local TECH = GLOBAL.TECH
local character_ingredient = GLOBAL.CHARACTER_INGREDIENT


STRINGS.NAMES.SYNCH = "Synch"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.SYNCH = "He Loves Blood Taste."
STRINGS.RECIPE_DESC.SYNCH = "The Thirst Blade."

--Recipe("synch", { Ingredient("twigs", 2), Ingredient("flint", 2)}, RECIPETABS.WAR, TECH.NONE, nil, nil, nil, nil, "images/inventoryimages/synch.xml", "synch.tex")
Recipe("synch", { Ingredient("twigs", 2), Ingredient("flint", 2), Ingredient(character_ingredient.HEALTH, 10)}, RECIPETABS.WAR, TECH.NONE, nil, nil, nil, nil, nil, "images/inventoryimages/synch.xml", "synch.tex")
------------------------------------

my code is like this now but dont worked, i get same error

Hmm I don't think dont starve singleplayer has any stat ingredients.

13 minutes ago, Aquaterion said:

Hmm I don't think dont starve singleplayer has any stat ingredients.

OK i will change my ingredients , btw thanks.

if you can help in one more thing

in my recipes tab the item ingredient dont show correct.

looks like a bee mine why??? 

Untitled2.jpg

in ur items prefab file, such as synch.lua for example, find something like AddComponent("Inventoryitem") and below it put

inst.components.inventoryitem.atlasname = "images/inventoryimages/synch.xml"
inst.components.inventoryitem.imagename = "synch"

 

52 minutes ago, Aquaterion said:

in ur items prefab file, such as synch.lua for example, find something like AddComponent("Inventoryitem") and below it put


inst.components.inventoryitem.atlasname = "images/inventoryimages/synch.xml"
inst.components.inventoryitem.imagename = "synch"

 

my prefab file have this, but only display the correct image on inventory. in the recipe tab is showing bee mine icon  XML problem maybe ?

 

1 hour ago, Muche said:

Try


local synchRecipe = Recipe("synch", { Ingredient("twigs", 2), Ingredient("flint", 2)}, RECIPETABS.WAR, TECH.NONE, nil, nil, nil, nil)
synchRecipe.atlas = "images/inventoryimages/synch.xml"
synchRecipe.image = "synch.tex"

 

ty Muche works like a charm *-*

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