Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: bolero on March 21, 2006, 02:17:41 pm

Title: Fred help!
Post by: bolero on March 21, 2006, 02:17:41 pm
hey guys, im fairly new to fred but not completly lost.  Its alot of fun.  However i have a few questions as i am stuck.
Im creating a mission where you have 2 friendly ships disabled and must protect them.  After a while command warps in 2 repair ships, for which you must protect those as well.  How ever, if any one of those ships (the 2 friendlies and the 2 repair) get destroyed, mission is over and you must return to base.  How would i go about scripting that?  im going to fiddle with it now but any help would be great!

-Bolero
Title: Re: Fred help!
Post by: Shade on March 21, 2006, 02:32:43 pm
Something like this should work (Requires SCP for new sexps):

op when-argument
     op any-of
          ship_1
          ship_2
          ship_3
          ship_4
     op is-destroyed-delay
          0
          <argument>
     op do-nothing (or whatever you might want to happen such as messages etc.)

[chained, with RTB directive text]
op when
     op has-departed-delay
          0
          player_ship
     op do-nothing
Title: Re: Fred help!
Post by: Petrarch of the VBB on March 21, 2006, 04:22:15 pm
There's an any-of sexp now?

*punches the air*
Woo!
Title: Re: Fred help!
Post by: Polpolion on March 21, 2006, 04:43:39 pm
:welcome:

Can't belive no one did this...


Ok, the little paragraph I think is like this:

Welcome to the HLP station. There are exits to the left and right. THere are flamethrowers under the seats, but we ran out of napalm so they are filled with water instead. There are also plasma cannons in a locker, but only some people can get them.
I forget the rest...


Title: Re: Fred help!
Post by: karajorma on March 21, 2006, 07:39:56 pm
Shade's solution is correct but personally I probably wouldn't use any-of for this one. I'd do it like this

When
-Percentage-ships-destroyed
--1
--ship_1
--ship_2
--ship_3
--ship_4
-do-nothing

There's nothing actually wrong with Shade's solution and I'm pleased as hell to see people using the new conditionals but this one doesn't use as many SEXP nodes. :D

It also has the advantage of working in retail :)


@Petrarch : There are also every-of, number-of and random-of SEXPs and I added a new one to the set today called in-sequence which allows you to work your way down a list.
Title: Re: Fred help!
Post by: bolero on March 21, 2006, 11:02:27 pm
Wow thanks guys. I tried shades way and it worked great.
-Bolero
Title: Re: Fred help!
Post by: Nuclear1 on March 22, 2006, 02:33:32 pm
When
-Percentage-ships-destroyed
--1
--ship_1
--ship_2
--ship_3
--ship_4
-do-nothing

That works, too, but when I saw this initially I thought of using variables. Your answer's the quickest and easiest though. :)
Title: Re: Fred help!
Post by: bolero on March 22, 2006, 05:55:45 pm
another question guys, hopefully this gets noticed.  Its a question with the compaign editor.  Anyways ill basicaly sum up what i want to do with one o the missions im doing.  Basicaly, you get thrown out of subspace and end up lost in a nebulea and find two disabled ships that require your help, so this wasnt really part of commands orders, but you help them anyways and then return to command.  However since this wasnot a missionfrom command, and not critical if you fail i want two possible paths to go.  For instance, if you sucesfully defend the ships your next mission will have these ships in there. how ever if you fail to defend those ships, the next mission you go to will not have them in there.  Either way you cant fail the mission per say, you will always be able to go on, but the outcome will be different for the nextmission.  I know i would have to make 2 different versions of the same mission, but im just wondering if it is able to set this up in the compaign editor?
hopefully you all understand lol Thanks for your help!

-Bolero
Title: Re: Fred help!
Post by: karajorma on March 22, 2006, 06:09:45 pm
First up there are several ways you can avoid making two different missions. You may find it easier to do things that way depending on how complex the mission is but that's your choice :)

You can

a) Set a persistant variable and then check it's value in the next mission. (Look in the FRED section of my FAQ if you don't know what a persistant variable is).
b) use the is-previous-event\goal-true\false SEXPs to check whether the ships in the previous mission were saved or not.

If you do decide to go with two different versions then that is fairly simple too. Simply do something like this.

is-previous-goal-true
-Mission 1
-Ships Saved
-Mission 2a

true
mission2b

Now if the ships are saved and the save ships goal comes true you go to mission 2a. Otherwise you go to mission 2b.
Title: Re: Fred help!
Post by: bolero on March 22, 2006, 08:33:06 pm
Thanks for the reply :)

However i seem to be confused how the is-previous-goal-true event will work for this situation.  Would i add this event in the mission where your saving the ships, or in the 2 possible missions after that?

thanks again :)

-Bolero
Title: Re: Fred help!
Post by: karajorma on March 23, 2006, 01:52:59 am
You could use the is-previous-goal-true in the campaign editor when connected the two missions together if you wanted to have two different missions.

 You could also use it in the second mission. If you set the arrival cue for the two cruisers to something using is-previous-goal-true then they will only appear in the mission if the were saved in the previous one.
Title: Re: Fred help!
Post by: bolero on March 23, 2006, 10:26:54 am
whoa wow that is cool, ill try these methods out! Thanks alot!
-Bolero
Title: Re: Fred help!
Post by: Shade on March 23, 2006, 11:44:22 am
For best effect, also store the hull integrity of the ships in a persistant variable just as the mission terminates and then set them to the proper value in the following mission. After all, ships don't magically mend all damage in the space of 10 minutes just because they made a subspace jump ;) Poor man's Red Alert really, just without the red alert.
Title: Re: Fred help!
Post by: bolero on March 23, 2006, 03:21:46 pm
oh yeah i didnt know you could do that.  So You can take the Hull integrity of ships from a mission into the next? because i have a mission where you dont return to base at all, you just get dropped out of subspace to another mission so that would be cool having alpha wings last hull % into the next mission. Hmm ill have to try and figure that out too! Wow this is so cool.

-bolero
Title: Re: Fred help!
Post by: karajorma on March 23, 2006, 03:55:26 pm
If you want to have Alpha 1 just drop out of subspace you should do it via a red alert mission so that the condition of the players subsystems and weapon quantities remain the same. Those things can all be set by SEXPs but it's a bit of a pain to do all of them.
Title: Re: Fred help!
Post by: bolero on March 24, 2006, 12:49:25 am
Hey guys iv encouirted some weird bug in my campaign/missions.  Anyways, the one mission you play in, you are INSIDE subspace. Once you leave subspace it goes to the next mission which is checked off as a "red alert" mission, so it just drops you right out there so like Karajorma said; will have the condition of the player brought to the red alert mission.  Once you start the mission though, The player and Alpha wing are suddenly different class ships with different weapons and im not sure why? Any ideas?
Thanks!

-Bolero
Title: Re: Fred help!
Post by: karajorma on March 24, 2006, 03:40:39 am
Did you tick the red alert carry status box in the first mission for any ships you want to appear in both missions? If not that's my bad. Should have warned you to do that :) You'll find it in ships editor >> Misc.
Title: Re: Fred help!
Post by: bolero on March 24, 2006, 01:10:29 pm
Hey thanks, that worked, however, now the players status doesnt carry over.   I set "red alert carry status" on my alpha wing and the players ship in the mission before the red alert mission, however the status doesnt get carried over.  Not sure whats going on

-Bolero