Jump to content
Sign in to follow this  
evans d [16aa]

Scrpiting Problem: Chopper Engines not Staying on

Recommended Posts

Hi guys,

I've got a script that is meant to make a chopper keep it's engine on after it lands but, unfortunetly, it doesn't.

It's initilized thus:

null = [NAME_OF_HELO] execVM "engineon.sqf";

And the script code is as follows:

_unit = _this select 0;
  waitUntil {!(isengineon _unit)};
_unit engineon true;

As I said: the pilot turns his engine off, and seing as this guy is doing a hot extraction, it isn't very realistic.

Is anyone able to edit the script so it works?

Thanks! :)

Share this post


Link to post
Share on other sites

It depends where you call it from, if you put it in the land waypoint it will activate before the chopper lands so won't work as the chopper is still flying at that point.

For this code to work the engine must be turned off first so you will probably need a delay to give the chopper time to turn off the engines or wait until the height of the chopper is zero at which point the AI turn the engines off so the code should work.

_unit = _this select 0;
sleep 10;
  waitUntil {!(isengineon _unit)};
_unit engineon true;

or

_unit = _this select 0;
waitUntil {(!(isengineon _unit) or (getpos _unit select 2) == 0)};
_unit engineon true;

I've not fully tested the second option.

The above code (your post) will work if you had placed a trigger with this in the condition

!(isengineon  nameofunit)

on act

nul[nameofunit] execvm "script.qsf"

That will run the script when the AI turn off the engines.

Edited by F2k Sel

Share this post


Link to post
Share on other sites

Yeah, it's in a land waypoint. Is there anyway that the script can include some sort of check to see if the chopper was on the ground? Maybe some sort of getPosAlt 0 thing? Not too good at scripting, really. I'll try the first script and increase the sleep amount. I expect it's seconds and it does seem to be hovering and flying around a bit before it does land.

Anywho, thanks. And if you can include that altitude check then I'd be very gratefull! :bounce3:

Share this post


Link to post
Share on other sites

It's in the second script. Looking again the original code should have worked as is as it should wait until the engine is tuned off.

I've just checked again the script does work I'd miss spelt the unit name.

make sure you pass the correct name of the unit to the code and the original code will work fine.

example of call code

nul=[choppername] execvm "scrip.sqf"

Share this post


Link to post
Share on other sites

Ah, ok, thanks. Just trying it now!

---------- Post added at 05:44 PM ---------- Previous post was at 05:39 PM ----------

Yup, she's working fine now. I think it's because I was putting null rather than nul but it didn't flag up with any errors on either account so I could be wrong. Anywho, thanks. :yay:

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  

×