Author Topic: How do I get the AI to perform "emergency procedures"?  (Read 1479 times)

0 Members and 1 Guest are viewing this topic.

Offline 0rph3u5

  • 211
  • Oceans rise. Empires fall.
How do I get the AI to perform "emergency procedures"?
So I have this mission on drawing board, pre-launch the player ship is sabotaged and in order not to die during the mission the player has to perform an "emergency procedure" (details to follow). Now I am a bit stuck as how to make the AI wingman perfrom seemingly the same stuff, which is:

1. Cut Engine Power to 0 (Effectively putting 100% power to weapons)
2. Expend the Afterburner Energy
3. Reduce the throttle to near 0 (accounting for a margin of error in player input)

This will lead for the player craft to be disabled, shuddered for a bit and then rocked by an explosion-effect to simulate the ejection of the faulty component. Now the effects I can replicate on AI craft quite easily: it's sabotage-subsystem, weapon-create (for a small flare effect) and explosion-effect.

Forcing the AI to make panic-esque maneuvers is possible with some randomly crated waypoints. But giving the AI the specific commands to use the afterburner for the right ammount of time doesn't appear to be possible.  Any tips?

ps. FRED based solution prefered
"As you sought to steal a kingdom for yourself, so must you do again, a thousand times over. For a theft, a true theft, must be practiced to be earned." - The terms of Nyrissa's curse, Pathfinder: Kingmaker

==================

"I am Curiosity, and I've always wondered what would become of you, here at the end of the world." - The Guide/The Curious Other, Othercide

"When you work with water, you have to know and respect it. When you labour to subdue it, you have to understand that one day it may rise up and turn all your labours into nothing. For what is water, which seeks to make all things level, which has no taste or colour of its own, but a liquid form of Nothing?" - Graham Swift, Waterland

"...because they are not Dragons."

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: How do I get the AI to perform "emergency procedures"?
I don't think there's a way to force the AI to use the afterburner. There might possibly be a way to do it with scripting, but I don't remember seeing one.
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.

 

Offline Axem

  • 211
Re: How do I get the AI to perform "emergency procedures"?
There's no way to force it, but you can use the free-afterburner-use ship flag (its only available in the alter-ship-flag sexp) which allows the AI to use the afterburner in any available circumstance (instead of only when attacking)

 
Re: How do I get the AI to perform "emergency procedures"?
Scripting should be able to force it using Ship.physics.AfterburnerActive = true, but I guess it'll switch off if there is not enough afterburner energy left. Same for the free-afterburner-use ship flag. The target waypoint also needs to be in front of the ship or it won't activate the burner.
Here goes scripting and copy paste coding
Freespace RTS Mod
Checkpoint/Shipsaveload script