Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: LoneKnight on August 03, 2011, 03:11:17 pm

Title: Events that carry across a campaign
Post by: LoneKnight on August 03, 2011, 03:11:17 pm
I'm aware that events that occur in a campaign can branch to different levels, but I was wondering if events can branch WITHIN multiple levels.

Ex. In Mission 1 I have an opportunity to save Beta wing. If I save Beta wing, the wing will appear in corresponding levels. Otherwise I can just have them set to never arrive.

Is such a thing possible? Sorry if it's already been discussed, I already ran a few searches through the forum and looked through various event conditions but couldn't find anything myself.
Title: Re: Events that carry across a campaign
Post by: mjn.mixael on August 03, 2011, 03:17:08 pm
That's definitely possible by using campaign persistent variables.
Title: Re: Events that carry across a campaign
Post by: LoneKnight on August 03, 2011, 03:28:11 pm
Aha! *dives in to wiki and testing*

Just figured out how to log that variable. My only question is how do I call or pull in the information for said variable?

I'm assuming I have to do a check for if the value I assigned the variable is = to the value I want, using "variable-array-get" it then does whatever actions I want. Correct?
Title: Re: Events that carry across a campaign
Post by: mjn.mixael on August 03, 2011, 03:57:03 pm
Cake.

I assume by 'log' you mean you figured out how to create a variable. (right click > create variable) For the purpose of this example we'll name the variable 'BetaStatus' and it will be an integer (as opposed to a string). It's initial value should be 0. Make sure it is campaign persistent.

Mission A:

When

This will set it up so that if Beta is destroyed, BetaStatus will be set to 1, otherwise it is 0.

Mission B:

When

Note: You'll need to "create" the campaign persistent variable in each mission as you FRED, but if it has the same name, FSO will figure it out. For Mission B, the argument could be in the arrival cue for Beta wing.
Title: Re: Events that carry across a campaign
Post by: Droid803 on August 03, 2011, 04:09:33 pm
or you could use is-previous-event-true/false :P
Title: Re: Events that carry across a campaign
Post by: mjn.mixael on August 03, 2011, 04:19:45 pm
I guess I'm just partial to variables.. I feel like they have a little more freedom.
Title: Re: Events that carry across a campaign
Post by: Droid803 on August 03, 2011, 04:27:35 pm
That they do, but for passing a boolean true/false, you might as well use previous-even-true and save yourself a variable slot.
That is, if you plan on using 99 variables in a single mission XD
Title: Re: Events that carry across a campaign
Post by: LoneKnight on August 03, 2011, 05:10:10 pm
Mission A:

When
  • is-destroyed-delay
    • Beta
    • 0
  • modify-variable
    • BetaStatus (right click > replace variable)
    • 1

It should be pointed out that when you choose modify-variable, this is through Replace Operator \ Change \ modify-variable. Choosing modify-variable  from the first drop-down will modify the variable as a whole, not just as a result.

EDIT: Also just found that you can also use this to make briefings that refer to events that could have occurred in previous missions. Woot!
Title: Re: Events that carry across a campaign
Post by: mjn.mixael on August 03, 2011, 05:25:52 pm
Sorry.. I wrote all that from memory..

But yes, variables are TEH WIN. Get comfortable with them and you can do amazing things.
Title: Re: Events that carry across a campaign
Post by: Scotty on August 03, 2011, 05:36:29 pm
In this case, is-previous-event-true/false is a much simpler solution.  You don't have to modify any variables, and the value is unimportant.  For booleans, if you can do it without variables, do it without variables.
Title: Re: Events that carry across a campaign
Post by: mjn.mixael on August 03, 2011, 06:54:54 pm
Suppose so.. of course with the variable and a complicated event you could record how many survived too. If you wanted to get REAL crazy you could record hull percentages in more variables..
Title: Re: Events that carry across a campaign
Post by: The E on August 04, 2011, 05:31:37 am
I should note that nightly builds have increased the number of available variable slots to 250.