Howard 0 Posted July 27, 2009 (edited) How do you make aircraft lose fuel faster? I kinda need a harrier to lose fuel atleast 3x the speed it does now. Edited July 28, 2009 by Placebo Share this post Link to post Share on other sites
Big Dawg KS 6 Posted July 27, 2009 (edited) _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 July 27, 2009 by Big Dawg KS Share this post Link to post Share on other sites
Howard 0 Posted July 27, 2009 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
Big Dawg KS 6 Posted July 27, 2009 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
Bad Pilot 0 Posted July 27, 2009 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
Howard 0 Posted July 27, 2009 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
Big Dawg KS 6 Posted July 28, 2009 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
doc_no1 0 Posted July 28, 2009 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
Bad Pilot 0 Posted July 28, 2009 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
Big Dawg KS 6 Posted July 28, 2009 Yea, I can't see that (web filter). Please type it out. Share this post Link to post Share on other sites
Howard 0 Posted July 28, 2009 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
kylania 568 Posted July 28, 2009 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
Big Dawg KS 6 Posted July 28, 2009 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
Howard 0 Posted July 28, 2009 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