Results 1 to 5 of 5

Thread: How to determine aircraft fuel level (or fuel level requested by player at spawn-in)?

  1. #1
    Veteran Combat pilot
    Join Date
    May 2015
    Location
    Kansas City, Missouri area
    Posts
    428
    Post Thanks / Like
    Total Downloaded
    84.73 MB

    How to determine aircraft fuel level (or fuel level requested by player at spawn-in)?

    In my unending question to control all players fuel levels, I know now to set a players fuel level (AiAircraft.RefuelPlane(int)) and how to find the minimum fuel level for a given aircraft (maddox.game.world.AiAircraft.GetMinimumFuelInPerc ent()).

    But what I would LIKE to do is know what the players requested and/or current fuel level is, in percent.

    The only way I can think of, is to somehow cycle through all possible fuel tanks and levels for all various types of aircraft, using AiAircraft.getParameter(part.ParameterTypes, int) and appropriate parameters etc.

    That sounds complicated.

    Is there, possibly, any simpler way to just retrieve the fuel *percent* of an aircraft?

    Maybe it could be retrieved from the player's spawn-in menu settings somehow?

    Thank for any tips!
    Last edited by TWC_Flug; Jul-11-2021 at 17:38.
    System: Microsoft Windows 10 Pro 64 bit, 10.0.18362 N/A Build 18362, 20,437 MB |
    ASUS GeForce GTX 1060 3GB | Intel Core i5-2500 Quad-Core Processor 3.3 GHz 6 MB Cache LGA 1155 | Intel DB65AL motherboard | ARCTIC Freezer i11 CPU Cooler | SVGA 500 watt power supply | Microsoft Sidewinder 2 Force Feedback joystick

  2. #2
    TF Leadership RAF74_Buzzsaw's Avatar
    Join Date
    Oct 2012
    Posts
    10,937
    Post Thanks / Like
    Total Downloaded
    319.01 MB

    Re: How to determine aircraft fuel level (or fuel level requested by player at spawn-

    Artist is away on vacation so you may not get a response on this for a while... maybe kick this thread again after July 26th.

  3. #3
    Team Fusion ATAG_Oskar's Avatar
    Join Date
    Nov 2017
    Location
    Canada
    Posts
    757
    Post Thanks / Like
    Total Downloaded
    835.09 MB

    Re: How to determine aircraft fuel level (or fuel level requested by player at spawn-

    Quote Originally Posted by TWC_Flug View Post
    In my unending question to control all players fuel levels, I know now to set a players fuel level (AiAircraft.RefuelPlane(int)) and how to find the minimum fuel level for a given aircraft (maddox.game.world.AiAircraft.GetMinimumFuelInPerc ent()).

    But what I would LIKE to do is know what the players requested and/or current fuel level is, in percent.

    The only way I can think of, is to somehow cycle through all possible fuel tanks and levels for all various types of aircraft, using AiAircraft.getParameter(part.ParameterTypes, int) and appropriate parameters etc.
    Check the code for my mileage mission in the download section.

    For current percentage:

    Add up total litres of fuel in all tanks save value as currentLitres.

    Refuel to 100%.

    Add up total litres of fuel in all tanks save value as maxLitres.

    currentLitres/maxLitres * 100 = currentPercent.

    Refuel to currentPercent.

    Now you know the currentPercent.

  4. #4
    Veteran Combat pilot
    Join Date
    May 2015
    Location
    Kansas City, Missouri area
    Posts
    428
    Post Thanks / Like
    Total Downloaded
    84.73 MB

    Re: How to determine aircraft fuel level (or fuel level requested by player at spawn-

    Quote Originally Posted by ATAG_Oskar View Post
    Check the code for my mileage mission in the download section.

    For current percentage:

    Add up total litres of fuel in all tanks save value as currentLitres.

    Refuel to 100%.

    Add up total litres of fuel in all tanks save value as maxLitres.

    currentLitres/maxLitres * 100 = currentPercent.

    Refuel to currentPercent.

    Now you know the currentPercent.
    Aha, genius. Thanks.
    System: Microsoft Windows 10 Pro 64 bit, 10.0.18362 N/A Build 18362, 20,437 MB |
    ASUS GeForce GTX 1060 3GB | Intel Core i5-2500 Quad-Core Processor 3.3 GHz 6 MB Cache LGA 1155 | Intel DB65AL motherboard | ARCTIC Freezer i11 CPU Cooler | SVGA 500 watt power supply | Microsoft Sidewinder 2 Force Feedback joystick

  5. #5
    Team Fusion Artist's Avatar
    Join Date
    Mar 2010
    Posts
    2,496
    Post Thanks / Like
    Total Downloaded
    102.3 KB

    Re: How to determine aircraft fuel level (or fuel level requested by player at spawn-

    patch 024 makes life a bit easier with this.

    *** Mission building; Class AiAircraft has three new methods concerning Fuel: GetFuelCapacity(), GetCurrentFuelQuantity(), and GetCurrentFuelQuantityInPercent() [Artist]

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •