Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: Lucika on March 06, 2011, 06:59:51 am

Title: Carry over without red-alert (sorta)
Post by: Lucika on March 06, 2011, 06:59:51 am
I remember something like that being done in FS1 where either the Hope or the Pinnacle would show up, depending if the former survived an earlier engagement or not. However, if I am not mistaken, that mission was neither the follow-up one nor the red alert.

The situation is this: depending if a cruiser survived an engagement in a mission or not, it will show up three or four missions later. Is that possible? Am I supposed to set this up in the campaign editor later on or what is the correct method of doing this?
Title: Re: Carry over without red-alert (sorta)
Post by: TopAce on March 06, 2011, 07:12:40 am
You don't need the campaign editor for this.

Just go to Ship Editor --> Arrival Cues and use is-previous-goal-true or -is-previous-event-true (or *-false). Say, you have a "GTC Polaski destroyed" event in mission 1. If you want the Polaski to appear in mission 3, then the GTC Polaski's arrival cue in mission 3 should look like this:

is-previous-event-false
-mission 1.fs2
-GTC Polaski destroyed

Plus add No Warp Effect and No Arrival Music.
Title: Re: Carry over without red-alert (sorta)
Post by: CommanderDJ on March 06, 2011, 07:13:36 am
Campaign persistent variables. Create a variable called "cruiser_died" or whatever you want, and set it's default value to 0. Make sure the variable is marked as campaign persistent. Create an event that, if the cruiser is destroyed, sets the variable to 1. For example
Code: [Select]
Cruiser Check
-when
--is-destroyed-delay
---0
---*cruiser name*
--modify-variable
---cruiser_died(0)
---1

Now, in the later mission where you want the cruiser to reappear, create a variable with the same name as the first and mark it as campaign persistent also. Default value can be anything, doesnt matter, because the value will carry over from whatever it was set to in the first mission, but just set default value to 0 anyway to be safe. Then, create the cruiser, and in its arrival cue, add
Code: [Select]
-=
--cruiser_died(0)
--0

That way, the ship will only arrive if the variable is equal to zero (plus whatever additional conditions you have set for it). You can use additional variables if you want to store hull integrity and such. Hope this helps.
Title: Re: Carry over without red-alert (sorta)
Post by: Droid803 on March 06, 2011, 12:20:24 pm
A waste of campaign persistent variable slots if you're not going to store the HP or something. Don't bother.

Just use is-previous-event-true/false. Much quicker to set up and less prone to **** up.
Title: Re: Carry over without red-alert (sorta)
Post by: karajorma on March 06, 2011, 06:50:36 pm
Yep. DJ's solution is worth it if you want to actually pass some information over using the variable. But if you're only passing a true/false then it's a waste of a variable (and you only have 100 to play with for each mission remember!).
Title: Re: Carry over without red-alert (sorta)
Post by: headdie on March 07, 2011, 02:50:58 am
but then it easy to use a HP variable in this manner and it would allow you to carry over any hull damage as well, not only that but if it is an optional ship you can set the arrival que to say that if this value is below say 30%then the cruiser still don't arrive
Title: Re: Carry over without red-alert (sorta)
Post by: karajorma on March 07, 2011, 08:52:58 am
Yes, if you're actually passing info over, it's worth it.
Title: Re: Carry over without red-alert (sorta)
Post by: Lucika on March 07, 2011, 06:10:03 pm
:yes: Thank you all.

While we're at it:

Mission 1 -> red-alert -> Mission 2 -> normal -> Mission 3 (which carries over variables)
is it possible to allow the player to replay the previous mission despite this one not being a red-alert one?
Title: Re: Carry over without red-alert (sorta)
Post by: Lucika on March 16, 2011, 04:34:17 pm
Mission 1 -> red-alert -> Mission 2 -> normal -> Mission 3 (which carries over variables)
is it possible to allow the player to replay the previous mission despite this one not being a red-alert one?

:bump:
Title: Re: Carry over without red-alert (sorta)
Post by: The E on March 16, 2011, 04:44:02 pm
With a properly set up campaign file, yes. Note that you'll have to set up the campaign file manually, as the campaign editor UI isn't set up to support links going backwards.
Title: Re: Carry over without red-alert (sorta)
Post by: Lucika on March 16, 2011, 04:48:43 pm
...and how would the player see that? I presume there is no special pop-up saying "You can replay the mission before the last mission".
Title: Re: Carry over without red-alert (sorta)
Post by: The E on March 16, 2011, 04:56:16 pm
If I understand you correctly, you want the player to have the option of replaying the mission labeled "2", right?

Basically, what you do is this. If the player is restarting Mission 3 (which you can track through clever use of campaign-persistant variables), you can pop up a training message saying something like "Do you want to replay the mission leading up to this?" If the player answers in the affirmative, you can then set a hidden goal to true, and end-mission right there. Write a debrief saying "To play mission 2, hit the accept button".

Behind the scenes, what you do is to set up the campaign file so that you have one of mission 3's branches go to mission 2 if said hidden goal is true.

(Be aware that this is just something I _think_ should work, not something I have tested. Implement at your own risk)
Title: Re: Carry over without red-alert (sorta)
Post by: Lucika on March 16, 2011, 05:10:13 pm
I see. Thank you, I will test it soon.
Title: Re: Carry over without red-alert (sorta)
Post by: karajorma on March 16, 2011, 06:23:39 pm
You could also use the loop option in the campaign editor to do it. I think that one is probably a little more professional looking.
Title: Re: Carry over without red-alert (sorta)
Post by: Lucika on March 16, 2011, 06:25:24 pm
Can I use that without the missions actually being part of a loop?
Title: Re: Carry over without red-alert (sorta)
Post by: karajorma on March 16, 2011, 10:56:44 pm
You should be able to. Not 100% certain. It's something you'd have to look into.