Author Topic: How to make a Capship chase a Fighter?  (Read 1672 times)

0 Members and 1 Guest are viewing this topic.

How to make a Capship chase a Fighter?
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.
« Last Edit: August 02, 2017, 04:38:41 am by Erebus Alpha »
"Obviously the meson bomb is a form of cat-toast-device, with the buttered toast inverted, so that the cat and toast both fly in the direction of gravity much faster than expected. By introducing artificial gravity, a pair of cat-toast perpetual motion accelerator units can be made to collide with one another, and they produce an unimaginably devastating explosion. Both cats are named 'Meson'."

 - Wikileaks 2383

 

Offline JSRNerdo

  • [`_`]/
  • 29
  • Gone!
Re: How to make a Capship chase a Fighter?
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
Former Inferno lead, BTA fredder-ish and DE fredder. Driven out by ordinary fascists the_e, aesaar and general battuta. Will return if they're ever removed.

 

Offline Homura

  • 24
Re: How to make a Capship chase a Fighter?
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.

 
Re: How to make a Capship chase a Fighter?
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.
"Obviously the meson bomb is a form of cat-toast-device, with the buttered toast inverted, so that the cat and toast both fly in the direction of gravity much faster than expected. By introducing artificial gravity, a pair of cat-toast perpetual motion accelerator units can be made to collide with one another, and they produce an unimaginably devastating explosion. Both cats are named 'Meson'."

 - Wikileaks 2383

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: How to make a Capship chase a Fighter?
Dynamic waypoint

Just use an event that sets the waypoint's position to Alpha 2's position, with a 9999999999999999 repeat count

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: How to make a Capship chase a Fighter?
9999999999999999 repeat count
or -1, which is much simpler
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 
Re: How to make a Capship chase a Fighter?
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?
"Obviously the meson bomb is a form of cat-toast-device, with the buttered toast inverted, so that the cat and toast both fly in the direction of gravity much faster than expected. By introducing artificial gravity, a pair of cat-toast perpetual motion accelerator units can be made to collide with one another, and they produce an unimaginably devastating explosion. Both cats are named 'Meson'."

 - Wikileaks 2383

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: How to make a Capship chase a Fighter?
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.
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 
Re: How to make a Capship chase a Fighter?
Works significantly better, my corvette now properly chases fighters!
"Obviously the meson bomb is a form of cat-toast-device, with the buttered toast inverted, so that the cat and toast both fly in the direction of gravity much faster than expected. By introducing artificial gravity, a pair of cat-toast perpetual motion accelerator units can be made to collide with one another, and they produce an unimaginably devastating explosion. Both cats are named 'Meson'."

 - Wikileaks 2383