Sign in to follow this  
Ipsquiggle

Preview Mod Upgrade Issues

Recommended Posts

RobRichards    8

[MENTION=39861]RobRichards[/MENTION], [MENTION=56156]Gigatoast[/MENTION], [MENTION=33765]Xina42[/MENTION], [MENTION=7222]DaverGamer[/MENTION]Tutorial is here! http://forums.kleientertainment.com/showthread.php?22670-Upgrading-character-mods-to-work-with-Public-Preview&p=221000#post221000Note that some of your issues may actually be caused by a bug which will be fixed in tomorrow's release. :)

Ah Glad to see everything is cleared up then, Thankyou for the heads up about the bug! :D

Share this post


Link to post
Share on other sites
ArcticFox789    702

Gah. More work for the Supermod. Better make sure the coders know, just in case. [MENTION=44092]simplex[/MENTION]; [MENTION=24606]chromiumboy[/MENTION]Hopefully you knew, if not, have fun! :)

Share this post


Link to post
Share on other sites
simplex    2612

Yay! My mod survived the update unscathed! And it already had a modinfo.lua anyway, I just had to add a couple more entries :joyous:

Share this post


Link to post
Share on other sites
_Q_    636

Worldgen code sample:

[FONT=arial]GLOBAL.require("map/levels")[/FONT][FONT=arial]-- find an existing preset:[/FONT][FONT=arial]local darknes = nil[/FONT][FONT=arial]for k,level in ipairs(GLOBAL.levels.sandbox_[/FONT][FONT=arial]levels) do[/FONT][FONT=arial]    if [/FONT]level.id[FONT=arial] == "COMPLETE_DARKNESS" then[/FONT][FONT=arial]         darkness = level[/FONT][FONT=arial]         break[/FONT][FONT=arial]    end[/FONT][FONT=arial]end[/FONT][FONT=arial]-- do some kind of modification, like adding a new task[/FONT][FONT=arial]table.insert(darkness.tasks, "Guarded For a nice walk")[/FONT][FONT=arial]-- add a new preset:[/FONT][FONT=arial]local my_preset = GLOBAL.Level({[/FONT][FONT=arial]    id = "MY_PRESET",[/FONT][FONT=arial]    name = "My lovely preset!",[/FONT][FONT=arial]    tasks = {[/FONT][FONT=arial]              "Make a pick",[/FONT][FONT=arial]              "Easy Blocked Dig that rock",[/FONT][FONT=arial]              "Great Plains",[/FONT][FONT=arial]              "Guarded Speak to the king",[/FONT][FONT=arial]    },[/FONT][FONT=arial]    overrides = {},[/FONT][FONT=arial]})[/FONT][FONT=arial]table.insert(GLOBAL.levels.[/FONT][FONT=arial]sandbox_levels, my_preset)[/FONT]
Only levels.lua is global, or we can access other files in map folder from modmain?

Share this post


Link to post
Share on other sites
Ipsquiggle    6560

Only levels.lua is global, or we can access other files in map folder from modmain?

I'd say, give it a try and let me know if you run into problems! ;)GLOBAL contains all the data the game has loaded, so every file is accessible through that. Mods are now loaded at an appropriate time in the world gen sequence that you should be able hijack any of the level/room/etc. definitions before actual generation occurs.

Share this post


Link to post
Share on other sites
_Q_    636

The custom images for wold customization screen still don't load. Any help wit that?If I name my xml file customisation.xml game reads from it but still don't see textures, so there is not even single image on world customization screen then.

Share this post


Link to post
Share on other sites
_Q_    636

I wanted to do some editing to walls textures (stone walls, wooden walls) but I can't see clearly where is the end of the area I can draw in before the area of next element start, there is no clear frames like in character texture.

Share this post


Link to post
Share on other sites

I found a really weird bug.Background:I was cloning the Chester_Eyebone for a new creative item and while it works on It's Not A Rock update, I was updating it to work with this update and I've ran into this error.

...n/dont_starve/data/scripts/widgets/inventoryslot.lua:134: attempt to call method 'GetAtlas' (a nil value)LUA ERROR stack traceback:        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/widgets/inventoryslot.lua(134,1) in function '_ctor'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/class.lua(28,1) in function 'ItemTile'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/widgets/inventorybar.lua(207,1) in function 'OnItemGet'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/widgets/inventorybar.lua(68,1) in function 'fn'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/entityscript.lua(585,1) in function 'PushEvent'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/components/inventory.lua(497,1) in function 'GiveItem'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/actions.lua(153,1) in function 'fn'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/bufferedaction.lua(20,1) in function 'Do'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/entityscript.lua(761,1) in function 'PerformBufferedAction'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/stategraphs/SGwilson.lua(1366,1) in function 'ontimeout'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/stategraph.lua(434,1) in function 'UpdateState'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/stategraph.lua(491,1) in function 'Update'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/stategraph.lua(109,1) in function 'Update'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/update.lua(116,1)C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/frontend.lua(276,1)	SCRIPT ERROR! Showing error screen
Edited by gamer.toukotsu

Share this post


Link to post
Share on other sites
tehMugwump    444

[MENTION=55]Ipsquiggle[/MENTION], several of my mods now error out with "not a valid Klei texture", even though they were fine before the preview. I've made several new backgrounds for several mods including Test Tools that now will not load. If you knew how much trouble I went through to get these all working the first time, you'd send me a cake. :nightmare:

What needs to be done?

Share this post


Link to post
Share on other sites
Ipsquiggle    6560

@Ipsquiggle, several of my mods now error out with "not a valid Klei texture", even though they were fine before the preview. I've made several new backgrounds for several mods including Test Tools that now will not load. If you knew how much trouble I went through to get these all working the first time, you'd send me a cake. :nightmare:

What needs to be done?

Could you post one of the mods that's not working? I remember I ran into something like this before but I can't recall anymore what the steps I took were. (And I don't remember if was related to the textures themselves, or loading, or etc. so the whole mod would be most useful.) Thanks.. :)

Share this post


Link to post
Share on other sites
tehMugwump    444

Could you post one of the mods that's not working? I remember I ran into something like this before but I can't recall anymore what the steps I took were. (And I don't remember if was related to the textures themselves, or loading, or etc. so the whole mod would be most useful.) Thanks.. :)

This works completely, but the background chest image no longer loads, and I've got this problem in a few other mods.If these images have to be the 'power of 2' thing, it won't work because the various bags and such don't conform to those limited size choices.

Share this post


Link to post
Share on other sites
Ipsquiggle    6560

And How to Add/Change the Tabs Images? on the new issues.

As with previous issues, it's not currently possible. I've written a fix for this, I'll post instructions when the fix is released. Thanks for finding this case!

Share this post


Link to post
Share on other sites
Ipsquiggle    6560

This works completely, but the background chest image no longer loads, and I've got this problem in a few other mods.

The background image on the chest wasn't loading because of some more of the atlas weirdness. In maxwellschest.lua (the prefab), make the following changes:

1) Add a reference to the background .xml in the prefab assets:

local assets={    Asset("ANIM", "anim/maxwells_chest.zip"),    Asset("IMAGE", "images/ui_chest_5x16.tex"),    Asset("ATLAS", "images/ui_chest_5x16.xml"),    Asset("IMAGE", "images/inventoryimages/maxwellschest.tex"),    Asset("ATLAS", "images/inventoryimages/maxwellschest.xml"),}
2) Add the atlas to the bg image of the container, using the following code: (I'll add this to the top post for future reference. Again, sorry for missing this.)

-- old line        --inst.components.container.widgetbgimage = "mods/MaxwellsChest/images/ui_chest_5x16.tex"-- new lines        inst.components.container.widgetbgimage = "ui_chest_5x16.tex"        inst.components.container.widgetbgatlas = "mods/MaxwellsChest/images/ui_chest_5x16.xml"

If these images have to be the 'power of 2' thing, it won't work because the various bags and such don't conform to those limited size choices.

For this mod in particular, it's being cause by the mod icon (MaxwellsChest.tex in the mod root).

I learned something today: The engine can't load non-power-of-two textures IF they are both: compressed, AND have mips! I seem to recall that the TEXCreator tool used to default to mips off, now it defaults to on. So a NPOT texture that was exported with defaults before, and worked, no longer works if reexported with the defaults.

Your options for the immediate future are to either: make these power-of-two (probably not practical) or re-export either as ARGB or with mips turned off.

I'm going to look into what I can do to improve this for the future. At the very least, I'll improve the error message so that it's more clear what's happening and why!

several of my mods now error out with "not a valid Klei texture"

I didn't notice this in the mod posted at all.. any luck with that, or anything in particular I can look at?

Share this post


Link to post
Share on other sites
tehMugwump    444

Many thanks [MENTION=55]Ipsquiggle[/MENTION]. Yeah, I know the one error is because I've just dropped a tehMug image in there for a place holder.Also, how do we now reference a .tex file that is inside selectscreen_portraits.tex? I've got a stack of portraits I use to reference individually, but I'm at a loss as to what to do now that they're all in this one file...I'll try this out tonight if I get the Character screen to load in Test Tools:Asset("IMAGE", "data/images/selectscreen_portraits.tex"),Asset("ATLAS", "data/images/selectscreen_portraits.xml"),

Edited by tehMugwump

Share this post


Link to post
Share on other sites
Ipsquiggle    6560

Depends how exactly you mean to reference them.At the most fundamental level, it's about the Image() constructor. (If you check any of the UI or widget scripts, you'll see lots of these.) Before it was just Image(texturepath), now it's Image(atlaspath, subtexturepath). So anywhere you're specifying a texture for a UI element, you need to get not just the image name to it but also the atlas. For example, if you wanted to get the "wilson" character portrait, you'd want the final call to look like this:Image("data/images/selectscreen_portraits.xml", "wilson.tex")You can look in the atlas .xml file to see what texture names it contains.If this is for a UI element that you are making or modding directly, it should be fairly straight forward: just make sure you're supplying it with both those paths.If you're trying to get different images into an existing screen or UI element, that could be a little trickier.. that's mostly what I've been doing this last few days, is adding ways for modders to specify both the image and atlas for various UI elements (like we just did with the container widget in my last post.)As far as LOADING them: You are correct, you just have to do Asset() for both the atlas .xml file and the atlas .tex file. The subimages (i.e. wilson.tex) are contained within those two files implicitly.Does that make sense?

Share this post


Link to post
Share on other sites
tehMugwump    444

Depends how exactly you mean to reference them.At the most fundamental level, it's about the Image() constructor. (If you check any of the UI or widget scripts, you'll see lots of these.) Before it was just Image(texturepath), now it's Image(atlaspath, subtexturepath). So anywhere you're specifying a texture for a UI element, you need to get not just the image name to it but also the atlas. For example, if you wanted to get the "wilson" character portrait, you'd want the final call to look like this:Image("data/images/selectscreen_portraits.xml", "wilson.tex")You can look in the atlas .xml file to see what texture names it contains.If this is for a UI element that you are making or modding directly, it should be fairly straight forward: just make sure you're supplying it with both those paths.If you're trying to get different images into an existing screen or UI element, that could be a little trickier.. that's mostly what I've been doing this last few days, is adding ways for modders to specify both the image and atlas for various UI elements (like we just did with the container widget in my last post.)As far as LOADING them: You are correct, you just have to do Asset() for both the atlas .xml file and the atlas .tex file. The subimages (i.e. wilson.tex) are contained within those two files implicitly.Does that make sense?

Yep, makes perfect sense. Thanks for the explanation. :encouragement:

Share this post


Link to post
Share on other sites
_Q_    636

[MENTION=55]Ipsquiggle[/MENTION]Since I don't have idea where to declare atlases for customisation screen here is my mod. Ignore images in mod root directory, the image I try to put into the game is in the images folder along with atlas (mushrooms).

Share this post


Link to post
Share on other sites
futaradragon    55

As with previous issues, it's not currently possible. I've written a fix for this, I'll post instructions when the fix is released. Thanks for finding this case!

Oh thankyou ^^

Share this post


Link to post
Share on other sites

[MENTION=55]Ipsquiggle[/MENTION] any foot notes about the issue I am currently running into?

...n/dont_starve/data/scripts/widgets/inventoryslot.lua:134: attempt to call method 'GetAtlas' (a nil value)LUA ERROR stack traceback:        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/widgets/inventoryslot.lua(134,1) in function '_ctor'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/class.lua(28,1) in function 'ItemTile'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/widgets/inventorybar.lua(207,1) in function 'OnItemGet'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/widgets/inventorybar.lua(68,1) in function 'fn'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/entityscript.lua(585,1) in function 'PushEvent'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/components/inventory.lua(497,1) in function 'GiveItem'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/actions.lua(153,1) in function 'fn'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/bufferedaction.lua(20,1) in function 'Do'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/entityscript.lua(761,1) in function 'PerformBufferedAction'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/stategraphs/SGwilson.lua(1366,1) in function 'ontimeout'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/stategraph.lua(434,1) in function 'UpdateState'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/stategraph.lua(491,1) in function 'Update'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/stategraph.lua(109,1) in function 'Update'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/update.lua(116,1)C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/frontend.lua(276,1)	SCRIPT ERROR! Showing error screen
I have attached the mod I am working on, any information would be greatly appreciated. (It's pretty much just a copy of the Chester_Eyebone.lua file, with some additional stuff to make it only visible at night.)

the chesterfields.zip

Share this post


Link to post
Share on other sites
chromiumboy    330

Hey [MENTION=55]Ipsquiggle[/MENTION], got another one for you: prefabs with custom textures do not show up in the crafting tab when they are ingredients. I have the atlases in the ingredient prefabs, and they show up on the inventory bar, just not in the crafting tab. I check my log and found these warning messages:

WARNING! Could not set texture: 'bearclaws.tex' from atlas 'data/images/inventoryimages.xml'
So while you set the atlas for recipes, can you set the image paths for ingredient?---EDIT: Found the answer to my own question: nope.In crafting.lua, the ingredient atlas is locally defined. Starting from line 432 of crafting.lua:
local inventory_atlas = resolvefilepath("data/images/inventoryimages.xml")        for k,v in pairs(recipe.ingredients) do                    local has, num_found = owner.components.inventory:Has(v.type, v.amount)                        local ing = self.contents:AddChild(IngredientUI(inventory_atlas, v.type..".tex", v.amount, num_found, has, STRINGS.NAMES[string.upper(v.type)], owner))            ing:SetPosition(Vector3(offset, 80, 0))            offset = offset + (w+ div)            self.ing[k] = ing        end
I'd need to override the script I think. Edited by chromiumboy

Share this post


Link to post
Share on other sites
tehMugwump    444

I'm working through the same issue with the background image for backpacks when loaded (in the inventory equip bar):WARNING! Could not set texture: 'images/equip_slot_back.tex' from atlas 'data/images/hud.xml'This also involves hover text which isn't working either (in my case).The image loading has been drastically changed and has broken everything. Most things have been fixable, but this still alludes me...

Hey [MENTION=55]Ipsquiggle[/MENTION], got another one for you: prefabs with custom textures do not show up in the crafting tab when they are ingredients. I have the atlases in the ingredient prefabs, and they show up on the inventory bar, just not in the crafting tab. I check my log and found these warning messages:

WARNING! Could not set texture: 'bearclaws.tex' from atlas 'data/images/inventoryimages.xml'
So while you set the atlas for recipes, can you set the image paths for ingredient?---EDIT: Found the answer to my own question: nope.In crafting.lua, the ingredient atlas is locally defined. Starting from line 432 of crafting.lua:
local inventory_atlas = resolvefilepath("data/images/inventoryimages.xml")        for k,v in pairs(recipe.ingredients) do                    local has, num_found = owner.components.inventory:Has(v.type, v.amount)                        local ing = self.contents:AddChild(IngredientUI(inventory_atlas, v.type..".tex", v.amount, num_found, has, STRINGS.NAMES[string.upper(v.type)], owner))            ing:SetPosition(Vector3(offset, 80, 0))            offset = offset + (w+ div)            self.ing[k] = ing        end
I'd need to override the script I think.
Edited by tehMugwump

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this