Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: Erebus Alpha on August 02, 2017, 04:34:52 am

Title: How to make a Capship chase a Fighter?
Post by: Erebus Alpha on August 02, 2017, 04:34:52 am
So, I have a mission where I need to make a capital ship chase fighters. Add-goal and ai-chase did not seem to work when I gave it Alpha wing as a target.

Alpha wing does follow a nonrandom course. It's a bit like that mission in retail FS2 where you follow Zeta 1 around on patrol through the nebula. In this mission, the player gets to experience the joy of running into a capship. The thing is, this capship has no other capship targets to go and harass. It's just Alpha wing vs. this really big and mean ship, plus its fighter escort.

How do I make a corvette turn toward a fighter & use its engines?

Because there is fighter-on-fighter combat going on too, the movement of the fight is going to be somewhat unpredictable. To my knowledge, navpoints will not work well at persistently aiming a corvette at Alpha wing, so that its multitude of turrets presents a (somewhat) persistent danger.

Has anyone attempted to do this? I would rather not have to make special PD guns with extremely long range, for this mission only, just to make sure the corvette remains a relevant combatant until alpha wing forces it to retreat.
Title: Re: How to make a Capship chase a Fighter?
Post by: JSRNerdo on August 02, 2017, 04:50:34 am
If you want it chasing all of alpha wing what you can probably do is use dynamic waypoints and math arithmetic to get the midpoint of all alpha wing ships assuming theyre all in a rough formation or close together

Maybe is in box linked to ship maneuvers to make it point AAA beams and flaks at the player to make it even more evil
Title: Re: How to make a Capship chase a Fighter?
Post by: Homura on August 02, 2017, 06:06:09 am
Why not let the Capship chase only Alpha 1 or Alpha 2?

Alternative you can let an invisible fighter chase Alpha wing and the Capship the invisible fighter.
Title: Re: How to make a Capship chase a Fighter?
Post by: Erebus Alpha on August 02, 2017, 08:46:16 am
Feeding the corvette an add-goal SEXP does not seem to work correctly. Ai-chase, whether the chase-target is friendly or hostile, fails to make the corvette move from its initial position. Ai-stay-near-ship at least does get the corvette to move - directly away from the target it is supposed to be staying near.

Chasing just Alpha 2 would be somewhat acceptable. How would I go about adding a dynamic waypoint? Alpha 2 is flying a special fighter, and the mission will fail if that fighter is destroyed. Everyone in Alpha wing has a great reason to not let it die.

If the mission becomes too difficult as a function of the corvette always homing in after Alpha 2, I can always add a fourth Alpha wing pilot in a heavy fighter, or let the player have some heavy anti-subsystem weapons for anti-turret duty.
Title: Re: How to make a Capship chase a Fighter?
Post by: General Battuta on August 02, 2017, 08:57:48 am
Dynamic waypoint

Just use an event that sets the waypoint's position to Alpha 2's position, with a 9999999999999999 repeat count
Title: Re: How to make a Capship chase a Fighter?
Post by: AdmiralRalwood on August 02, 2017, 06:13:23 pm
9999999999999999 repeat count
or -1, which is much simpler
Title: Re: How to make a Capship chase a Fighter?
Post by: Erebus Alpha on August 03, 2017, 04:28:08 am
The add-nav-ship SEXP does not appear to work properly, even when its repeat count is set very high. The corvette appears to grab Alpha 2's position at the start of the mission, instead of continuously updating the waypoint as the SEXP says it is supposed to do.

Should I be using every-time instead of when? Or should I be using a SEXP other than add-nav-ship?
Title: Re: How to make a Capship chase a Fighter?
Post by: AdmiralRalwood on August 03, 2017, 06:52:06 am
Or should I be using a SEXP other than add-nav-ship?
You very much should. Navpoints and waypoints are actually two separate things, and navpoints are (AFAIK) used solely by the autopilot code (think Wing Commander rather than giving the AI control over the player's ship). What you want to do is create a waypoint (directly as an in-mission object in FRED, like you were placing a ship), call the path something like "Alpha chase waypoint" (or whatever will help you remember what it's for), give your capital ship a goal to follow that waypoint, and then your infinitely repeating SEXP is just using set-object-position on that waypoint to give it the same position as whatever fighter you want the capital ship to chase after.
Title: Re: How to make a Capship chase a Fighter?
Post by: Erebus Alpha on August 03, 2017, 05:47:45 pm
Works significantly better, my corvette now properly chases fighters!