Wow, you do a lot of writing to disk!
What do you do to ascension.campaign? Do you add new items to the Mission table? Or do you just keep the first one or two items?
Wow, you do a lot of writing to disk!
What do you do to ascension.campaign? Do you add new items to the Mission table? Or do you just keep the first one or two items?
The table elements are pre-written, and added into Mission table when player make choice.
Do you overwrite the existing table entry, or do you insert the element at the end of the table to make the table larger?
Where is this stored? The actual campaign file?
If so this doesnāt work with RM after the patch - the ONLY place you can read/write in LUA from (aside from executing pre-existing LUA files) - is the current userās Profile folder.
Coming up with a way to do ānon linearā or even auto/programmatically generated campaigns is something Iām happy to explore, maybe for a future patchā¦
Actually - now that I think about itā¦
I know how to do pretty much exactly what you want, including some crazy stuff⦠even in the upcoming patch. Heck, you could even generate a āmapā (like, an ASCII image) that you store in the userās profile. Then, in the campaign file, it has only a single mission - but after that mission is declared in the campaign, it reads this file from the profile folder, which says 'hereās a map, we are at X,Y", and based on what is there, loads a specific map (one generic, or a small palette of them, etc).
Once the game starts, it populates the map as needed (and you can change the background and stuff from lua) - and when loading a save, the mapās internal state says āwe were at X,Yā - so if you win or decide to leave, itāll update the X,Y in the playerās profile, and continue.
Lots of details to lock down - but I think itād work fairy well actually. With a bit of effort you could even make a custom campaign button that loaded and displayed that map, where youād been, enabling clicks for where you want to go, etc⦠The UI handling would just update the userās XY data in the profile, and load the base mission again - causing it to ājumpā.
Care to elaborate ? When you have time of course 
Issue #1 Iāve been having is that when you complete whatever the game considers to be the last mission, the game automatically kicks you to the main menu. However, if the campaign is really supposed to be non-linear, then a hard cap of this kind doesnāt make much sense. What I did to work around this was to make the Mission table in āascension.campaignā very very large, and filling it with lots of dummy missions. Not sure what the side effects of this might be.
Issue #2 is save games. I tested them, and they work mostly. The nondetermchunk stuff in the level file gets messed up, though. For example, when reloading a saved game, the level background image or music may be the wrong one for the map.
[edited]
the mission table has two element at first, others are just outside the table, like this:
MAP1=ā¦,
MAP2=ā¦,
ā¦
Mission={}
Mission[1]=MAP1
Mission[2]=MAP0ādosenāt matter what this is, just be here so the game wonāt jump to the main menu
then we read a file from profile folder to redefine mission table (empty at first of course).
now, player is at mission 1, finished his business, and decided to jump to MAPX, so mission completed, the script write new data into that file to arrange mission table like this:
Mission[1]=MAP1
Mission[2]=MAPX
Mission[3]=MAP0āstill here because player is at mission2 now
basically this is how it works, the only problem I can see is that your mission table will get bigger and bigger.
And if you donāt need persist fleet, then I suggest you use Restart rather than Complete, then you only need 1 element in mission table, exactly what I did in the Trading Mode, and you should really check it out.
Have you tested creating/loading save games? Does everything work?
I use my own saving system in the Trading Mode. Too many UI things that canāt be recorded by the game, and I use [restart] to load the new map so persist fleet is also useless to me.
Like what for example ?
Custom UI, the Trading Mode use A LOT of them
yes, but when you say ācanāt be recorded by the gameā, you meant by the normal way I suppose ? You can still use the write/read methods, no ?
yeah, that is what I mean. but without the normal way, I can only use I/O to save when player jumps to another map, because I can then restart the mission with the new map and new data, while saving all data at any other time is impossible.
So you are having basically the same issues I am having.
I think for both of you (because you canāt edit the mission list after the patch) thereās probably a āniceā way to do lots of this - and support save-game data, etcā¦
I just need some downtime to help experiment a bit
And for the next few weeks that is certainly not going to be the caseā¦
Would you need to save some data at another moment (like during the mission for example) ? And if the answer is yes, why canāt you ? You could have a specific rule running from time to time, no ?
I donāt have the issue where the game back to main menu, my mission table is always 1 element larger. not to say that I use another way in Trading Mode: restart the mission rather than complete it.
So my method wonāt work? I mean I write file in profile folder, it worked in HW2C, why canāt edit mission table after this patch?
No, it works fine, at other moment, without the normal way, you canāt save EVERYTHING and restore it, but when player is leaving to another map, you donāt need to. Still, it could be better if I can set control groupsā¦
ok, I understand now.
Concerning the control groups, you can use MainUI_UserEventData( eGroup, x) / MainUI_UserEventData( eSelectGroup, x) (x being the slot number) to set a control group with the current selection / select a control group.
I donāt see how you could āsaveā those between session, though.
wow, never noticed this before, thanks a lot. Use SobGroup_IsInControlGroup and this, I think I can save and reset control groups now.