How to save game into global variable
Moderator: Forum Moderators
- ZombieKnight
- Posts: 250
- Joined: June 27th, 2022, 2:26 pm
- Location: Czech Republic
How to save game into global variable
Hi
How should I save game into global variable in a way I can load it using WML/Lua API?
Maybe I could copy/reproduce code for saving and loading regular savefiles?
Thanks (in advance, becouse I may forget to thank later ^^)
How should I save game into global variable in a way I can load it using WML/Lua API?
Maybe I could copy/reproduce code for saving and loading regular savefiles?
Thanks (in advance, becouse I may forget to thank later ^^)
I had saurian in profile before, but I've merged my discord profile with forum one...
Working on campaign Bandits from Brown Hills
Working on campaign Bandits from Brown Hills
Re: How to save game into global variable
You can look into wesnoth.game_events.on_save.
- Celtic_Minstrel
- Developer
- Posts: 2274
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: How to save game into global variable
There is probably no way to save the entire game with all the information of a real saved game. You might be able to get close by writing
wesnoth.scenario.__cfg
(if that exists, didn't check) and also dumping every unit and maybe a few other things.Nope! It's written in C++ and there's no way for you to get at it unless you build a custom version of the game. In principle I guess you could reimplement the whole thing in Lua, but that's only assuming all that data is available to Lua, which is probably not the case. (I'm pretty sure at least stats can't be read from Lua.)ZombieKnight wrote: ↑May 3rd, 2024, 7:07 pm Maybe I could copy/reproduce code for saving and loading regular savefiles?
- ZombieKnight
- Posts: 250
- Joined: June 27th, 2022, 2:26 pm
- Location: Czech Republic
Re: How to save game into global variable
I thought of a way saving wml table, and then map data...
And that should be enought
And that should be enought
I had saurian in profile before, but I've merged my discord profile with forum one...
Working on campaign Bandits from Brown Hills
Working on campaign Bandits from Brown Hills