Page 1 of 1
Component reset bug?
Posted: Tue Sep 29, 2015 9:12 pm
by CainOrdamoth
Hey everyone, I'm relatively new to the modding scene (been working feverishly on my first mod Treasures of Khilvon, check it out

), but I've run into a pretty major snag I can't figure out.
In a nutshell, certain assets in my dungeon "reset" their checked/unchecked components when I save and load the dungeon in-game. What is the reason for this, and is there an easy way to fix it? If you need more detail, I'll give an example:
The sx_town_wall_barrels_1 custom asset is something I use extensively to decorate the streets of my town, but by default it is an obstacle that blocks movement. For my purposes, I uncheck the obstacle component so the player can move past it. And this all works perfectly in preview mode and in-game itself. However, if I save the game and reload, all these components "reset" and become checked again, making the barrels back into obstacles and making the map impossible to play because all the streets are now blocked off. This happens with default assets as well, such as plant clusters I made passable, or certain assets I made invisible for various reasons becoming visible, and ruining the aesthetic.
I'm new to this, so maybe I'm overlooking something obvious, or didn't consider the limits of the engine, but I'm stumped, lol.
Thanks in advance

Re: Component reset bug?
Posted: Tue Sep 29, 2015 9:30 pm
by minmay
This isn't a bug. Read
this, especially the section about minimalSaveState; that's what's happening here.
Also, the sx_town conversion is totally broken, so to avoid ending up with a correspondingly broken mod, you really need to either fix it or not use it.
Re: Component reset bug?
Posted: Tue Sep 29, 2015 9:30 pm
by AndakRainor
If you read the definitions of those objects you should see this line:
That means you won't save any modifications to those objects except the position and facing, and they will respawn with their default values when loading the game. But this is a good thing to limit the size of the saved games, so if you want to deactivate a component for a lot of objects, the best thing would be to define a new object similar to the first but with another name and without the components you don't want. removing the minimalState line for objects used a lot of times would be a bad idea...
Re: Component reset bug?
Posted: Tue Sep 29, 2015 10:23 pm
by Azel
I'm starting to have nightmares about a bunch of minimalSaveState objects chasing me around town.
I vote that we rename that property, some candidates:
has32BitLimitation = true;
stopSavingMyData = true;
minmaysFavoriteProperty = true;
ifThisIsFalseYourModDies = true;

Re: Component reset bug?
Posted: Wed Sep 30, 2015 1:36 am
by CainOrdamoth
Ok, thanks for this info, not sure how I missed it. Looks like I've got some fixing to do XD.
Speaking of, about those barrels in the sx town mod, would it be ok to change the baseObject in the object script (to something other than 'blocker'), or is it frowned upon? Or should I just define a new object?
Thanks again

Re: Component reset bug?
Posted: Wed Sep 30, 2015 1:42 am
by minmay
If an object definition has a baseObject field then it inherits all components, and all fields other than "components", from the baseObject. As usual, adding a component to the "components" table with the same name as a previous one will overwrite that previous one, so it's quite common to have a baseObject and overwrite some of its components. (The inherited components always come before the new components, so they can always be overwritten.) There are plentiful examples of this in the standard assets.
You never need to use baseObject, it's just convenient. If you don't want the barrels to be an obstacle then it's probably easiest to use base_floor_decoration as the baseObject.
Re: Component reset bug?
Posted: Wed Sep 30, 2015 1:49 am
by CainOrdamoth
I see, thank you very much.
The asset I want to function differently is a custom one; would the author/creator of that asset be offended if I changed any of it?
Re: Component reset bug?
Posted: Wed Sep 30, 2015 2:00 am
by minmay
That's never mentioned in the original, so I think you'd have to ask Skuggasveinn.
Re: Component reset bug?
Posted: Wed Sep 30, 2015 10:24 pm
by Skuggasveinn
Hi.
Like stated on the nexus page this tileset is the unfinished town tileset from a LoG1 collaboration project that never saw the light of day.
I released the models that I made in case anybody ever wanted to use any of it. I did not do the conversion to LoG2 and I understand it has some issues (no occluders, wrong conversion of normal textures and stuff like that).
But you are absolutely welcome to change what ever you like in whatever way you see fit, and that goes for everything you (or anybody else) can find on the nexus made by me.
Give credit or not, that's totally up to you and totally fine be me either way.
Skuggasveinn.
Re: Component reset bug?
Posted: Wed Sep 30, 2015 11:58 pm
by CainOrdamoth
Thanks Skuggasveinn, and thanks everyone in the community. Your efforts are very much appreciated

.