Jump to content
Sign in to follow this  
Delta 51

Faster fuel consumption

Recommended Posts

I'm looking to either find or create a script which increases the rate fuel is consumed as to make maps feel larger and give vehicles a maximum range.

Two ways that have been thought of to implement is either by increase the consumption, or changing the fuel value in the mission to .25 of its normal size

Share this post


Link to post
Share on other sites

Speaking of which, in ArmA 2, does the amount of fuel in a vehicle decrease when idling?

Share this post


Link to post
Share on other sites

This will increase the fuel rate, just paste call comand in an init or trigger,waypoint ect.

It shouldn't use any fuel when the engine is off.

// nul=[nameofvehicle,rateofleak] execvm "Fuel_Consumption.sqf"; 

_unit = _this select 0;
_rate = _this select 1;

while {(alive _unit) and (fuel _unit > 0)} do { 

if (isengineon _unit) then {
_unit setFuel ( Fuel _unit -_rate);
};
sleep 1;
};

// hint "Out!!!";

This is nearly the same code but simulates a leak so works with engine off

// nul=[nameofvehicle,rateofleak] execvm "Fuel_Leak.sqf";

_unit = _this select 0;
_rate = _this select 1;

while {(alive _unit) and (fuel _unit > 0)} do { 
_unit setFuel ( Fuel _unit -_rate);
sleep 1;
};

// hint "Out!!!";

You could easily add other stuff such as use damage instead of setfuel and it would slowly destroy an object.

Reverse it and you could slowly refuel.

You could multiply the consumption by the speed of the vehicle to make it interesting.

Share this post


Link to post
Share on other sites
Speaking of which, in ArmA 2, does the amount of fuel in a vehicle decrease when idling?

It does.

Share this post


Link to post
Share on other sites
This will increase the fuel rate, just paste call comand in an init or trigger,waypoint ect.

It shouldn't use any fuel when the engine is off.

// nul=[nameofvehicle,rateofleak] execvm "Fuel_Consumption.sqf"; 

_unit = _this select 0;
_rate = _this select 1;

while {(alive _unit) and (fuel _unit > 0)} do { 

if (isengineon _unit) then {
_unit setFuel ( Fuel _unit -_rate);
};
sleep 1;
};

// hint "Out!!!";

This is nearly the same code but simulates a leak so works with engine off

// nul=[nameofvehicle,rateofleak] execvm "Fuel_Leak.sqf";

_unit = _this select 0;
_rate = _this select 1;

while {(alive _unit) and (fuel _unit > 0)} do { 
_unit setFuel ( Fuel _unit -_rate);
sleep 1;
};

// hint "Out!!!";

You could easily add other stuff such as use damage instead of setfuel and it would slowly destroy an object.

Reverse it and you could slowly refuel.

You could multiply the consumption by the speed of the vehicle to make it interesting.

Thanks a squillion mate

Share this post


Link to post
Share on other sites

this is good thinking - i've been feeling that refueling is not as much of a priority as it should befor realistic logistics

Share this post


Link to post
Share on other sites

New to scripting, need help implementing this one

OK so I made a .sqf file called Fuel_Consumption.sqf

then added the following into the .sqf file :

_unit = _this select 0;
_rate = _this select 1;

while {(alive _unit) and (fuel _unit > 0)} do { 
_unit setFuel ( Fuel _unit -_rate);
sleep 1;
};

I then enter the following in the heli init box in editor:

nul=[nameofvehicle,rateofleak] execvm "Fuel_Consumption.sqf";

nothing happens, do i need to edit the "name of vehicle and/or "rate of leak"

for example i used a heli with name h2, do i need to put that name anywhere?

Share this post


Link to post
Share on other sites


nameofvehicle = name of your vehicle

rateofleak = rate, a number between 0 and 1.

1 would drain all of the fuel instantly. 0 = 0%, 1 = 100% fuel drain, every second.

Change the "sleep X" in the script if you want to increase the seconds between each drain.

so

0 = [h2,0.1] execvm "Fuel_Consumption.sqf";

Edited by cuel

Share this post


Link to post
Share on other sites

Thanks, but i must have something wrong, I tried a helicopter named h2

entered this in the init box

0 = [h2,0.9] execvm "Fuel_Consumption.sqf";

no leak! i though by making it 0.9 it would almost be empty the moment i got into it. no joy.

maybe theres and error with my .sqf

_unit = _this select 0;
_rate = _this select 1;

while {(alive _unit) and (fuel _unit > 0)} do { 

if (isengineon _unit) then {
_unit setFuel ( Fuel _unit -_rate);
};
sleep 1;
};

Share this post


Link to post
Share on other sites

I suspect your not using http://forums.bistudio.com/showthread.php?121163-Script-not-working-Use-the-showScriptErrors-parameter! and the game is't seeing the scirpt but not telling you what the problem is.

You may be saving it in the wrong place mine is here My Documents\ArmA 2\missions\fuel or do a search for the file name you give the mission.

You may also not be saving it as sqf but a txt file check that folder options hide extensions for know file types is unticked or use an editor such as Squint or ArmaEdit.

Share this post


Link to post
Share on other sites

Also, the engine of the vehicle needs to be on for the increased drain to happen.

Share this post


Link to post
Share on other sites

ACE doesnt like this at all, when the truck runs out of fuel the jerrycan catches fire

Share this post


Link to post
Share on other sites

My bad calling the script incorrectly... Doh

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×