SaahilNZ Posted July 13, 2015 Share Posted July 13, 2015 Hi all,I'm having a bit of trouble with my Don't Starve Together mod. I'm creating a custom item, but whenever I try to pick it up, the game crashes with the following error: LUA ERROR stack traceback: scripts/widgets/image.lua(30,1) in function 'SetTexture' scripts/widgets/image.lua(11,1) in function '_ctor' scripts/class.lua(181,1) in function 'Image' scripts/widgets/itemtile.lua(45,1) in function '_ctor' scripts/class.lua(181,1) in function 'ItemTile' scripts/widgets/inventorybar.lua(979,1) in function 'OnItemGet' scripts/widgets/inventorybar.lua(79,1) in function 'fn' scripts/entityscript.lua(938,1) in function 'PushEvent' scripts/components/inventory.lua(680,1) in function 'GiveItem' scripts/actions.lua(221,1) in function 'fn' scripts/bufferedaction.lua(23,1) in function 'Do' scripts/entityscript.lua(1196,1) in function 'PerformBufferedAction' scripts/stategraphs/SGwilson.lua(2116,1) in function 'fn' scripts/stategraph.lua(562,1) in function 'UpdateState' scripts/stategraph.lua(601,1) in function 'Update' scripts/stategraph.lua(123,1) in function 'Update' scripts/update.lua(205,1) The prefab script for my custom item contains the following code:local assets ={ Asset("ANIM", "anim/beans.zip"), Asset("ATLAS", "images/inventoryimages/beans.xml"), Asset("IMAGE", "images/inventoryimages/beans.tex"),}local function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddNetwork() MakeInventoryPhysics(inst) inst.AnimState:SetBank("beans") inst.AnimState:SetBuild("beans") inst.AnimState:PlayAnimation("idle") inst.entity:SetPristine() if not TheWorld.ismastersim then return inst end inst:AddComponent("stackable") inst.components.stackable.maxsize = TUNING.STACK_SIZE_SMALLITEM inst:AddComponent("inventoryitem") inst.components.inventoryitem.imagename = "Magic Beans" inst.components.inventoryitem.atlasname = "images/inventoryimages/beans.xml" inst:AddComponent("edible") inst.components.edible.degrades_with_spoilage = false inst.components.edible.hungervalue = 10 inst.components.edible.healthvalue = 1000 inst.components.edible.sanityvalue = 1000 MakeHauntableLaunch(inst) return instendreturn Prefab("common/inventory/beans", fn, assets)My modmain.lua file contains the following code:PrefabFiles = { "wbr", "beans",}Assets = { Asset( "IMAGE", "images/saveslot_portraits/wbr.tex" ), Asset( "ATLAS", "images/saveslot_portraits/wbr.xml" ), Asset( "IMAGE", "images/selectscreen_portraits/wbr.tex" ), Asset( "ATLAS", "images/selectscreen_portraits/wbr.xml" ), Asset( "IMAGE", "images/selectscreen_portraits/wbr_silho.tex" ), Asset( "ATLAS", "images/selectscreen_portraits/wbr_silho.xml" ), Asset( "IMAGE", "bigportraits/wbr.tex" ), Asset( "ATLAS", "bigportraits/wbr.xml" ), Asset( "IMAGE", "images/map_icons/wbr.tex" ), Asset( "ATLAS", "images/map_icons/wbr.xml" ), Asset( "IMAGE", "images/avatars/avatar_wbr.tex" ), Asset( "ATLAS", "images/avatars/avatar_wbr.xml" ), Asset( "IMAGE", "images/avatars/avatar_ghost_wbr.tex" ), Asset( "ATLAS", "images/avatars/avatar_ghost_wbr.xml" ), Asset("ATLAS", "images/inventoryimages/beans.xml"), Asset("IMAGE", "images/inventoryimages/beans.tex"),}local require = GLOBAL.requirelocal STRINGS = GLOBAL.STRINGS-- The character select screen linesSTRINGS.CHARACTER_TITLES.wbr = "The Paranoid Brother"STRINGS.CHARACTER_NAMES.wbr = "Wilbur"STRINGS.CHARACTER_DESCRIPTIONS.wbr = "*Stronger and has more health\n*Quick\n*Sanity drains quicker"STRINGS.CHARACTER_QUOTES.wbr = "\"Someone's watching me.\""-- Custom speech stringsSTRINGS.CHARACTERS.WBR = require "speech_wbr"-- The character's name as appears in-game STRINGS.NAMES.WBR = "Wilbur"-- The default responses of examining the characterSTRINGS.CHARACTERS.GENERIC.DESCRIBE.wbr = { GENERIC = "It's Wilbur!", ATTACKER = "Wilbur looks shifty...", MURDERER = "Murderer!", REVIVER = "Wilbur, friend of ghosts.", GHOST = "Wilbur could use a heart.",}-- Custom strings for Magic BeansSTRINGS.NAMES.BEANS = "Magic Beans"STRINGS.CHARACTERS.GENERIC.DESCRIBE.BEANS = "Magic, healthy beans."AddMinimapAtlas("images/map_icons/wbr.xml")-- Add mod character to mod character list. Also specify a gender. Possible genders are MALE, FEMALE, ROBOT, NEUTRAL, and PLURAL.AddModCharacter("wbr", "MALE")NOTE: My mod also contains a custom character, which works (and is on Steam Workshop). From the error that's given, it's probably crashing due to some error with the inventory image, however I don't what specifically is causing the crash. Any help on this error would be greatly appreciated. I have included my log file as well as a .zip folder containing my mod. Thanks in advance,SaahilNZlog.txtwilbur.zip Link to comment https://forums.kleientertainment.com/forums/topic/56120-game-crashing-when-custom-item-is-picked-up/ Share on other sites More sharing options...
SaahilNZ Posted July 15, 2015 Author Share Posted July 15, 2015 Does anyone have any ideas for why this is happening? Link to comment https://forums.kleientertainment.com/forums/topic/56120-game-crashing-when-custom-item-is-picked-up/#findComment-654499 Share on other sites More sharing options...
DarkXero Posted July 15, 2015 Share Posted July 15, 2015 inst.components.inventoryitem.atlasname = "images/inventoryimages/beans.xml" inst.components.inventoryitem.imagename = "beans" Link to comment https://forums.kleientertainment.com/forums/topic/56120-game-crashing-when-custom-item-is-picked-up/#findComment-654586 Share on other sites More sharing options...
SaahilNZ Posted July 16, 2015 Author Share Posted July 16, 2015 Thanks DarkXero!I changed my code to instead use the code you provided and it now works Link to comment https://forums.kleientertainment.com/forums/topic/56120-game-crashing-when-custom-item-is-picked-up/#findComment-654799 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