ios 10 Posted April 29, 2011 i am wondering if it is possible to refuel vehicle with EventHandler to prevent it to fall to 0, cause i am making some armored unit patrol a city and if player take some times to come i don't want armored patrol to be fix, Thanks In Advance ! Share this post Link to post Share on other sites
riouken 15 Posted April 29, 2011 (edited) In the init of the Veh: _outoffuel = this addEventHandler ["Fuel", {(_this select 0) setFuel 1}]; If will only fire when it runs completely out of fuel though. But it should work as your intending. http://community.bistudio.com/wiki/ArmA:_Event_Handlers#Fuel This is not tested but it should be right. Edited April 29, 2011 by Riouken Share this post Link to post Share on other sites
demonized 20 Posted April 29, 2011 (edited) i think eventhandler will cause AI to exit vehicle when its empty so you need to counter that in that case. you can also just run a loop on it, this below will check every minute if fuel is less than half and then set it back to full if vehicle is still able to move (not damaged or destroyed). it will exit if vehicle is to damaged. while {canMove vehicle} do { waitUntil {sleep 60; (fuel vehicle) < 0.5}; if (canMove vehicle) then {vehicle setFuel 1}; }; Edited April 29, 2011 by Demonized Share this post Link to post Share on other sites
riouken 15 Posted April 29, 2011 I just tested it they dont jump out. They will just keep going. I know in some of my other missions, I have put veh down with no fuel and AI in, they will sit there for like 10 min trying to crank the eng. But the loop works just as well. Share this post Link to post Share on other sites
neokika 62 Posted April 29, 2011 In this situation the Event Handler is the best, and should refuel the vehicle so fast that AI won't even notice it. =) _neo_ Share this post Link to post Share on other sites
demonized 20 Posted April 29, 2011 ok, nice to know for the future, eventhandlers is way more cleaner way to do things. just a note, i tried placing a a10 on the ground and then placed this setFuel 0 and the AI insta exited the plane.. maybe its just related to planes as they "will fall down" if out of fuel, emergency eject kindof.... But it happened on ground and he opened the plane hatch and seemed to exit not eject. Share this post Link to post Share on other sites
riouken 15 Posted April 29, 2011 good point, I have never tried it with a plane, lol let me go test it and see if I can make him crash. Share this post Link to post Share on other sites