Saving variables

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
User avatar
Frenchie
Posts: 219
Joined: Wed Oct 16, 2013 2:50 am

Saving variables

Post by Frenchie »

Can someone make a standard script to save some variables and the party state? A savegame is 2 MB in size, but how big will this 'save' become? Goal is to have a reset back to the start of a dungeon without using the load/save options of the game. It could also be used if you work in turns with 2 parties.

Some variables:
10 variables x 4 letters x 1 byte value = 40 bytes

For 1 champion:
Inventory has 32 slots x 2 bytes = 64 bytes
Stats has 10 x 2 bytes + exp x 4 bytes = 24 bytes
Skills has 16 x 3 bits ( = 8 bytes ) + unused skill points = 9 bytes
Traits 24 x 1 bit = 3 bytes
Total = 100 bytes x 4 champions = 400 bytes

Custum dungeon level:
32 x 32 squares ( = 1024 squares ) would possible have 24 or so switches x 1 bit = 3 bytes

Estimated save size : 443 bytes ( about 25% of 2 MB )

So, with the above data can someone make a 'save' and 'restore' script?

Edit : with 'save' I mean storing data to much smaller file than a savegame
Last edited by Frenchie on Mon Feb 02, 2015 4:46 am, edited 1 time in total.
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Saving variables

Post by minmay »

I think you are very confused about what a Grimrock mod can do. You cannot write arbitrary data to memory like that.

You cannot store the state of GameObjects because the scripting interface cannot access all of their state information.

I already explained to you how to do the specific case of "reset back to the start of a dungeon" in another thread, but I guess you decided to ignore it.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
User avatar
Frenchie
Posts: 219
Joined: Wed Oct 16, 2013 2:50 am

Re: Saving variables

Post by Frenchie »

No need to be rude. Just because it comes natural to you it gives me a headache and I didn't understand any of it. If you dislike being helpful to me just ignore me!
Post Reply