SenL Posted February 9, 2015 Share Posted February 9, 2015 (edited) I'm trying to make a craftable edible item. It appears in inventory (starting_inv) and on ground when dropped. However, it crashes in food" recipe tab (scrolling down).I've done this (making custom item, but inedible) before but I can't figure out why this one crashed. Log:[00:23:33]: WARNING! Could not find region 'OUTOFSPACE' from atlas 'images/inventoryimages.xml'. Is the region specified in the atlas?[00:23:33]: Looking for default texture '(null)' from atlas 'images/inventoryimages.xml'.[00:23:33]: images/inventoryimages.xmlLUA ERROR stack traceback: scripts/widgets/image.lua(30,1) in function 'SetTexture' My modmain:local recipes = { Recipe("ggwooddeluxe" ,{Ingredient("twigs", 6),Ingredient("logs", 3),Ingredient("boards",1),} ,RECIPETABS.FARM --Food ,{SCIENCE=1}),} for k,v in pairs(recipes) do v.tagneeded = true v.atlas = "images/inventoryimages/" .. v.name .. ".xml"end The ggwooddeluxe.lua:local assets={Asset("ANIM", "anim/ggwooddeluxe.zip"), Asset("IMAGE", "images/inventoryimages/ggwooddeluxe.tex"), Asset("ATLAS", "images/inventoryimages/ggwooddeluxe.xml")} local function OnDropped(inst) inst.Light:Enable(true)end local function OnPickup(inst) inst.Light:Enable(false)end local function fn()local inst = CreateEntity() inst.entity:AddTransform()inst.entity:AddAnimState()inst.entity:AddLight()inst.entity:AddNetwork() MakeInventoryPhysics(inst) inst.AnimState:SetBank("ggwooddeluxe")inst.AnimState:SetBuild("ggwooddeluxe")inst.AnimState:PlayAnimation("idle") inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh") local light = inst.entity:AddLight() light:SetFalloff(0.7) light:SetIntensity(.5) light:SetRadius(1.0) light:SetColour(237/255, 237/255, 209/255) light:Enable(true) if not TheWorld.ismastersim then return inst end inst.entity:SetPristine() local minimap = inst.entity:AddMiniMapEntity() minimap:SetIcon("ggwooddeluxe.tex") inst:AddComponent("inspectable") inst:AddComponent("inventoryitem")inst.components.inventoryitem.imagename = "ggwooddeluxe"inst.components.inventoryitem.atlasname = "images/inventoryimages/ggwooddeluxe.xml" inst:AddComponent("stackable")inst.components.stackable.maxsize = TUNING.STACK_SIZE_SMALLITEM inst.components.inventoryitem:SetOnDroppedFn(OnDropped) inst.components.inventoryitem:SetOnPickupFn(OnPickup) inst:AddComponent("edible")inst.components.edible.foodtype = FOODTYPE.MYCHARFOODinst:AddTag("edible_"..FOODTYPE.MYCHARFOOD)inst.components.edible.healthvalue = 16 inst.components.edible.hungervalue = 68 inst.components.edible.sanityvalue = 0 MakeHauntableLaunchAndDropFirstItem(inst) inst:AddComponent("characterspecific")inst.components.characterspecific:SetOwner("MyChar") return instend return Prefab( "common/inventory/ggwooddeluxe", fn, assets) Thanks! Edit:I deleted all zip files from anim\ but the zip files are not re-created.What gives?Answer: http://forums.kleientertainment.com/topic/50035-anim-folderauto-compiler-problem/?p=611302 Now let me try that recipe tab again... Edit:Still crashes. Darn. Edited February 9, 2015 by SenL Link to comment https://forums.kleientertainment.com/forums/topic/50756-crash-on-custom-mod-with-recipe/ Share on other sites More sharing options...
Noggle Posted February 9, 2015 Share Posted February 9, 2015 Shouldn't it be like this for the recipe? This is how the format is handled for in the base game files. Note the tech tree difference between your post and mine. Base game types out the numbers rather than using the actual number for some reason in recipes.lua, it looks like.local recipes = { Recipe("ggwooddeluxe", {Ingredient("twigs", 6), Ingredient("logs", 3), Ingredient("boards",1),}, RECIPETABS.FARM, TECH.SCIENCE_ONE),} Link to comment https://forums.kleientertainment.com/forums/topic/50756-crash-on-custom-mod-with-recipe/#findComment-611315 Share on other sites More sharing options...
rezecib Posted February 9, 2015 Share Posted February 9, 2015 "logs" This is the problem. Link to comment https://forums.kleientertainment.com/forums/topic/50756-crash-on-custom-mod-with-recipe/#findComment-611319 Share on other sites More sharing options...
SenL Posted February 9, 2015 Author Share Posted February 9, 2015 (edited) "Logs".Oh my... gawd. Thanks rezecib. Edit:Fixed. Wish the log.txt would say that the "logs" (or ingredient) was causing the issue . Edited February 9, 2015 by SenL Link to comment https://forums.kleientertainment.com/forums/topic/50756-crash-on-custom-mod-with-recipe/#findComment-611374 Share on other sites More sharing options...
SenL Posted February 9, 2015 Author Share Posted February 9, 2015 Crashes when I change stackable maxsize to 2. 10 is ok. Why?Error is something about arithmetic with ? nil or something... inst:AddComponent("stackable")inst.components.stackable.maxsize = 10 --TUNING.STACK_SIZE_LARGEITEM Link to comment https://forums.kleientertainment.com/forums/topic/50756-crash-on-custom-mod-with-recipe/#findComment-611378 Share on other sites More sharing options...
SenL Posted February 10, 2015 Author Share Posted February 10, 2015 Another issue.Host (mychar) can create ggwooddeluxe with no problem. However, client (mychar) can't. He would be doing "crafting animation" for 2 seconds and then nothing. No ingredients consumed, no ggwooddeluxe resulted.Relogged twice = no fix. Shut down server and try again = no fix.Any ideas? Thanks. Link to comment https://forums.kleientertainment.com/forums/topic/50756-crash-on-custom-mod-with-recipe/#findComment-611591 Share on other sites More sharing options...
rezecib Posted February 10, 2015 Share Posted February 10, 2015 @SenL, Sounds like a multiple-recipe-mods-load-order issue. Are you using other mods while testing this? There's a major compatibility bug still in the game's mod support for recipes. Link to comment https://forums.kleientertainment.com/forums/topic/50756-crash-on-custom-mod-with-recipe/#findComment-611603 Share on other sites More sharing options...
SenL Posted February 10, 2015 Author Share Posted February 10, 2015 (edited) Yes I have multiple mods when testing... I'll try to have only one mod enabled while testing.I hope i don't have to unsubscribe all, lol. Thanks. Edit:Works! Dang... Edited February 10, 2015 by SenL Link to comment https://forums.kleientertainment.com/forums/topic/50756-crash-on-custom-mod-with-recipe/#findComment-611605 Share on other sites More sharing options...
SenL Posted February 10, 2015 Author Share Posted February 10, 2015 Previous issue is that it crashes when I change max size to 2or toTUNING.STACK_SIZE_LARGEITEM-8 --2 Log:[00:03:31]: [string "scripts/components/stackable_replica.lua"]:21: attempt to perform arithmetic on field '?' (a nil value)LUA ERROR stack traceback:scripts/components/stackable_replica.lua:21 in (method) SetMaxSize (Lua) <20-22> Odd... Link to comment https://forums.kleientertainment.com/forums/topic/50756-crash-on-custom-mod-with-recipe/#findComment-611612 Share on other sites More sharing options...
SenL Posted February 12, 2015 Author Share Posted February 12, 2015 Any idea how to have custom stack size? Maybe add to TUNING (not editing tuning.lua)? Why would this crash? inst:AddComponent("stackable") inst.components.stackable.maxsize = 2 Link to comment https://forums.kleientertainment.com/forums/topic/50756-crash-on-custom-mod-with-recipe/#findComment-612403 Share on other sites More sharing options...
rezecib Posted February 12, 2015 Share Posted February 12, 2015 @SenL, Your log had all the information you needed to see why it was going wrong... First, look at stackable_replica. It should be pretty clear why it's crashing if you just take a few minutes to read the line that's causing the error and look at the things it calls. It's a really short file. It takes the stack sizes defined in the game (smallitem, meditem, largeitem), and assigns them indexes (0, 1, 2), and only transmits the index to clients to reduce the amount of data transferred. Unfortunately this is all in a local table... So I think your only option for a custom stacksize is to replace stackable_replica. Link to comment https://forums.kleientertainment.com/forums/topic/50756-crash-on-custom-mod-with-recipe/#findComment-612441 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now