Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: 0rph3u5 on March 10, 2016, 06:12:09 am

Title: How do I get the AI to perform "emergency procedures"?
Post by: 0rph3u5 on March 10, 2016, 06:12:09 am
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
Title: Re: How do I get the AI to perform "emergency procedures"?
Post by: AdmiralRalwood on March 10, 2016, 11:38:58 am
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.
Title: Re: How do I get the AI to perform "emergency procedures"?
Post by: Axem on March 10, 2016, 12:14:59 pm
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)
Title: Re: How do I get the AI to perform "emergency procedures"?
Post by: Admiral MS on March 10, 2016, 03:36:52 pm
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.