Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: Doko on February 05, 2011, 04:47:03 pm

Title: AI Wing escorts question
Post by: Doko on February 05, 2011, 04:47:03 pm
I'm almost done with an escort mission and after nearly going insane trying to figure out how to do proper escorts for a shivan bomber wing I decided to go with the following. Unfortunately it seems rubbish and I can't expand the method for further waves. Help would be appreciated

- Fighter wing = taurus
- Bomber wing = gemini

The entrance queue for taurus is the following

(http://www.hard-light.net/forums/index.php?action=dlattach;topic=74385.0;attach=15314;image)

Just to clarify. My goal is for every time a wave of bombers arrives for their escort wing to arrive as well using near ship spawning point. Should i just scratch the idea and make a wing of fighters and bombers and just give them individual orders?

[attachment deleted by ninja]
Title: Re: AI Wing escorts question
Post by: General Battuta on February 05, 2011, 04:59:09 pm
This is tricky to do because if the escort wing isn't totally destroyed when new bombers warp in, a new escort wing won't warp in as well.

What I'd do is just have a new fighter escort wing for each wave of bombers. Have the first escort wing's arrival cue be set to Gemini 1, the next to Gemini 4 (assuming it's a 3-ship bomber wing), the next to Gemini 7...so on.
Title: Re: AI Wing escorts question
Post by: FUBAR-BDHR on February 05, 2011, 05:31:56 pm
Really the only way to do it the way you had is to use variables and like GB said it's tricky.  Pretty much 2 events.  One that sets the variable to 1 when the wing is supposed to arrive and one that sets it to false when they arrive.  You will probably need to use when-argument has-arrived-delay with a list consisting of the first wing in each wave.  (Gemini 1, Gemini 7, Gemini 13, etc assuming a wing of 6).  That along with num-ships-in-battle for the other operator should do it. 
Title: Re: AI Wing escorts question
Post by: Doko on February 05, 2011, 06:29:06 pm
edited out. 

Found my answer thanks to you guys and this old topic
http://www.hard-light.net/forums/index.php/topic,64500.0.html

I was not aware fred dint care about arguments when you used when-argument over when.

Title: Re: AI Wing escorts question
Post by: FUBAR-BDHR on February 05, 2011, 07:01:58 pm
No make a variable named something like escortarrive with a value of 0.  Set the tarus wing's arrival to escortarrive = 0 and gemini's arrival to escortarrive = 1.  Now in the events editor have an event like this:

when-argument
--in-sequece
---Gemini 1
---Gemini 7
---Gemini 13
---Etc
--and
--- =
----escortarrive
----1
---has-arrived-delay
----whatver delay
----<argument>
--modify-variable
---escortarrive
---1
--invalidate-arguemnt
--<argument>


when-argument
--in-sequece
---Taurus 1
---Taurus 7
---Taurus 13
---Etc
--and
--- =
----escortarrive
----1
---has-arrived-delay
----whatver delay
----<argument>
--modify-variable
---escortarrive
---2
--invalidate-arguemnt
--<argument>

Now you will need another event to make sure that Gemini and Taurus are dead.  Something like this:

When
--and
--- =
----escortarrive
----2
--- =
----num-ships-in-battle
-----Gemmi
-----Taurus
----0
--modify-variable
---escortarrive
---0

So it stars at 0, Gemini arrives it's incremented to 1 which triggers Taurus to arrive and it's set to 2 while those current waves are active.  When the bombers and escorts are destroyed it resets to 0 making Gemini's next wave arrival valid and so on.
Title: Re: AI Wing escorts question
Post by: Doko on February 05, 2011, 08:16:36 pm
Thank you.

That's exactly what i needed.
Title: Re: AI Wing escorts question
Post by: Doko on February 09, 2011, 12:35:00 pm
On a follow up of this. Is it possible to also use an argument not on the list of possible locations?

In the mission I was working on there aren't any other hostiles around so using Near ship -> any hostile worked fine but what if there is more than one?

I was thinking of a work-around if not but I haven't tested it yet.

- when-argument
in-secuence
Gemini 1 4 7
has arrived delay
set-object-position
<name of invisible ship>
+500 <get object X>
gemini
+500 <get object Y>
gemini
+500 <get object Z>
gemeni
invalidate
<argument>

repeat times = waves

And set the arrival point of the waves @ the invisible ship
Title: Re: AI Wing escorts question
Post by: Scotty on February 09, 2011, 01:59:59 pm
At that point, all of the wings have to arrive for the event to fire, it doesn't do it every time they jump in.

That, and I don't think you'll find a Gemini 7 in the ships list if you're using a 3-ship wing for Gemini.
Title: Re: AI Wing escorts question
Post by: General Battuta on February 09, 2011, 02:20:12 pm
At that point, all of the wings have to arrive for the event to fire, it doesn't do it every time they jump in.

That, and I don't think you'll find a Gemini 7 in the ships list if you're using a 3-ship wing for Gemini.

He's using arguments so he can just type it in, he doesn't have to pick it from the ship list. Same trick used to perform FRED operations on ship-created stuff.