Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: SF-Junky on February 28, 2020, 02:30:02 pm

Title: How do I missile-protect a ship?
Post by: SF-Junky on February 28, 2020, 02:30:02 pm
... from fighter/bomber attacks?

I realized that even when a ship uses the "hidden from sensors" flag, AI fighters and bombers seem to be able to target-lock their secondaries even though they seem to be unable to actually target that ship (judging from pressing j ingame). Is there a way to work around this?

€: To be a little more specific: I tested this with a bomber wing attacking a capital ship with Cyclopses. They have the "no dumbfire" flag. So actually they shouldn't be able to launch them at the target if "hidden from sensors" is active.
Title: Re: How do I missile-protect a ship?
Post by: Nightmare on February 28, 2020, 02:39:49 pm
Try the "missile protect ship"-flag under "Misc" in the ships editor.
Title: Re: How do I missile-protect a ship?
Post by: SF-Junky on February 28, 2020, 02:43:44 pm
Try the "missile protect ship"-flag under "Misc" in the ships editor.
I was thinking whether to write that I tried that. But then I was like "nah, other people are more attentive than I am and realize/know that this is only for turrets". :p
Title: Re: How do I missile-protect a ship?
Post by: General Battuta on February 28, 2020, 02:53:28 pm
Just as a hack, could you lock the bombers' secondary banks for as long as necessary?
Title: Re: How do I missile-protect a ship?
Post by: Nightmare on February 28, 2020, 03:44:59 pm
Try the "missile protect ship"-flag under "Misc" in the ships editor.
I was thinking whether to write that I tried that. But then I was like "nah, other people are more attentive than I am and realize/know that this is only for turrets". :p

Huh didn't know that :wtf:
Title: Re: How do I missile-protect a ship?
Post by: Nightmare on February 28, 2020, 03:53:00 pm
You could try ai-ignore goals. :nervous:
Title: Re: How do I missile-protect a ship?
Post by: 0rph3u5 on February 28, 2020, 08:15:49 pm
Just as a hack, could you lock the bombers' secondary banks for as long as necessary?

... or you could store the ammo count of the banks carrying bombs in a variable, then empty the bank for the time neccessary. If you are doing that to friendlies, you may have to also swap the bank over to dummy variant that doesn't reload from a support ship.

... or you could make a variant of the Cyclops that has the "tagged only"-flag, and then use the appropriate SEXP to the force the traget ship to be tagged (iff_defs.tbl allows you to hide the change in colour if a ship is tagged) - This might not work for hostiles; honestly never tried that with hostiles before.
Title: Re: How do I missile-protect a ship?
Post by: General Battuta on February 28, 2020, 08:33:23 pm
That seems a lot more complicated.
Title: Re: How do I missile-protect a ship?
Post by: SF-Junky on February 29, 2020, 04:09:04 am
Thanks for the replies.

The actual mission is a little different from the test scenario described in the op. The player's squadron attacks an enemy half-stealthed frigate to disarm its main beams. The ship is escorted by fighters and a cruiser which are fully targetable. This makes working with lock-secondaries and manipulating ammunition difficult.

What I have in mind is that the player can make the target targetable by using TAG missiles. Of course I could introduce a "fire at tagged ships only" version of every secondary weapon available to the player squad (which is pretty much every secondary weapon in the game) and permanently tag all other hostiles in the mission via SEXP. But that's a lot of effort for only one mission...

While I'm writing this the idea comes to my mind that I could combine object-facing-object with lock-secondaries: Whenever an friendly fighter/bomber faces that frigate, it's secondaries are locked.
Title: Re: How do I missile-protect a ship?
Post by: 0rph3u5 on February 29, 2020, 04:47:00 am
That seems a lot more complicated.

Complication is not, in essence, a bad thing :D

"Indirect tactics, efficiently applied, are inexhaustible as Heaven and Earth, unending as the flow of rivers and streams; like the sun and moon, they end but to begin anew; like the four seasons, they pass away to return once more."
- Sun Tzu, The Art of War




The actual mission is a little different from the test scenario described in the op. The player's squadron attacks an enemy half-stealthed frigate to disarm its main beams. The ship is escorted by fighters and a cruiser which are fully targetable. This makes working with lock-secondaries and manipulating ammunition difficult.

What I have in mind is that the player can make the target targetable by using TAG missiles. Of course I could introduce a "fire at tagged ships only" version of every secondary weapon available to the player squad (which is pretty much every secondary weapon in the game) and permanently tag all other hostiles in the mission via SEXP. But that's a lot of effort for only one mission...

While I'm writing this the idea comes to my mind that I could combine object-facing-object with lock-secondaries: Whenever an friendly fighter/bomber faces that frigate, it's secondaries are locked.

Now this is much more information which makes this much easier to workshop...

Each time the target ship enter the "stealth"-condition you simply manipulate the AI, using remove-goal* and add-goal + ai-ignore-new, to end the attack on the ship; it may give you some trouble with the dynamic orders, so I would recommend also switching the stealthed ship to an dummy IFF (see iff_defs.tbl for details) that the Friendly team does not attack by default - that should override the dynmaic AI.

Each time the "stealth"-condition is lost, simply swap back the IFF and reinstate the AI commands.

* You may need a number of those, because player orders have a range not a defined number for their priority - its only 90-100 out of 1-200, so...  ;)

Title: Re: How do I missile-protect a ship?
Post by: Nightmare on February 29, 2020, 05:20:07 am
One more idea: you could make the hostile ship stealthy and use a blip with hidden from sensor flag to make the flickering dot on the radar.
Title: Re: How do I missile-protect a ship?
Post by: SF-Junky on March 03, 2020, 01:24:20 pm
Now this is much more information which makes this much easier to workshop...
Yeah, I should've provided more info in the first place.

However, playing with goals won't do the trick, because as I said: I only want to protect that ship from missile fire, not gun fire - the player's squadron is supposed to attack that ship. This is why Nightmare's trick won't work, won't it? Because stealth mode means that my wingmen won't attack the ship at all.
Title: Re: How do I missile-protect a ship?
Post by: Nightmare on March 03, 2020, 01:55:01 pm
Yeah using ai goals most likely won't work in that case.
Title: Re: How do I missile-protect a ship?
Post by: mjn.mixael on March 03, 2020, 02:33:04 pm
I'm struggling to understand the use-case here. You want the bombers(?) to attack a particular ship but not fire their bombs?

My best idea is some combo of is-facing and distance-to-ship check -> lock-secondaries, else unlock. I don't think there's a sexp to check what ship the AI is targeting.
Title: Re: How do I missile-protect a ship?
Post by: 0rph3u5 on March 04, 2020, 09:00:58 pm
Eureka?

EDIT: Oh right, can't see attachments - found this while checking if the "ignore-for-count-goals"-ship flag could be used as dummy status effect tracker (should I ever have the tagged status not avalible): It appears there is a "no secondary lock on"-flag in the list of flag for the alter-ship-flag SEXP but its not in the list of the Ships Editior ... which might be an indication that it doesn't work, but at least it is there.

[attachment eaten by a Shivan]
Title: Re: How do I missile-protect a ship?
Post by: AdmiralRalwood on March 05, 2020, 03:24:49 pm
Eureka?

EDIT: Oh right, can't see attachments - found this while checking if the "ignore-for-count-goals"-ship flag could be used as dummy status effect tracker (should I ever have the tagged status not avalible): It appears there is a "no secondary lock on"-flag in the list of flag for the alter-ship-flag SEXP but its not in the list of the Ships Editior ... which might be an indication that it doesn't work, but at least it is there.
no-secondary-lock-on means that ship can't lock secondaries, not that secondaries can't achieve aspect lock on it; in this scenario, it's no more helpful than lock-secondaries.
Title: Re: How do I missile-protect a ship?
Post by: 0rph3u5 on March 05, 2020, 06:44:29 pm
no-secondary-lock-on means that ship can't lock secondaries, not that secondaries can't achieve aspect lock on it; in this scenario, it's no more helpful than lock-secondaries.

... well, someone should clear up the language of the description :)

Hidden Text: Show
Now:
Code: [Select]
no-secondary-lock-on - Will disable target acquisition for secondaries of all types (does not affect turrets)Suggested:
Code: [Select]
no-secondary-lock-on - Will disable the ability of the ship to lock on target with secondary weapons of any kind (does not affect turrets)



My best idea is some combo of is-facing and distance-to-ship check -> lock-secondaries, else unlock. I don't think there's a sexp to check what ship the AI is targeting.

Just to point that out, but is-facing already contains a distance check (4th argument):

Quote
Is Facing (Boolean training operator)
   Is true as long as the second object is within the first ship's specified forward cone.  A forward cone is defined as any point that the angle between the vector of the ship and point, and the forward facing vector is within the given angle. If the distance between the two is greater than the fourthparameter, this will return false.
emphasis mine



How married are you to the defensive ECM approach, SF-Junky? - because if you are going away from the defensive stealth/ECM approach, to something more like a "silenced"-status being projected by the target ship it would be easier mechanically - it would be down to a distance check, which you could scale if re-braned the TAG missiles as EMP missiles (you have to the keep the TAG parameters though, as I don't see the option to check if a ship is EMP'ed or Disrupted; an alternative would be a Leech effect but I don't know how that works with capital ships. The Leech effect approach theoretically also would allow for the projection range to rise and fall as you can get info on current weapons and afterburner energy of a target)