Gobbel Posted June 30, 2019 Share Posted June 30, 2019 Hi all, currently I am trying to get a minimap icon to work, but it doesn´t work. I looked at the sample mod, the old goldrocks icon mod, the beefalo icon mod, and I tried to find the fault in the code. However, I couldn´t find any, it should work correctly, but in-game there still is no minimap icon showing. There are no errors in any form also, meaning the game runs stable. I just upload my mod to here, and if anyone could help me find the mistake I would gladly appreciate it! Thank you very much! Dont Starve Together Mod v4.zip Link to comment https://forums.kleientertainment.com/forums/topic/108187-minimap-icon-not-showing/ Share on other sites More sharing options...
Ultroman Posted July 1, 2019 Share Posted July 1, 2019 In your ca_mealingstone.xml you reference the texture by the name "ca_mealingstone_icon.tex" instead of "ca_mealingstone.tex" Link to comment https://forums.kleientertainment.com/forums/topic/108187-minimap-icon-not-showing/#findComment-1217275 Share on other sites More sharing options...
Gobbel Posted July 1, 2019 Author Share Posted July 1, 2019 Yes, that is true. But actually that code is not in use, hence the "--" in front of it. Basically I tried a modular approach, the code is identical to the one found in the original gold rock minimap icon mod. So all earlier to a minimap icon relevant code in the actual prefab file is not in use. All the work is handled in the modmain. The code is still the same, only the application method differs. But it still doesn´t work. Link to comment https://forums.kleientertainment.com/forums/topic/108187-minimap-icon-not-showing/#findComment-1217349 Share on other sites More sharing options...
Ultroman Posted July 1, 2019 Share Posted July 1, 2019 I think you've misunderstood me. You have this code in your modmain.lua function AddMap(prefab) table.insert(Assets, Asset("IMAGE", "minimap/" .. prefab .. ".tex")) table.insert(Assets, Asset("ATLAS", "minimap/" .. prefab .. ".xml")) AddMinimapAtlas("minimap/" .. prefab .. ".xml") AddPrefabPostInit(prefab, function(inst) inst.entity:AddMiniMapEntity() inst.MiniMapEntity:SetIcon(prefab .. ".tex") end) end prefabs_to_add = { "ca_mealingstone", } for k,v in pairs(prefabs_to_add) do AddMap(v) end The problem I'm talking about is not in any code. It's in your atlas for the ca_mealingstone.tex, namely the file next to it called ca_mealingstone.xml. The atlas references a file that does not exist, which means it won't show anything when you use it here: AddMinimapAtlas("minimap/" .. prefab .. ".xml") Link to comment https://forums.kleientertainment.com/forums/topic/108187-minimap-icon-not-showing/#findComment-1217486 Share on other sites More sharing options...
Gobbel Posted July 1, 2019 Author Share Posted July 1, 2019 (edited) Oh, okay, thanks. So something went wrong with the conversion from png to tex/atlas, is that what you are saying? Then I will try to make a new tex and atlas. Edit: had a quick look at the file, and now it is so obvious. Thank you very much for pointing that out! Edit2: However, even after changing the atlas to the correct tex filename with notepadd++ it still won´t show on the minimap Do you have any idea why that is the case? Edited July 1, 2019 by Gobbel Link to comment https://forums.kleientertainment.com/forums/topic/108187-minimap-icon-not-showing/#findComment-1217543 Share on other sites More sharing options...
Ultroman Posted July 2, 2019 Share Posted July 2, 2019 Unless this: inst.MiniMapEntity:SetIcon(prefab .. ".tex") should be this: inst.MiniMapEntity:SetIcon("minimap/" .. prefab .. ".tex") , I can't really see what else would be wrong. Have you tried putting in some print-statements to ensure that the things you think should happen actually happen, and that the variables you're using are what you think they are? If you don't know how, check out the section on debugging in the newcomer post. Link to comment https://forums.kleientertainment.com/forums/topic/108187-minimap-icon-not-showing/#findComment-1217816 Share on other sites More sharing options...
Gobbel Posted July 2, 2019 Author Share Posted July 2, 2019 I tried your suggestion, but still no icon showing. It really is driving me crazy, because if even someone like you says it should work, then it really should work indeed. I haven´t tried using print statements, because basically I haven´t yet learned how to use them. I am still a newbie and basically just use trial and error as well as reverse engineering code from already working mods. Link to comment https://forums.kleientertainment.com/forums/topic/108187-minimap-icon-not-showing/#findComment-1218024 Share on other sites More sharing options...
Ultroman Posted July 2, 2019 Share Posted July 2, 2019 Well, that's annoying and weird No clue, then, unless there's something we're missing (and of course there is). You need to graduate from trial and error and looking at other mods. It's a great way to start out and find inspiration, but at some point you need to study the context in which you are working and the tools at your disposal, in order to progress towards greatness There should be sufficient information about debugging in the newcomer post (linked in my last post) to get you started. Let me know if you have any problems with it and what your results are. Link to comment https://forums.kleientertainment.com/forums/topic/108187-minimap-icon-not-showing/#findComment-1218195 Share on other sites More sharing options...
Developer bizziboi Posted July 2, 2019 Developer Share Posted July 2, 2019 Don't know anything about this (not kidding) but I did notice that all minimap entities seem to use the underlying png name for their icon. minimap:SetIcon("backpack.png") Link to comment https://forums.kleientertainment.com/forums/topic/108187-minimap-icon-not-showing/#findComment-1218223 Share on other sites More sharing options...
Ultroman Posted July 3, 2019 Share Posted July 3, 2019 30 minutes ago, bizziboi said: Don't know anything about this (not kidding) but I did notice that all minimap entities seem to use the underlying png name for their icon. minimap:SetIcon("backpack.png") That is entirely confusing, but a nice spot Link to comment https://forums.kleientertainment.com/forums/topic/108187-minimap-icon-not-showing/#findComment-1218236 Share on other sites More sharing options...
Developer bizziboi Posted July 3, 2019 Developer Share Posted July 3, 2019 Not entirely confusing, given that tex can be an atlas and thus contain multiple images, which would need to be referenced by some name. Their original name would seem a reasonable candidate Link to comment https://forums.kleientertainment.com/forums/topic/108187-minimap-icon-not-showing/#findComment-1218277 Share on other sites More sharing options...
Ultroman Posted July 3, 2019 Share Posted July 3, 2019 1 hour ago, bizziboi said: Not entirely confusing, given that tex can be an atlas and thus contain multiple images, which would need to be referenced by some name. Their original name would seem a reasonable candidate Touché, sir. I just wouldn't think they'd include the extension. Link to comment https://forums.kleientertainment.com/forums/topic/108187-minimap-icon-not-showing/#findComment-1218295 Share on other sites More sharing options...
Developer bizziboi Posted July 3, 2019 Developer Share Posted July 3, 2019 I was just being playful, I don't even know if it solves the problem! But maybe the game originally supported png's and this required the least code changes. maybe the game at one time supported sideloading the png without rebuilding the tex files maybe the converter supports multiple input formats, and with the extension they can be discriminated or maybe it was planned to at some point I mean, I have no idea. I just look at existing code until I find something that makes sense Link to comment https://forums.kleientertainment.com/forums/topic/108187-minimap-icon-not-showing/#findComment-1218307 Share on other sites More sharing options...
Gobbel Posted July 4, 2019 Author Share Posted July 4, 2019 Hi guys, sorry for the late reply. I incorporated a few of Ultraman´s tips regarding debugging and I actually found a problem with the new mushroomstump prefab and could fix that. However, still nothing new regarding the minimap icon. I try to use a few prints to check what´s wrong, but so far I think the only print that makes sense to use is the one which checks if that function is called or not, am I right? But, just as a side note. I also had a lot of trouble with my inventory images and in the end it was all because of faulty tex and atlas files, the code was correct. So maybe, this here is the same. Although I used the autocompiler for my png... Well, I´ll triple check XD Link to comment https://forums.kleientertainment.com/forums/topic/108187-minimap-icon-not-showing/#findComment-1218911 Share on other sites More sharing options...
Ultroman Posted July 5, 2019 Share Posted July 5, 2019 Sounds great I would not be surprised if it's just some error in the altas (xml file). 21 hours ago, Gobbel said: so far I think the only print that makes sense to use is the one which checks if that function is called or not, am I right? You can print variable values with the print statements, as well, so if you have an inst of something, you can do print("inst prefab name: " .. inst.prefab) So in your case you could, e.g., print the prefab parameter in your AddMap function. But I'm pretty sure that part works fine. But you never know. Some of these weird problems have weird sources and weird solutions. Link to comment https://forums.kleientertainment.com/forums/topic/108187-minimap-icon-not-showing/#findComment-1219681 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