Jump to content
Sign in to follow this  
Howard

Faster fuel consumption

Recommended Posts

How do you make aircraft lose fuel faster?

I kinda need a harrier to lose fuel atleast 3x the speed it does now.

Edited by Placebo

Share this post


Link to post
Share on other sites

_i = 0.01;
while{fuel _plane > 0}do{
_plane setFuel (fuel _plane - _i);
sleep 0.1;
};

Play with the value of _i. With a value of 0.01, it would lose 1% fuel every 0.1 seconds (10%/second).

Edit: I now realize you probably mean in the config.cpp, in which case I don't remember off hand.

Edited by Big Dawg KS

Share this post


Link to post
Share on other sites

Don't worry, Dawg.

I'm a very inexperienced scripter, though I kinda have to learn it if I'm going to create large scale missions. I have no idea what the config.cpp is so you don't have to explain how to do it by using that ;)

Let me just see if I got this straight... _i = the player name and _plane= the vehicle name?

Share this post


Link to post
Share on other sites

Since the code is small enough you can just do this in the init field of the plane:

fuelDrain = this spawn {_plane = _this; _i = 0.01; while{fuel _plane > 0}do{if(engineOn _plane)then{_plane setFuel (fuel _plane - _i)}; sleep 0.1};

The _i is just a numeric value to determine the rate of fuel consumption.

Share this post


Link to post
Share on other sites

The sleep 0.1 means the script has to engage 10 times per second when the host cpu might have better things to do with its time. How about every 10 seconds?

Share this post


Link to post
Share on other sites
Since the code is small enough you can just do this in the init field of the plane:

fuelDrain = this spawn {_plane = _this; _i = 0.01; while{fuel _plane > 0}do{if(engineOn _plane)then{_plane setFuel (fuel _plane - _i)}; sleep 0.1};

The _i is just a numeric value to determine the rate of fuel consumption.

Doesn't work, mate.

I just get a blank error.

Share this post


Link to post
Share on other sites

Sorry I missed a '}':

fuelDrain = this spawn {_plane = _this; _i = 0.01; while{fuel _plane > 0}do{if(engineOn _plane)then{_plane setFuel (fuel _plane - _i)}; sleep 0.1}};

Happens to us all lol.

Share this post


Link to post
Share on other sites

Why dont you slide the fuel down on the setting of the harrier instead of scripting.

Share this post


Link to post
Share on other sites

The pilot could refuel it. I wish I'd thought of the faster fuel consumption idea when I was trying to limit range on an old, unmaintained chopper.

Share this post


Link to post
Share on other sites

Just a picture of the place unit menu with an empty AV-8 called _plane and your code in the init.

There's an error box which doesnt say anything.

Try using that code on a vehicle in your own ArmA 2 and you'll see.

Share this post


Link to post
Share on other sites

You can't use _i in the init string since that's a global scope but a local variable right? Try it with just i or myFuel or something?

Share this post


Link to post
Share on other sites

Well I can't see how he's entered it, but if the local variable is used inside of the code block for spawn then it should be fine.

I've spotted another error in my code:

fuelDrain = this spawn {_plane = _this; _i = 0.01; while{fuel _plane > 0}do{if([b]is[/b]EngineOn _plane)then{_plane setFuel (fuel _plane - _i)}; sleep 0.1}};

Should work now.

Share this post


Link to post
Share on other sites

Works perfectly with that code, Big Dawg!

Thanks for your help. You're a bloody expert!

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  

×