Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: LoneKnight on August 31, 2011, 11:30:15 am

Title: Issues with Campaign-Persistant Variables
Post by: LoneKnight on August 31, 2011, 11:30:15 am
I've been trying to set up several campaign-persistent variables, but I'm having some issues. I create the variable just like any other, and label it as a Campaign variable. Yet I cannot access it in any other missions or in the campaign editor. Am I supposed to "Add Variable" again and simply name it the exact same and give it the same number in the different mission, or is it supposed to show up?
Title: Re: Issues with Campaign-Persistant Variables
Post by: Axem on August 31, 2011, 11:32:58 am
You need to make the variable again in your mission and call it a campaign variable again. FRED can't keep track of which missions are in a "campaign". To FRED, everything is just a single mission.
Title: Re: Issues with Campaign-Persistant Variables
Post by: LoneKnight on August 31, 2011, 11:50:31 am
So this is what I have to test the variables across the campaign.

I'm getting an error that "Mission Test.FS2 last branch isn't set to true."

This is what it looks like currently:

(http://img6.imageshack.us/img6/4995/branchh.jpg)

How do I go about fixing this error without breaking the current SEXP using the variables?
Title: Re: Issues with Campaign-Persistant Variables
Post by: Axem on August 31, 2011, 11:56:20 am
In the campaign editor, the last branch must always be true. Freespace will look at your mission branches from the top and go down. If it finds a branch that it can pass, the campaign will go to that mission. So making the last branch true basically says "If none of the above then..." Typically the last branch is "repeat mission when true". Basically if none of the pass conditions worked, then we need to repeat the mission.
Title: Re: Issues with Campaign-Persistant Variables
Post by: LoneKnight on August 31, 2011, 12:31:34 pm
Campaign editor doesn't seem to like variables too much. It actually removes variables that I add to it.
Title: Re: Issues with Campaign-Persistant Variables
Post by: karajorma on August 31, 2011, 11:37:38 pm
You can't use variables in the campaign editor since variables are a mission feature even when campaign persistent. If you added a variable FS2 would have no idea where to take it from.
Title: Re: Issues with Campaign-Persistant Variables
Post by: Droid803 on September 01, 2011, 01:50:27 am
just add an event that triggers at the end of a mission that checks for the value of the variable, and then use is-previous-event-true/false for that.