Arma 3 scripting, increase gas uptake

I must admit, this has been asked and requested many times and I was too lazy to publish something about it… But, today, I’m in holiday and have some free time to do it…
The concept is pretty simple, it increases the fuel uptake taking into account the speed of the player vehicle.

This script is release as it is, you may need to do some adjustments :)

Used values are defined in an array named  tm4_prom_spotrebaPaliva that you can define inside the script or anywhere during your initialization (e.g. init.sqf, initPlayerLocal.sqf). If you define  tm4_prom_spotrebaPaliva before starting this script, your settings will be used and the default one ignored.

Note that trucks, vans and helicopters are concerned by the base value (index 0) only because the default fuel uptake from the game is superior than a SUV for example.

So, hereafter, we define the consumption. The first index is the base and will be applied on every vehicle (whatever its kind) with 5 ticks per seconds and used when the speed is inferior to 10 KM h.  Then, seconde is for a speed between 10 Km h and 90 Km h, the next (index 2) is for a speed between 91 Km h and 130 Km h and the last (index 3) will be used for a speed superior to 130 Km h.

Let’s take cases, a truck and a SUV:

  • SUV:
      • When:  isEngineOn AND speed < 10
        Consumption per second:  Default + ((0.00066314157 * 1.00619) * 5)
      • When:  isEngineOn AND speed > 130 
        Consumption per second:  Default + ((0.00066314157 * 1.00619) * 5) + ((0.0036314157 + 0.00026159)/(pi*2) * 5)
  • Truck
    • When:  isEngineOn AND speed < 10
      Consumption per second:  Default + ((0.00066314157 * 1.00619) * 5)
    • When:  isEngineOn AND speed > 130 
      Consumption per second:  Default + ((0.00066314157 * 1.00619) * 5)

As you can see, the increase for a truck is smaller than for a SUV because we don’t cancel and replace the default, we just add to it and the base consumption of truck is already greater.

There you go then, the script itself:

You can simply add the script where you want it and execute it or its content in another script, for example the one you use to init the player. Personally, I recommend to execute it from initPlayerLocal.sqf which is the most suitable place for such script.

If you have any questions, feel free to post a comment in English or French ;)


#  You’re not allowed to use this for the contest Make Arma Not War without telling me ;)

10 thoughts on “Arma 3 scripting, increase gas uptake

    1. J’avais oublié la licence:
      [X] Attribution – You must attribute the material in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the material).
      [X] Noncommercial – You may not use this material for any commercial purposes.
      [X] Arma Only – You may not convert or adapt this material to be used in other games than Arma.
      [X] Share Alike – If you adapt, or build upon this material, you may distribute the resulting material only under the same license.

  1. Hey,

    first off all great script =) i like it a lot, but i got a little problem. sometimes its working and the gas is going down to 0 in like 10mins or something and sometimes it doesn’t.

    I use it on my altis life server and people enjoy it too (most of the time)…

    i call it this way:

    [] execVM “scripts\tm4_fuelUptake.sqf”;

    is this correct or do i need to change something?

    1. Ahoy,

      We agree that you’re calling it from initPlayerLocal.sqf?

      Then, be aware that consumption may differs from a vehicle type to another, according to the initial design, you should be able to go to Sofia from Kavala with a speed of +/- 110 Km h, then, your fuel tank should be almost empty (if it’s not the case).

      I will have a look at that, but if you’re able to find in which cases (at least, some parameters) it malfunctions, it will be great and faster to fix ;)

      1. Hey… yeah i got this in my initPlayerLocal:

        [] execVM “scripts\tm4_fuelUptake.sqf”;

        or should i use

        call “scripts\tm4_fuelUptake.sqf”;?

Leave a Reply

Your email address will not be published. Required fields are marked *