Well-met Posted June 12, 2019 Share Posted June 12, 2019 Hi I made my own custom item. Everything's set up in modmain, asset load and its prefab. However I can't for the life of me get the image to compile. I can spawn the item but the icon is just invisible. I have at my disposal - DS Mod Tools Autocompiler - TEXTool to convert into .tex - Krane in case of decompile needed - mods/Exported folder My image is a simple recolor of the grass i need some step by step help because this is far more difficult than it should be, please thanks Link to comment Share on other sites More sharing options...
Joy Machs Posted June 13, 2019 Share Posted June 13, 2019 Can you provide more info about it? Like you "item.lua" in prefabs folder, your modmain.lua and your client_log.txt. What happens when you spawn the item? It appears in inventory, but not in the world? or don't appear in both? Do you put your custom files in "images>inventoryimages" and "anim" folders? I'm making my mod who has a custom item this days and I went through lots of issues about not showing the image of the sprite in the game. Tell us more and maybe we can help. Link to comment Share on other sites More sharing options...
Well-met Posted June 13, 2019 Author Share Posted June 13, 2019 (edited) 6 hours ago, Joy Machs said: Can you provide more info about it? Like you "item.lua" in prefabs folder, your modmain.lua and your client_log.txt. What happens when you spawn the item? It appears in inventory, but not in the world? or don't appear in both? Do you put your custom files in "images>inventoryimages" and "anim" folders? I'm making my mod who has a custom item this days and I went through lots of issues about not showing the image of the sprite in the game. Tell us more and maybe we can help. Essentially I've been able to implement it in the game nicely. Everything is functional except the dropped / inventory image. The item is completely blank / invisible which means it does find the path of the image, but it's not set up correctly. Mounting the files I believe I'm fine on that part. I don't understand how to come up with a build.bin. I don't understand how to come up with anim.bin. I don't understand what a "xml" is either. I do understand AutoCompiler should make a zip with all finished assets. I also understand TEX and how to make them. Edited June 13, 2019 by Hell-met Link to comment Share on other sites More sharing options...
Joy Machs Posted June 13, 2019 Share Posted June 13, 2019 Ok. I get it.. So I'm a Linux user and I compiled all the necessary programs by myself to work properly here. I'll try to help you with the "art" thing. To create a item, it's necessary to work inside two folders: your_mod_folder> exported your_mod_folder> images> inventoryimages (this one you need create. I needed in my case) The easy one is the art who will appear in the inventory. It's different from the one who appear in the world. All you need to do is create the art of your item inside the "inventoryimages" folder. It must be a PNG file and must have 64x64 px. You can take your blue grass and shrink it to make thing faster. Save it with the name of your custom item and let it there. Done this part, we go to the second: Inside the "exported" folder, you will create a folder with you custom item name, and inside it, a new folder with your custom item again. In the end, place your blue grass art inside the last folder. EX: exported> mycustomitem >mycustomitem > mycustomitem.png Now you will use the SPRITER to create a *.scml file. It is necessary cuz the information of the zip files in the ANIM folder comes from this project. SPRITER will ask you where you want to place your project file. You must place it in the first "mycustomitem" folder: EX: exported>mycustomitem> mycustomitem.scml Here is what you gonna do: 1. Will drag and drop the blue grass image to the center of your project. 2. In animation tab, rename "entity_000" to "yourcustomitem". 3. Yet in animation tab, rename "NewAnimation" to "idle". 4. Change the pivot position (this white ball) to the center of your image. Right click on it and choose "overwrite defaut pivot" Save your project and Close SPRITER. Now i think its everything in your place. The organization of your files must look like this now: exported >>mycustomitem.scml >>mycustomitem(folder) >>>>mycustomitem.png (art for the world view) images >>inventoryimages >>>>mycustomitem.png (art for the inventory) If you run the "autocompiler" now, a new zip file will be created in ANIM folder called "mycustomitem.zip". If you open this zip, you will find the "anim.bin", "build.bin" and "atlas-0.tex". Great, your image will me seen in the world if you drop the item on the ground. And the image inside "inventoryimages" folder will be converted to *TEX. You need to keep this file there, inside this folder... If you coded all the items correctly inside modmain and scripted their "prefabs" folder, they should appear now. I hope this could help you out! Link to comment Share on other sites More sharing options...
Well-met Posted June 14, 2019 Author Share Posted June 14, 2019 (edited) 16 hours ago, Joy Machs said: Ok. I get it.. So I'm a Linux user and I compiled all the necessary programs by myself to work properly here. I'll try to help you with the "art" thing. To create a item, it's necessary to work inside two folders: your_mod_folder> exported your_mod_folder> images> inventoryimages (this one you need create. I needed in my case) The easy one is the art who will appear in the inventory. It's different from the one who appear in the world. All you need to do is create the art of your item inside the "inventoryimages" folder. It must be a PNG file and must have 64x64 px. You can take your blue grass and shrink it to make thing faster. Save it with the name of your custom item and let it there. Done this part, we go to the second: Inside the "exported" folder, you will create a folder with you custom item name, and inside it, a new folder with your custom item again. In the end, place your blue grass art inside the last folder. EX: exported> mycustomitem >mycustomitem > mycustomitem.png Now you will use the SPRITER to create a *.scml file. It is necessary cuz the information of the zip files in the ANIM folder comes from this project. SPRITER will ask you where you want to place your project file. You must place it in the first "mycustomitem" folder: EX: exported>mycustomitem> mycustomitem.scml Here is what you gonna do: 1. Will drag and drop the blue grass image to the center of your project. 2. In animation tab, rename "entity_000" to "yourcustomitem". 3. Yet in animation tab, rename "NewAnimation" to "idle". 4. Change the pivot position (this white ball) to the center of your image. Right click on it and choose "overwrite defaut pivot" Save your project and Close SPRITER. Now i think its everything in your place. The organization of your files must look like this now: exported >>mycustomitem.scml >>mycustomitem(folder) >>>>mycustomitem.png (art for the world view) images >>inventoryimages >>>>mycustomitem.png (art for the inventory) If you run the "autocompiler" now, a new zip file will be created in ANIM folder called "mycustomitem.zip". If you open this zip, you will find the "anim.bin", "build.bin" and "atlas-0.tex". Great, your image will me seen in the world if you drop the item on the ground. And the image inside "inventoryimages" folder will be converted to *TEX. You need to keep this file there, inside this folder... If you coded all the items correctly inside modmain and scripted their "prefabs" folder, they should appear now. I hope this could help you out! Your post is outstanding and I hope it serves as a reference to anyone else searching for this. However your SPRITER image link does not load. Edited June 14, 2019 by Hell-met Link to comment Share on other sites More sharing options...
Joy Machs Posted June 14, 2019 Share Posted June 14, 2019 2 hours ago, Hell-met said: However your SPRITER image link does not load. Sorry. =/ I'll attach it to this reply. Link to comment Share on other sites More sharing options...
Well-met Posted June 14, 2019 Author Share Posted June 14, 2019 (edited) 34 minutes ago, Joy Machs said: Sorry. =/ I'll attach it to this reply. Thanks for the help. The game does not crash nor report no missing assets. I've placed the new zip in anim folder. unfortunately the end result is still the same. Inventory or ground alike. I kind of wish I could see what's written in the CMD prompt from autocompiler, you know? It might hold some interesting info if it did not instantly vanish. Edited June 14, 2019 by Hell-met Link to comment Share on other sites More sharing options...
Joy Machs Posted June 14, 2019 Share Posted June 14, 2019 4 minutes ago, Hell-met said: Thanks for the help. The game does not crash nor report no missing assets. I've placed the new zip in anim folder. unfortunately the end result is still the same. Inventory or ground alike. So there is must be some line missing. Here... take a look in my "modmain.lua", "fav_pencil.lua"(my custom item) and "wachs.lua"(my character). Compare them with your files and see if you miss something. MODMAIN.LUA Spoiler -- fav_pencil name and description GLOBAL.STRINGS.NAMES.FAV_PENCIL = "Favorite Pencil" GLOBAL.STRINGS.CHARACTERS.GENERIC.DESCRIBE.FAV_PENCIL = "The Good'n old friend of a artist." GLOBAL.STRINGS.RECIPE_DESC.FAV_PENCIL = "Almost a Fabre Castle!" -- star_chart name and description GLOBAL.STRINGS.NAMES.STAR_CHART = "Star Chart" GLOBAL.STRINGS.CHARACTERS.GENERIC.DESCRIBE.STAR_CHART = "The Stars can show us the way." GLOBAL.STRINGS.RECIPE_DESC.STAR_CHART = "You are never lost with the stars." -- my custom recipes local fav_pencil_recipe = AddRecipe("fav_pencil", {Ingredient("twigs", 3), Ingredient("charcoal", 3), Ingredient("razor", 1)}, GLOBAL.RECIPETABS.TOOLS, GLOBAL.TECH.SCIENCE_ONE, nil, nil, nil, nil, "artist", "images/inventoryimages/fav_pencil.xml") local star_chart_recipe = AddRecipe("star_chart", {Ingredient("fav_pencil", 1, "images/inventoryimages/fav_pencil.xml"), Ingredient("waxpaper", 1)}, GLOBAL.RECIPETABS.CARTOGRAPHY, GLOBAL.TECH.CARTPGRAPHY_ONE, nil, nil, nil, nil, "artist", "images/inventoryimages/star_chart.xml") PrefabFiles = { "wachs", "wachs_none", "fav_pencil", "star_chart", } Assets = { Asset( "IMAGE", "images/saveslot_portraits/wachs.tex" ), Asset( "ATLAS", "images/saveslot_portraits/wachs.xml" ), Asset( "IMAGE", "images/selectscreen_portraits/wachs.tex" ), Asset( "ATLAS", "images/selectscreen_portraits/wachs.xml" ), Asset( "IMAGE", "images/selectscreen_portraits/wachs_silho.tex" ), Asset( "ATLAS", "images/selectscreen_portraits/wachs_silho.xml" ), Asset( "IMAGE", "bigportraits/wachs.tex" ), Asset( "ATLAS", "bigportraits/wachs.xml" ), Asset( "IMAGE", "images/map_icons/wachs.tex" ), Asset( "ATLAS", "images/map_icons/wachs.xml" ), Asset( "IMAGE", "images/avatars/avatar_wachs.tex" ), Asset( "ATLAS", "images/avatars/avatar_wachs.xml" ), Asset( "IMAGE", "images/avatars/avatar_ghost_wachs.tex" ), Asset( "ATLAS", "images/avatars/avatar_ghost_wachs.xml" ), Asset( "IMAGE", "images/avatars/self_inspect_wachs.tex" ), Asset( "ATLAS", "images/avatars/self_inspect_wachs.xml" ), Asset( "IMAGE", "images/names_wachs.tex" ), Asset( "ATLAS", "images/names_wachs.xml" ), Asset( "IMAGE", "images/names_gold_wachs.tex" ), Asset( "ATLAS", "images/names_gold_wachs.xml" ), Asset( "IMAGE", "bigportraits/wachs_none.tex" ), Asset( "ATLAS", "bigportraits/wachs_none.xml" ), Asset( "IMAGE", "images/inventoryimages/fav_pencil.tex"), Asset( "ATLAS", "images/inventoryimages/fav_pencil.xml"), Asset( "IMAGE", "images/inventoryimages/star_chart.tex"), Asset( "ATLAS", "images/inventoryimages/star_chart.xml"), } AddMinimapAtlas("images/map_icons/wachs.xml") local TECH = GLOBAL.TECH local RECIPETABS = GLOBAL.RECIPETABS local Ingredient = GLOBAL.Ingredient local ACTIONS = GLOBAL.ACTIONS local require = GLOBAL.require local STRINGS = GLOBAL.STRINGS -- The character select screen lines STRINGS.CHARACTER_TITLES.wachs = "The Star Gazer" STRINGS.CHARACTER_NAMES.wachs = "Wachs" STRINGS.CHARACTER_DESCRIPTIONS.wachs = "*Is a Night Owl.\n*Enjoy the cool night breeze.\n*Loves to draw." STRINGS.CHARACTER_QUOTES.wachs = "\"There is nothing like the stars. Wonderful!\"" -- Custom speech strings STRINGS.CHARACTERS.WACHS = require "speech_wachs" -- The character's name as appears in-game STRINGS.NAMES.WACHS = "Wachs" -- Add mod character to mod character list. Also specify a gender. Possible genders are MALE, FEMALE, ROBOT, NEUTRAL, and PLURAL. AddModCharacter("wachs", "MALE") WACHS.LUA Spoiler local MakePlayerCharacter = require "prefabs/player_common" local assets = { Asset( "SCRIPT", "scripts/prefabs/player_common.lua"), Asset( "ANIM", "anim/wachs_beard.zip" ), Asset( "ANIM", "anim/fav_pencil.zip"), Asset( "ATLAS", "images/inventoryimages/fav_pencil.xml"), Asset( "ANIM", "anim/star_chart.zip"), Asset( "ATLAS", "images/inventoryimages/star_chart.xml"), } local prefabs = { "beardhair", "fav_pencil", "star_chart", } -- Custom starting inventory local start_inv = { "fav_pencil", } -- When the character is revived from human local function onbecamehuman(inst) -- Set speed when not a ghost (optional) inst.components.locomotor:SetExternalSpeedMultiplier(inst, "wachs_speed_mod", 1) end local function onbecameghost(inst) -- Remove speed modifier when becoming a ghost inst.components.locomotor:RemoveExternalSpeedMultiplier(inst, "wachs_speed_mod") end -- When loading or spawning the character local function onload(inst) inst:ListenForEvent("ms_respawnedfromghost", onbecamehuman) inst:ListenForEvent("ms_becameghost", onbecameghost) if inst:HasTag("playerghost") then onbecameghost(inst) else onbecamehuman(inst) end end -- This initializes for both the server and client. Tags can be added here. local common_postinit = function(inst) -- Minimap icon inst.MiniMapEntity:SetIcon( "wachs.tex" ) inst:AddTag("artist") end -- Beard configuration local function OnResetBeard(inst) inst.AnimState:ClearOverrideSymbol("beard") end --tune the beard economy... local BEARD_DAYS = { 2, 5, 9 } local BEARD_BITS = { 1, 2, 4 } local function OnGrowShortBeard(inst) inst.AnimState:OverrideSymbol("beard", "wachs_beard", "beard_short") inst.components.beard.bits = BEARD_BITS[1] end local function OnGrowMediumBeard(inst) inst.AnimState:OverrideSymbol("beard", "wachs_beard", "beard_medium") inst.components.beard.bits = BEARD_BITS[2] end local function OnGrowLongBeard(inst) inst.AnimState:OverrideSymbol("beard", "wachs_beard", "beard_long") inst.components.beard.bits = BEARD_BITS[3] end -- Speed values local day_speed = 0.9 local dusk_speed = 1 local night_speed = 1.2 local function onphase(inst, phase) local speed = 1 if phase == "day" then speed = day_speed elseif phase == "dusk" then speed = dusk_speed else speed = night_speed end inst.components.locomotor:SetExternalSpeedMultiplier( inst, "Acceleration", speed ) end -- Sanity changer local function sanityfn(inst) local delta = 0 if TheWorld.state.isday then delta = -0.1 elseif TheWorld.state.isdusk then delta = 0.085 elseif TheWorld.state.isnight then delta = 0.15 end return delta end -- This initializes for the server only. Components are added here. local master_postinit = function(inst) -- Sanity inst.components.sanity.custom_rate_fn = sanityfn -- Speed inst:WatchWorldState("phase", onphase) -- Beard inst:AddComponent("beard") inst.components.beard.onreset = OnResetBeard inst.components.beard.prize = "beardhair" inst.components.beard:AddCallback(BEARD_DAYS[1], OnGrowShortBeard) inst.components.beard:AddCallback(BEARD_DAYS[2], OnGrowMediumBeard) inst.components.beard:AddCallback(BEARD_DAYS[3], OnGrowLongBeard) -- choose which sounds this character will play inst.soundsname = "wilson" -- Uncomment if "wathgrithr"(Wigfrid) or "webber" voice is used --inst.talker_path_override = "dontstarve_DLC001/characters/" -- Stats inst.components.health:SetMaxHealth(200) inst.components.hunger:SetMax(150) inst.components.sanity:SetMax(150) -- Damage multiplier (optional) inst.components.combat.damagemultiplier = 1.2 -- Hunger rate (optional) inst.components.hunger.hungerrate = 1 * TUNING.WILSON_HUNGER_RATE inst.OnLoad = onload inst.OnNewSpawn = onload end return MakePlayerCharacter("wachs", prefabs, assets, common_postinit, master_postinit, start_inv) FAV_PENCIL.LUA Spoiler local assets = { Asset("ANIM", "anim/fav_pencil.zip"), } local function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddNetwork() MakeInventoryPhysics(inst) inst.AnimState:SetBank("fav_pencil") inst.AnimState:SetBuild("fav_pencil") inst.AnimState:PlayAnimation("idle") inst:AddTag("cattoy") MakeInventoryFloatable(inst, "med", 0.15, 0.65) inst.entity:SetPristine() if not TheWorld.ismastersim then return inst end local function OnDrawFn(inst, target, image) end ----------------- inst:AddComponent("inventoryitem") inst.components.inventoryitem.atlasname = "images/inventoryimages/fav_pencil.xml" inst:AddComponent("finiteuses") inst.components.finiteuses:SetMaxUses(TUNING.BOOMERANG_USES) inst.components.finiteuses:SetUses(TUNING.BOOMERANG_USES) inst.components.finiteuses:SetOnFinished(inst.Remove) inst.components.finiteuses:SetConsumption(ACTIONS.DRAW, 1) ----------------- inst:AddComponent("fuel") inst.components.fuel.fuelvalue = TUNING.SMALL_FUEL --------------------- MakeSmallBurnable(inst, TUNING.SMALL_BURNTIME) MakeSmallPropagator(inst) MakeHauntableLaunchAndIgnite(inst) inst:AddComponent("inspectable") ---------------------- inst:AddComponent("drawingtool") inst.components.drawingtool:SetOnDrawFn(OnDrawFn) ---------------------- return inst end return Prefab("fav_pencil", fn, assets) I hope this files can help you out. My custom item is a pencil who work similar to a "feather pencil", but now it has finites uses (10 uses) and I can use it to draw in minisigns. It is a ingredient for another custom item too. Link to comment Share on other sites More sharing options...
Well-met Posted June 14, 2019 Author Share Posted June 14, 2019 well, I've made some tiny bit of progress, indeed. that is ridiculous. I'll just try to decompile cutgrass and work from there I suppose. Link to comment Share on other sites More sharing options...
Joy Machs Posted June 14, 2019 Share Posted June 14, 2019 Yeah! It's damn disappointing when you spend so much time in something that refuses to work. XD but don't give up! Keep posting your progress here and always remember to check the client_log. Link to comment Share on other sites More sharing options...
Well-met Posted June 14, 2019 Author Share Posted June 14, 2019 for future reference, inventoryimages need inst:AddComponent("inventoryitem") inst.components.inventoryitem.atlasname = "images/inventoryimages/NAMEHERE.xml" inst.components.inventoryitem.imagename = "NAMEHERE" Link to comment 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