Jump to content
Sign in to follow this  
odyseus

Low fuel as condition!

Recommended Posts

Hello guys i m trying to get a helicopter to move to a marker when its fuel is low. Any ideas?

Share this post


Link to post
Share on other sites

After a quick glance into Mr.Murrays editing guide it appears you can use:

Fuel VehName == 0.2

as a condition

vehName moveTo posName; // ie; invise named hpad 

waitUntil {vehName distance posName < 100};
vehName land "posName";

Edited by Iceman77

Share this post


Link to post
Share on other sites

Thank again Iceman. I m trying to do this by triggers. i can get it to move to the marker when fuel is low. My only problem is to make it land on the helipad. This line vehName land "posName" does not work! Happy Holidays! :D

Share this post


Link to post
Share on other sites

okay 1 sec

---------- Post added at 23:24 ---------- Previous post was at 23:09 ----------

Try this. It literally creates a waypoint. And I know land works on the onact of wps. So this should work. Obviously I name the hpad "Fpad" & the helo I name "helo1" and the helos crew is raven1=group this

_wp = (group raven1) addWaypoint [position Fpad, 0]; 
_wp setWaypointBehaviour "careless";  
_wp setWaypointCombatMode "green";  
_wp setWaypointSpeed "FULL";  
_wp setWaypointStatements ["true","helo1 land "Fpad"]; 
_wp setWaypointTimeout [0, 0, 0];  
_wp setWaypointType "move"; 
_wp showWaypoint "ALWAYS";

---------- Post added at 23:29 ---------- Previous post was at 23:24 ----------

You may actually have to give the "driver" (pilot) of the helo the order to land instead of the helo itself. So if that doesn't work, try:

_wp setWaypointStatements ["true","leader raven1 land "Fpad"];

or

//name the pilot
_wp setWaypointStatements ["true","man1 land "Fpad"];

---------- Post added at 23:41 ---------- Previous post was at 23:29 ----------

Btw, if you don't want the helo to run out of fuel you can just give the helo a "fuel" eventhandler.Put this into the init of the helo:

this addEventHandler ["Fuel", { (_this select 0) setFuel 1 }]

Share this post


Link to post
Share on other sites

I would change the code

Fuel VehName == 0.2

to

Fuel VehName <= 0.2

because sometimes for example if you have lag or something the condition runs over.

Share this post


Link to post
Share on other sites

yeah, I figured the fuel value wouldn't change to quickly, so the chance of it never actually equaling the value is slim. But in any case, you're right;)

Edited by Iceman77

Share this post


Link to post
Share on other sites

You might be surprised to find out the chances of that evaluating as true are the ones that are slim. You should never exactly compare floating point numbers.

Share this post


Link to post
Share on other sites

oh okay. Why is that? I didn't think the vehicles in this game consumed fuel that quickly, so I figured how could it not ever equal the value.

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  

×