Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: IPAndrews on July 23, 2008, 10:49:22 am

Title: Detecting destroyed wings with waves launching from carriers
Post by: IPAndrews on July 23, 2008, 10:49:22 am
The problem:

You have a wing called "Wing" which consists of 1 fighter (yes I know it's dumb but it's just an example case). That wing has 6 waves. It launches from a carrier ship called "Carrier".

How do you detect that the wing has been dealt with (destroyed/departed/can no longer affect the mission) when there is the potential for the carrier to be destroyed before all of the waves of the wing are launched?

Existing code:

This is what I have at the moment.
------------------------------------------------------------
event called "wing destroyed"
when-argument
   every-of
        Wing 1
        Wing 2
        Wing 3
        Wing 4
        Wing 5
        Wing 6
or
     and
           has-arrived <argument>
           is-departed-or-destroyed <argument>
     and
           not
                 has-arrived <argument>
           or
                 is-subsystem-destroyed
                      "Carrier"
                      "fighterbay"
                 is-destroyed-or-departed
                       "Carrier"
--------------------------------------------------

My question. Can anyone come up with something less bloated that achieves the same thing?
Title: Re: Detecting destroyed wings with waves launching from carriers
Post by: Al Tarket on July 23, 2008, 11:07:23 am
i have wondered the same thing, ive had to compromise my 1st campaign a few times before it was destroyed. everytime i want to get some fighters out their i have to have them launched as asson as the mission starts.

take for example the PVN Pinnacle which launched the Elimini wing and Takami wing. their are supposed to be 4 waves each but the objective was destroyed and the pinnacle warps out leaving 2 waves missing and hence the objective remains uncompleted. the only way around it is by putting them from ship dock to warp in.
Title: Re: Detecting destroyed wings with waves launching from carriers
Post by: Black Wolf on July 23, 2008, 11:18:33 am
Maybe use destroyed-or-departed-delay and every-of sexps to modify variables? When every ship in wing one is destroyed or departed, add ne to "Wings-gone" variable. When Wings-gone > 5, all the ships are dead, or flick the variable up to seven when the carrier is destroyed and 8 when the fighterbay is destroyed?

I think. Though It's kind of hard to understand exactly what you want.
Title: Re: Detecting destroyed wings with waves launching from carriers
Post by: IPAndrews on July 23, 2008, 11:28:08 am
I think. Though It's kind of hard to understand exactly what you want.[/bw]

Some smaller code that achieves the same thing that's all :). The counters idea is a good one. It will be interesting to see if the counter variable version is as compact as the complex logic version above. Anybody want to post some code?
Title: Re: Detecting destroyed wings with waves launching from carriers
Post by: FUBAR-BDHR on July 23, 2008, 01:56:11 pm
I believe you can just use destroyed-or-departed-delay and the wing name.  I think that sexp takes into account the remaining wings not being able to arrive and returns true.