HomShaBom Posted June 11, 2016 Share Posted June 11, 2016 (edited) I'm trying to turn frogs into inventory items. In my mod folder I have images/inventoryimages and I have placed a 64x64 png of a frog in it. I start up the DST and it builds the .tex and .xml files for me. I've checked the names of everything, it all matches up perfectly. in my modmain.lua local assets = { Asset("IMAGE", "images/inventoryimages/frog.tex"), Asset("ATLAS", "images/inventoryimages/frog.xml"), } AddPrefabPostInit("frog", function(inst) inst:AddComponent("inventoryitem") inst.components.inventoryitem.atlasname = "images/inventoryimages/frog.xml" inst.components.inventoryitem.nobounce = true inst.components.inventoryitem.canbepickedup = false inst.components.inventoryitem.canbepickedupalive = true end) when I type into the console c_give("frog") it doesn't look like anything happened, but i know i have a frog in my inventory because i can right click on the 1st slot and i get a frogleg, or i can left click it and then i can drop it somewhere and it becomes a regular frog. For some reason it's invisible and I don't know why. Another weird issue... I can right click on the frog in my inventory to murder it and I get frog legs. That's great, that's exactly what I wanted to happen, but it does not give the right mouse button to murder prompt like you get when you mouse over a bee, rabbit, bird, moleworm, butterfly, or mosquito in your inventory. Edited June 12, 2016 by HomShaBom Link to comment https://forums.kleientertainment.com/forums/topic/68106-inventory-image-is-not-working/ Share on other sites More sharing options...
MF99K Posted June 12, 2016 Share Posted June 12, 2016 8 hours ago, HomShaBom said: I'm trying to turn frogs into inventory items. In my mod folder I have images/inventoryimages and I have placed a 64x64 png of a frog in it. I start up the DST and it builds the .tex and .xml files for me. I've checked the names of everything, it all matches up perfectly. in my modmain.lua local assets = { Asset("IMAGE", "images/inventoryimages/frog.tex"), Asset("ATLAS", "images/inventoryimages/frog.xml"), } AddPrefabPostInit("frog", function(inst) inst:AddComponent("inventoryitem") inst.components.inventoryitem.atlasname = "images/inventoryimages/frog.xml" inst.components.inventoryitem.nobounce = true inst.components.inventoryitem.canbepickedup = false inst.components.inventoryitem.canbepickedupalive = true end) when I type into the console c_give("frog") it doesn't look like anything happened, but i know i have a frog in my inventory because i can right click on the 1st slot and i get a frogleg, or i can left click it and then i can drop it somewhere and it becomes a regular frog. For some reason it's invisible and I don't know why. Another weird issue... I can right click on the frog in my inventory to murder it and I get frog legs. That's great, that's exactly what I wanted to happen, but it does not give the right mouse button to murder prompt like you get when you mouse over a bee, rabbit, bird, moleworm, butterfly, or mosquito in your inventory. do you have TEXcreator? sometimes the files have issues and need to be compiled manually Link to comment https://forums.kleientertainment.com/forums/topic/68106-inventory-image-is-not-working/#findComment-782815 Share on other sites More sharing options...
HomShaBom Posted June 12, 2016 Author Share Posted June 12, 2016 (edited) 18 minutes ago, mf99k said: do you have TEXcreator? sometimes the files have issues and need to be compiled manually I do have TEXcreator, I tried converting the .png file into .tex using it, but it still doesn't show in game. The file seems to be fine because when I open it with TEXtool it looks fine, I can convert it back to png and everything... My guess is that when you make a new prefab you pass the assets as a parameter to the Prefab constructor.. From data/scripts/prefabs/frog.lua (assets are created and passed into Prefab constructor) local assets = { Asset("ANIM", "anim/frog.zip"), Asset("SOUND", "sound/frog.fsb"), } ... return Prefab("frog", fn, assets, prefabs) In my mod script I'm creating assets with the inventory images, but since I'm modifying a prefab that has already been created there's no way for me to pass the assets into the constructor and I'm not sure how else to get the assets into it. But that may not even be the issue, I am not sure. Edited June 12, 2016 by HomShaBom Link to comment https://forums.kleientertainment.com/forums/topic/68106-inventory-image-is-not-working/#findComment-782819 Share on other sites More sharing options...
Aquaterion Posted June 12, 2016 Share Posted June 12, 2016 Maybe you gotta do inst.components.inventoryitem.imagename = "frog" also in modmain.lua its not local assets = {} -- it should: Assets = {} Link to comment https://forums.kleientertainment.com/forums/topic/68106-inventory-image-is-not-working/#findComment-782853 Share on other sites More sharing options...
HomShaBom Posted June 12, 2016 Author Share Posted June 12, 2016 Yeah, I forgot to update the code in the 1st post. I am setting the imagename to "frog" and its still not showing. Just tried Assets = { } instead of local assets = { }... it worked! thank you Link to comment https://forums.kleientertainment.com/forums/topic/68106-inventory-image-is-not-working/#findComment-782865 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