Author Topic: [Feature request]: Force glide on all ships, in AI profiles.  (Read 2787 times)

0 Members and 1 Guest are viewing this topic.

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
[Feature request]: Force glide on all ships, in AI profiles.
I've recently returned to playing around with Newtonian flight model in FS, and made an amazing discovery: The glide mode, when set up properly, essentially gives a full Newtonian flight model. Not only that, AI handles it pretty well and it's partially independent from "normal" speed and acceleration values, making the same ship capable of semi-realistic atmospheric flight.
That means the only thing a fully Newtonian mod would need is to simply force glide on every ship, in every space mission, along with adjusting tables to make it playable.
Unfortunately, "Force glide" SEXP is a rather tedious way to do that, since you essentially need to list every small ship in mission, and maybe also capships (I haven't yet figured out how well capships handle gliding). So, I'm asking to include a "Force Glide" setting in AI Profiles. This shouldn't be too difficult, as all functionality is already there, I'm just asking for an additional place to toggle it from.

 

Offline zookeeper

  • *knock knock* Who's there? Poe. Poe who?
  • 210
Re: [Feature request]: Force glide on all ships, in AI profiles.
How about a force_glide-sct.tbm?

Code: [Select]
#Conditional Hooks

$Application: FS2_Open

$On Mission Start: [

    num = #mn.Ships
   
    for i=1,num do
        mn.runSEXP("force-glide !" .. mn.Ships[i].Name .. "! !true!")
    end

]

#End

 

Offline m!m

  • 211
Re: [Feature request]: Force glide on all ships, in AI profiles.
Or even better run in in the "On Frame"-Hook so new ships also get glide enabled.

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
Re: [Feature request]: Force glide on all ships, in AI profiles.
Wouldn't it crash if a ship doesn't have glide defined?
Also, I need to be able to make it work the opposite way (force glide off) for atmospheric missions.

 

Offline zookeeper

  • *knock knock* Who's there? Poe. Poe who?
  • 210
Re: [Feature request]: Force glide on all ships, in AI profiles.
Or even better run in in the "On Frame"-Hook so new ships also get glide enabled.

Yeah, I'm not completely sure how comprehensively my method works. I think it works just fine for ships which haven't yet arrived at mission start, but it won't work for ships created with ship-create, and I have no idea about whether it'd work correctly on waves.

Wouldn't it crash if a ship doesn't have glide defined?

Doesn't look like it.

Also, I need to be able to make it work the opposite way (force glide off) for atmospheric missions.

Well, then you can have this:

Code: [Select]
#Conditional Hooks

$Application: FS2_Open

$On Mission Start: [

    force_glide = false
    forced_glide_status = false

    if mn.Events["force glide on"]:isValid() then
        force_glide = true
        forced_glide_status = true
    end
   
    if mn.Events["force glide off"]:isValid() then
        force_glide = true
        forced_glide_status = false
    end
       
    if force_glide then
        num = #mn.Ships
       
        for i=1,num do
            mn.runSEXP("force-glide !" .. mn.Ships[i].Name .. "! !" .. forced_glide_status .. "!")
        end
    end

]

#End

If the mission has an event called "force glide on", then glide will be forced on, and off if it has an event called "force glide off". Also, as per m!m's suggestion, you might want to split the last if into a separate $On Frame hook.

 

Offline m!m

  • 211
Re: [Feature request]: Force glide on all ships, in AI profiles.
Yeah, I'm not completely sure how comprehensively my method works. I think it works just fine for ships which haven't yet arrived at mission start, but it won't work for ships created with ship-create, and I have no idea about whether it'd work correctly on waves.
mn.Ships includes all ships specified in the mission file? Cool, I didn't know that.

I guess you could also query the gliding status for every ship and set it to glide when it isn't gliding (or the other way round).

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
Re: [Feature request]: Force glide on all ships, in AI profiles.
Yeah, it seems it could work. Though I'd still like an AIP option. But it'll do for now.

 

Offline Zacam

  • Magnificent Bastard
  • Administrator
  • 211
  • I go Sledge-O-Matic on Spammers
    • Steam
    • Twitter
    • ModDB Feature
Re: [Feature request]: Force glide on all ships, in AI profiles.
Considering that (for Retail ships at least) you'd still need to define Glide values for the ships, just setting an AIP with ships that don't have any Glide values would produce nothing.
Report MediaVP issues, now on the MediaVP Mantis! Read all about it Here!
Talk with the community on Discord
"If you can keep a level head in all this confusion, you just don't understand the situation"

¤[D+¬>

[08/01 16:53:11] <sigtau> EveningTea: I have decided that I am a 32-bit registerkin.  Pronouns are eax, ebx, ecx, edx.
[08/01 16:53:31] <EveningTea> dhauidahh
[08/01 16:53:32] <EveningTea> sak
[08/01 16:53:40] * EveningTea froths at the mouth
[08/01 16:53:40] <sigtau> i broke him, boys

  

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
Re: [Feature request]: Force glide on all ships, in AI profiles.
Why do you think it's intended for use with retail ships? It was never the idea, though I could make something like that in the future. That would warrant a full re-FREDing of the campaign for the new flight model though.