Data \ leveldata \ campaign \ <CampaignName>.campaign

Normally the singleplayer game proceeds from one mission to the next, based on the table in this Lua file.

Can anyone think of a way to get the game to load missions in any order?

The player fleet needs to remain persistent between missions. I.e. if you build a scout it should appear in your fleet when you load subsequent missions.


Can anyone think of a way to get the game to load missions in any order?

To view all mission in one campaign :
In Name.campaign

displayName = “Missions”
– 2 = Extra
contentType = 2
contentName = "Name"
contentOrdered = 0 – 0 = View all mission in one campaign / 1 = View only mission complete by player.
contentChooseText = "Name of Campaign"
contentThumbName = "Name"
contentThumbDesc = "Desc"
contentSort = 0.5 – Default is 1.0, so 0.5 will appear before others.
contentRules = "singleplayer"
ExtFilter = “name_campaign,campaign_name” – etc …

The player fleet needs to remain persistent between missions. I.e. if you build a scout it should appear in your fleet when you load subsequent missions.

When the mission is ended, game saves automatically the fleet, and when the next mission is loading, if you have SobGroup_LoadPersistantData(’‘ShipType’’) in your next mission, game load this persistx.lua file locate in profiles folder. If you don’t have ANY persist file, when players play mission 5 before complete mission 4, you need to make persist file into a campaign folder.

Follow this way :
In Name.campaign :
Use this line into the mission need to have persist file in case of player don’t have play previous mission,

usepersist = “data:leveldata//campaign//Name//Mission_0X//startingplayerfleet.lua”,
usedefaultpersist = 1,

In this startingplayerfleet.lua, you can use the structure of persist file, and add ship you want or you think player needle at the beginning of this mission (include RU’s / Research).
This file has automatically bypassed by the persistx.lua file, generate with previous mission.

Player don’t play mission X, and play mission X + 1 > load of startingplayerfleet.lua ;
Player play mission X, and play mission X + 1 > load of persistx.lua ;

If I was able to help. :wink: And if I understood well.

I am very sorry, but I cannot fully understand your post. I think there is an English language problem.

Also, I would like to clarify: I want to be able to visit and repeat my visit of all missions in any order, so that I travel North, East, South and West in the galaxy. I have explained it better here:

But this mod is for Homeworld 2. Is this possible?

I need to be able to use the .campaign file to do this because the alternative solution (writing the position in space to a file) fails when loading from a save slot.



I guess this is a duplicate of my previous thread. Sorry. :frowning:

I think we need @BitVenom to answer this. Because between HW2C and HWRM, we have see lot of change :slight_smile:

He is asking if there is a way to load missions randomized in a non linear order while also saving the stats & values of the fleet from random mission to random mission. (Ships the player owns at an end of any mission.)

This is a non-linear campaign script I developed for HW2C years ago, check it out if helpful.

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’.

1 Like

Care to elaborate ? When you have time of course :wink:

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.


the mission table has two element at first, others are just outside the table, like this:

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[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.