initial settings unusual issue

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
Granamir
Posts: 202
Joined: Wed Jan 07, 2015 7:19 pm

initial settings unusual issue

Post by Granamir »

Just discovered that saving game in my custom dungeon, closing game and starting again, then loading saved game doesn't load all of initial settings.
In some maps i used 'setWorldPositionY(number)' and 'setSubtileOffset(n, m)' in a script object (outside of a function), to place items exactly where i want, and works almost always good. Unfortunately i discovered that after exporting my dungeon if i save my position and continue playing later (after closing and loading again the game) some of those settings are loaded properly some other doesn't; even in same script object some settings are loaded someone else doesn't. Can't imagine why.
Anyone has encountered same or similar problem? Anyone has some clue to help me solve this really big problem.
Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: initial settings unusual issue

Post by Batty »

minmay wrote: minimalSaveState
Objects defined as having "minimalSaveState" will have only minimal properties saved: their name, id, x, y, elevation, and facing. minimalSaveState should be used on objects such as walls and floors that won't change during gameplay. If you are changing the object in any way - using setWorldPosition, setWorldRotation, doing anything to its components such as setting wall text, etc. - then minimalSaveState is not appropriate. If you're confused, use the asset pack as a guide.
Read me.
Granamir
Posts: 202
Joined: Wed Jan 07, 2015 7:19 pm

Re: initial settings unusual issue

Post by Granamir »

So if i understood well, i'm not a programmer, those objects that have minimalsavestate=true in theyr code have this 'issue'...
I thought that every time i load the game it read every script object and execute every line of code outside a function...was i wrong? does it execute them only first time, when entire dungeon is created?
...so i'm keeping for miself what i would to say and just ask:
how can i avoid this problem? have i to clone every object i used, to set minimalsavestate=false? is there a smarter, cleaner, easier solution?
User avatar
JohnWordsworth
Posts: 1397
Joined: Fri Sep 14, 2012 4:19 pm
Location: Devon, United Kingdom
Contact:

Re: initial settings unusual issue

Post by JohnWordsworth »

minimalsavestate is an optimization to prevent loads of information being saved for items that don't ever change (beyond x, y, level and elevation info) in a dungeon. For instance, saving trees and statues and the like with minimal info makes the save much smaller and faster to read/write.

ScriptEntities are only run the first time a dungeon starts. Otherwise, every time you load a save, everything created by script entities would be created again (including defined functions etc).

If you have a specific type of item you are placing super specifically (setSubtileOffset) you may need to redefine those objects to not use minimal save state. It's probably a bad idea to just turn this off on everything though - as the save files would be massive.
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
Granamir
Posts: 202
Joined: Wed Jan 07, 2015 7:19 pm

Re: initial settings unusual issue

Post by Granamir »

Thank you John.
I used subtile offset and world position Y a lot of times...
So if the only solution is to redefine those objects... ...
is there an easy way to know if an object has or not minimal save state true? except opening all asset pack lua files and reading it directly in object code?

... i feel like tired of building my dungeon.
User avatar
JohnWordsworth
Posts: 1397
Joined: Fri Sep 14, 2012 4:19 pm
Location: Devon, United Kingdom
Contact:

Re: initial settings unusual issue

Post by JohnWordsworth »

There is an easy solution to list all assets with this as true, but I will need to be on my home PC to test it out! Will try to do so tomorrow night when I get home. The same solution could be used to just provide a list of all assets you want to change this property for without having to manually redefine each one separately.
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
Granamir
Posts: 202
Joined: Wed Jan 07, 2015 7:19 pm

Re: initial settings unusual issue

Post by Granamir »

Thank you John.
Only solution i know for now is using a tex editor and make him find and replace any 'minimalsavestate=false', but unless u want to change every object in the game is hard to use for just some object u need.
Post Reply