Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: bomb3rman on December 13, 2019, 06:46:29 am

Title: Splitting campaign and transfering variables
Post by: bomb3rman on December 13, 2019, 06:46:29 am
Hey guys, due to time shortage my plans of releasing a campaign have been interrupted... But I think I'm at the right point in the campaign to split it into two different parts (~ 20 missions are done and there's even some kind of Cliffhanger...).

Iirc, with one of the last updates, a new kind of variable was introduced that let's you carry over the information of variables from one campaign to another. So am I right if I just need to copy via Sexp all the information (money available, ships, ammunition available and weapons gathered) during the campaign into these new variables, so they can be used by the pilot profile when starting the 2nd part later on?

I hope you get what I'm talking about... Since the time shortage won't go away any time soon, it would be a shame to just let these missions rot on the hdd... The story works well until here and all the missions are nearly complete.

Greatings!
Title: Re: Splitting campaign and transfering variables
Post by: wookieejedi on December 13, 2019, 08:15:13 am
Yes that is correct. In the variable dialog box there is a check box for eternal variables, which will carry between campaigns.
Title: Re: Splitting campaign and transfering variables
Post by: Nightmare on December 13, 2019, 08:26:44 am
Wouldn't it be possible to save them as txts too? I think quite many use the 1-player-per-campaign rule, so it's quite likely that the progress won't be available if the rest will be released a couple years later.
Title: Re: Splitting campaign and transfering variables
Post by: wookieejedi on December 13, 2019, 09:08:59 am
It's certainly possible to save as text (I've used that method before), but that requires a good amount of scripting knowledge and I wouldn't recommend that for this situation. I would imagine the player could just play through the first release again once the second release comes out.  :) 
Title: Re: Splitting campaign and transfering variables
Post by: Nightmare on December 13, 2019, 09:19:11 am
Sure (and I'm 90+% sure that this would be the best way to go).

Wouldn't it be possible to safe the stats via the checkpoint-script, than load them from another mission?
Title: Re: Splitting campaign and transfering variables
Post by: wookieejedi on December 13, 2019, 12:40:17 pm
Sure (and I'm 90+% sure that this would be the best way to go).

Wouldn't it be possible to safe the stats via the checkpoint-script, than load them from another mission?

Yeah, that could certainly be another route too, since the check-point script writes it's own save file :)
Title: Re: Splitting campaign and transfering variables
Post by: 0rph3u5 on December 13, 2019, 04:10:53 pm
Iirc, with one of the last updates, a new kind of variable was introduced that let's you carry over the information of variables from one campaign to another.

The feature existed since retail but the original descriptors were a bit misleading - the rework made it 99 percent more usable (give eternal thanks to the great Coder Gods of the SCP for that).

Note that any given mission can only referrence 258 (please verify) variables total - and I don't know what you are doing but I have noticed them piling up like crazy in campaigns with persistence :)

And there is a limit on the number of eternal variables, which I don't recall...
Title: Re: Splitting campaign and transfering variables
Post by: karajorma on December 14, 2019, 03:27:23 am
I would strongly advise prefixing any eternal variables with the initials for your campaign. That way you don't get a situation where, for instance, a Blue Planet Hull-Strength variable gets overwritten by one from Between the Ashes.
Title: Re: Splitting campaign and transfering variables
Post by: bomb3rman on December 15, 2019, 06:06:57 am
@0rph3u5

I think this won't be a problem since there are only around 50 variables until now....

@karajorma

The variables have their own names, so there won't be any kind of collision I guess...

But this sounds all very encouraging, thx for the replies. So expect the launch of my stuff around January, I guess  ;7
Title: Re: Splitting campaign and transfering variables
Post by: Cyborg17 on December 15, 2019, 09:32:28 am
Just as a note, having separate pilots for separate campaigns or mods is no longer necessary since campaigns have independent saves now.  I just played through Diaspora, a Total Conversion, with the pilot I use for every other campaign.
Title: Re: Splitting campaign and transfering variables
Post by: Nightmare on December 15, 2019, 10:49:55 am
Oh that's certainly nice. I actually already did before the new pilot code came, with err, bad results. :warp:
Title: Re: Splitting campaign and transfering variables
Post by: AdmiralRalwood on December 17, 2019, 11:32:54 am
Iirc, with one of the last updates, a new kind of variable was introduced that let's you carry over the information of variables from one campaign to another.

The feature existed since retail but the original descriptors were a bit misleading - the rework made it 99 percent more usable (give eternal thanks to the great Coder Gods of the SCP for that).
Misleading descriptors I'll grant you, but it's not so much it existed since retail as everyone thought it existed since retail, because of the aforementioned misleading descriptors; no matter where the variable was stored, there was no way to share it between two campaigns. The fact that you eventually could in FSO was technically a bug.
Title: Re: Splitting campaign and transfering variables
Post by: karajorma on December 21, 2019, 09:22:02 pm
Well persistence itself is an SCP feature not a retail one. But it's a very old SCP feature. So it had been around a long time before the bug occurred.