Jump to content
Sign in to follow this  
AdirB

flyHeight

Recommended Posts

Hello,

I've placed a helicopter and crew into it, then placed some waypoints, I noticed that the helicopter is flying too hight. 

I tried add flyInHeight to it but it didn't work, the helicopter keeps flying at the same height as before.

 

_newGroup = createGroup west;
 huey = createVehicle ['uns_UH1D_m60', [5003.04,2815.03,-0.0327282], [], 0, 'CAN_COLLIDE'];
 createVehicleCrew huey;
 (crew huey) join _newGroup;
 huey setDir 270.248;
 huey setFormDir 270.248;
 huey setPosASL [5003.04,2815.03,2.15442];
 huey flyInHeight 130;
_newGroup setFormation 'WEDGE';
 _newGroup setCombatMode 'YELLOW';
 _newGroup setBehaviour 'AWARE';
 _newGroup setSpeedMode 'FULL';
_newWaypoint = _newGroup addWaypoint [[3951.13,2740.73,60.0124], 0];
 _newWaypoint setWaypointType 'MOVE';
  _newWaypoint = _newGroup addWaypoint [[2925.31,2624.3,42.4365], 0];
 _newWaypoint setWaypointType 'MOVE';
  _newWaypoint = _newGroup addWaypoint [[2223.6,2457.53,59.2037], 0];
 _newWaypoint setWaypointType 'MOVE';
  _newWaypoint = _newGroup addWaypoint [[2061.34,1288.5,76.865], 0];
 _newWaypoint setWaypointType 'MOVE';
  _newWaypoint = _newGroup addWaypoint [[879.747,2052.24,-2.28882e-005], 0];
 _newWaypoint setWaypointType 'MOVE';

 

Share this post


Link to post
Share on other sites

instead of this
huey flyInHeight 130;

 

try
 

(huey select 0) flyInHeight 130;

so give the height not to whole array but just to helicopter.
Also give the z coordinate to the waypoints properly
 

Share this post


Link to post
Share on other sites
33 minutes ago, Devastator_cm said:

instead of this
huey flyInHeight 130;

 

try
 

(huey select 0) flyInHeight 130;

so give the height not to whole array but just to helicopter.
Also give the z coordinate to the waypoints properly
 

Thanks for your response!

 

I get this error when running the script after replacing the lines.

Quote

11:46:33 Error in expression <PosASL [5003.04,2815.03,2.15442];(huey select 0) flyInHeight 130;_newGroup set>

11:46:33   Error position: <select 0) flyInHeight 130;
_newGroup set>
11:46:33   Error select: Type Object, expected Array,String,Config entry
11:46:33 File C:\Users\ME\Documents\Arma 3 - Other Profiles\ME\missions\Vietnam.RungSat\mission_scripts\huey_crash\spawn_huey.sqf, line 8

I have no idea what it means.

Share this post


Link to post
Share on other sites

hmm I thought you are using BIS functuion
Can you try this code and inform me?

 


_newGroup = createGroup west;
huey = [[5003.04,2815.03,2.15442], 270.248, "uns_UH1D_m60", _newGroup] call BIS_fnc_spawnVehicle;

 (huey select 0) flyInHeight 130;
_newGroup setFormation 'WEDGE';
 _newGroup setCombatMode 'YELLOW';
 _newGroup setBehaviour 'AWARE';
 _newGroup setSpeedMode 'FULL';
_newWaypoint = _newGroup addWaypoint [[3951.13,2740.73,60.0124], 0];
 _newWaypoint setWaypointType 'MOVE';
  _newWaypoint = _newGroup addWaypoint [[2925.31,2624.3,42.4365], 0];
 _newWaypoint setWaypointType 'MOVE';
  _newWaypoint = _newGroup addWaypoint [[2223.6,2457.53,59.2037], 0];
 _newWaypoint setWaypointType 'MOVE';
  _newWaypoint = _newGroup addWaypoint [[2061.34,1288.5,76.865], 0];
 _newWaypoint setWaypointType 'MOVE';
  _newWaypoint = _newGroup addWaypoint [[879.747,2052.24,-2.28882e-005], 0];
 _newWaypoint setWaypointType 'MOVE';

 

Share this post


Link to post
Share on other sites
17 minutes ago, Devastator_cm said:

hmm I thought you are using BIS functuion
Can you try this code and inform me?

 



_newGroup = createGroup west;
huey = [[5003.04,2815.03,2.15442], 270.248, "uns_UH1D_m60", _newGroup] call BIS_fnc_spawnVehicle;

 (huey select 0) flyInHeight 130;
_newGroup setFormation 'WEDGE';
 _newGroup setCombatMode 'YELLOW';
 _newGroup setBehaviour 'AWARE';
 _newGroup setSpeedMode 'FULL';
_newWaypoint = _newGroup addWaypoint [[3951.13,2740.73,60.0124], 0];
 _newWaypoint setWaypointType 'MOVE';
  _newWaypoint = _newGroup addWaypoint [[2925.31,2624.3,42.4365], 0];
 _newWaypoint setWaypointType 'MOVE';
  _newWaypoint = _newGroup addWaypoint [[2223.6,2457.53,59.2037], 0];
 _newWaypoint setWaypointType 'MOVE';
  _newWaypoint = _newGroup addWaypoint [[2061.34,1288.5,76.865], 0];
 _newWaypoint setWaypointType 'MOVE';
  _newWaypoint = _newGroup addWaypoint [[879.747,2052.24,-2.28882e-005], 0];
 _newWaypoint setWaypointType 'MOVE';

 

He still flies very high, he gets to 400 meters.

 

Also the helicopter started with the engine above ground.

Share this post


Link to post
Share on other sites

are you not missing the bold part? Also is the name of the Huey appearing as Huey in the vehicle attributes?

this Huey FlyinHeight 30 

Share this post


Link to post
Share on other sites

ok if you want it to be on the ground with engine off then we are back to the command instead of function

I set the attitude to 40 meters.

Also put the 40 meter to z coordinate of each waypoint as you can see.

I used vanilla helicopter as I don't have huey :)
It looks to me working give a try please

_newGroup = createGroup west;
 _huey = createVehicle ['B_Heli_Transport_01_F', [1770,5543,-0.0327282], [], 0, 'CAN_COLLIDE'];
 createVehicleCrew _huey;
 (crew _huey) join _newGroup;
 _huey setDir 270.248;
 _huey setFormDir 270.248;
 _huey setPosASL [1770,5543,2.15442];
 _huey flyInHeight 40;
_newGroup setFormation 'WEDGE';
 _newGroup setCombatMode 'YELLOW';
 _newGroup setBehaviour 'AWARE';
 _newGroup setSpeedMode 'FULL';
_newWaypoint = _newGroup addWaypoint [[3951.13,2740.73,40], 0];
 _newWaypoint setWaypointType 'MOVE';
  _newWaypoint = _newGroup addWaypoint [[2925.31,2624.3,40], 0];
 _newWaypoint setWaypointType 'MOVE';
  _newWaypoint = _newGroup addWaypoint [[2223.6,2457.53,40], 0];
 _newWaypoint setWaypointType 'MOVE';
  _newWaypoint = _newGroup addWaypoint [[2061.34,1288.5,40], 0];
 _newWaypoint setWaypointType 'MOVE';
  _newWaypoint = _newGroup addWaypoint [[879.747,2052.24,40], 0];
 _newWaypoint setWaypointType 'MOVE';

 

Share this post


Link to post
Share on other sites
4 minutes ago, Devastator_cm said:

ok if you want it to be on the ground with engine off then we are back to the command instead of function

I set the attitude to 40 meters.

Also put the 40 meter to z coordinate of each waypoint as you can see.

I used vanilla helicopter as I don't have huey :)
It looks to me working give a try please


_newGroup = createGroup west;
 _huey = createVehicle ['B_Heli_Transport_01_F', [1770,5543,-0.0327282], [], 0, 'CAN_COLLIDE'];
 createVehicleCrew _huey;
 (crew _huey) join _newGroup;
 _huey setDir 270.248;
 _huey setFormDir 270.248;
 _huey setPosASL [1770,5543,2.15442];
 _huey flyInHeight 40;
_newGroup setFormation 'WEDGE';
 _newGroup setCombatMode 'YELLOW';
 _newGroup setBehaviour 'AWARE';
 _newGroup setSpeedMode 'FULL';
_newWaypoint = _newGroup addWaypoint [[3951.13,2740.73,40], 0];
 _newWaypoint setWaypointType 'MOVE';
  _newWaypoint = _newGroup addWaypoint [[2925.31,2624.3,40], 0];
 _newWaypoint setWaypointType 'MOVE';
  _newWaypoint = _newGroup addWaypoint [[2223.6,2457.53,40], 0];
 _newWaypoint setWaypointType 'MOVE';
  _newWaypoint = _newGroup addWaypoint [[2061.34,1288.5,40], 0];
 _newWaypoint setWaypointType 'MOVE';
  _newWaypoint = _newGroup addWaypoint [[879.747,2052.24,40], 0];
 _newWaypoint setWaypointType 'MOVE';

 

It's just the same as the first script I sent in the OP so I just need to set the Z parameter?

Share this post


Link to post
Share on other sites

I also used local variable for Huey (_huey) instead of global one and yes waypoint z coordinate is important because when wp gets active it will let helicopter to adjust its height

Share this post


Link to post
Share on other sites
2 minutes ago, Devastator_cm said:

I also used local variable for Huey (_huey) instead of global one and yes waypoint z coordinate is important because when wp gets active it will let helicopter to adjust its height

The variable have to be local? I'm asking because I'm using it in other file too.

Share this post


Link to post
Share on other sites

how do you call this code? Trigger?

for example
https://community.bistudio.com/wiki/flyInHeight

this command requires local argument. Which means code need to run where the vehicle is local.

I usually use local variables unless global is not necessary

 

I beleive problem was z coordinate of WPs by you and not the locality

Share this post


Link to post
Share on other sites
1 minute ago, Devastator_cm said:

how do you call this code? Trigger?

for example
https://community.bistudio.com/wiki/flyInHeight

this command requires local argument. Which means code need to run where the vehicle is local.

I usually use local variables unless global is not necessary

 

I beleive problem was z coordinate of WPs by you and not the locality

I call the script by a trigger spwaned in a script yes, I "told" the trigger to wait till the helicopter is in the trigger.

Share this post


Link to post
Share on other sites
19 minutes ago, Devastator_cm said:

how do you call this code? Trigger?

for example
https://community.bistudio.com/wiki/flyInHeight

this command requires local argument. Which means code need to run where the vehicle is local.

I usually use local variables unless global is not necessary

 

I beleive problem was z coordinate of WPs by you and not the locality

I tried it again. He still flies very high.. I don't know what is going on.

Share this post


Link to post
Share on other sites

can you upload your mission so I can take a look, because by me it works fine.
Also try to use the vanilla helicopter

Share this post


Link to post
Share on other sites
18 minutes ago, Devastator_cm said:

can you upload your mission so I can take a look, because by me it works fine.
Also try to use the vanilla helicopter

Sure, a link can be found in your inbox.

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  

×