Home   Help Search Login Register  

Author Topic: Mando Heliroute  (Read 3821 times)

0 Members and 1 Guest are viewing this topic.

Offline the corinthian

  • Members
  • *
  • I'm a llama!
Mando Heliroute
« on: 28 Jun 2007, 20:39:25 »
Hiya

I've been reading through threads looking at ways that people have created to get a heli to land at a fixed position. I found the mandoheliroute script and have put it into Arma but I cant get it to work.

I have created a marker called mk_land at the position I want the heli to land and Im calling the script using a radio trigger. When I activate the trigger the heli starts moving but then seems to fly off to a certain point on the map (which changes depending where I have the marker) and just hovers there.

Does anyone have a test mission in arma where this is working so I can see how it should be implemented?

Thanks

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Mando Heliroute
« Reply #1 on: 28 Jun 2007, 20:43:54 »
Didnt test it yet in ArmA. But one thing you'll need to change is the camCreates there for the logics, change them by createVehicle.

Offline the corinthian

  • Members
  • *
  • I'm a llama!
Re: Mando Heliroute
« Reply #2 on: 02 Jul 2007, 20:49:15 »
Hi again

I did what you suggested Mando and changed the Camcreate commands to createvehicle ones and now the heli moves to the extraction point and lands.

One thing I noticed though is that I do not have the scripts called "landed.sqs" and "ejectnow.sqs", where can I get these please?

Also while I am thankful that I can precisely position a heli landing spot I would like to see the heli descend a little faster as it is closing on the landing zone - Im looking to get a quick heli drop-off as though the heli was landing in a hot LZ. Currently the script moves the heli at eg 100m to the point and then starts to land, I thought maybe triggering the landing script once the heli is say 100 or 50m away might improve this but Im not sure how to do it as I am not a scripting god like yourself? Ill have a go though but could you offer some advice?

Thanks


Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Mando Heliroute
« Reply #3 on: 02 Jul 2007, 20:56:17 »
LOL, You saw that script working in ArmA before than me  ;)
I still dont know how it behaves in ArmA, need to check it, may be this week.

Offline the corinthian

  • Members
  • *
  • I'm a llama!
Re: Mando Heliroute
« Reply #4 on: 06 Jul 2007, 16:18:41 »
Im currently trying to get it reducing its altitude when the distance from the landing zone is the same as the height at which the heli is travelling. In the loop you have that constantly directs the heli to the landing zone I need to change the script so that if travelling at 100m say then once it gets to 100m of the landing zone then is starts to reduce the altitude at the same time as continually checking and pointing in the correct direction.

Basically I need to incorporate the landing section inside the section that guides the heli there in the first place and then add a condition that reduces the altitude once the distance to landing zone < height

Havent got it working yet but Im not a scripting god. Ill keep trying though...

Offline SniperUK

  • Members
  • *
  • I'm a llama!
Re: Mando Heliroute
« Reply #5 on: 06 Jul 2007, 17:01:35 »
I will write a script for this and attach it, as i mentioned in another post i have already beta tested the hell out of one of my scripts with some people on a dedicated server, and the chopper performs perfect everytime....no unexpected behavior, nothing, he does as he is told to do.
This script allows you to call the chopper to a certain marker and land.
One of the massive things i did, is that whereever i put the marker, i spawned an invisible landing pad, this acts kinda like a game logic, and when the chopper is in the area and told to land, he favours landing on the landing pad 100% of the time (which just so happens to have been spawned where u marked the map) rather than landing randomly in the area. Once the chopper takes back off u then delete the invisible landing pad. Job done.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Mando Heliroute
« Reply #6 on: 06 Jul 2007, 17:11:28 »
100m say then once it gets to 100m of the landing zone then is starts to reduce the altitude at the same time as continually checking and pointing in the correct direction.

That may be a problem. That script was conceived to achieve two goals:
1 - no more resolving-path timeouts, so you may send a chopper from one side of the island to the other side.
2 - to be able to land anywhere with 1.5m maximum deviation. And this includes streets with high buildings around the landing point. So, if you make it to start descending before reaching the landing point vertical, the chopper will crash against surrounding  buildings, tall trees, electric or telephone poles, etc.

Offline the corinthian

  • Members
  • *
  • I'm a llama!
Re: Mando Heliroute
« Reply #7 on: 06 Jul 2007, 17:15:21 »
Hi

The positioning of the heli isnt the problem, Mando's script gets the positioning bang on. All I want to change is the way the heli approaches and lands.

At present it flies at 100m until it gets to the landing zone then does a straight drop down onto the zone. Id like to see it start the descent at 100m out and then to reduce the altitude incrementally as the script also positions the heli.

Mando - I appreciate that the heli will do that however for the situation I need the landing area is quite open so it wont be an issue, its more the speed at which the heli approahces, lands and then takes off again that I am looking for. Im trying to make a sort of accurate heli dust-off script so I can have a Littlebird for example fly to the point the soldiers disembark and the heli takes off again. It needs to be quick though as currently the whole landing thing takes too long and the heli gets shot down.
« Last Edit: 06 Jul 2007, 17:19:15 by the corinthian »

Offline SniperUK

  • Members
  • *
  • I'm a llama!
Re: Mando Heliroute
« Reply #8 on: 06 Jul 2007, 17:24:51 »
Well you can alter the speed by incementally changing the speed mode:

Something like :

heli setSpeedMode "LIMITED"

Which if you activate it at the right time before landing will cause the heli to start slowing down.

Offline the corinthian

  • Members
  • *
  • I'm a llama!
Re: Mando Heliroute
« Reply #9 on: 06 Jul 2007, 17:31:29 »
The heli does slow down when it reaches a set distance - this is included in Mando's script.

The script works really well but the heli travels at the same height all the way to the landing point and then makes a vertical descent 90 degrees to the ground. Its been designed this way for a reason as Mando posted earlier. I just need to alter it so that it starts reducing height before it reaches the landing point.  So when it does finally get there its already at say 5m or something and started its descent from about 100m away.


Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Mando Heliroute
« Reply #10 on: 06 Jul 2007, 18:23:03 »
May you most here your mando Heliroute for ArmA? I'll have a look at it, may be we can solve the problem with a new parameter, so, if 0, it does what it currently does, if > 0 it will initiate the descend earlier.

Offline the corinthian

  • Members
  • *
  • I'm a llama!
Re: Mando Heliroute
« Reply #11 on: 06 Jul 2007, 20:48:33 »
Code: [Select]
;mandoheliroute.sqs by Mandoble
;
;Allows long flying traves avoiding timeouts while resolving routes.
;Allows accurate landings at destination position with only 1.5m possible deviation.
;Allows accurate landings even as close as 2 meters away from the taking off point
;
;Arguments:
;Helicopter unit
;Final position
;Maximum length in meters of each travel segment (2000-4000 are safe values)
;Flying height (-1 if does not apply, maximum allowed is 80m)
;Maximum allowable damage before ejecting
;Final aproach at limited speed or not (true/false)
;Script to be executed upon arrival or after landing (receives helicopter as argument), "" if not needed.
;Script to be executed when ejecting (receives helicopter as argument), "" if not needed.
;Land true/false
;Descend velocity in m/s if land is true
;Minimum alt in meters to stop engines if land is true (>=0.2)
;Camera following helicopter true/false
;
;Notes:
;"mandoheliroute" global variable is updated with the following values:
; 1 - Helicopter is moving to destination
; 2 - Helicopter has reached destination
; 3 - Helicopter has landed at destination (only if land parameter is true)
; 4 - Helicopter got too much damage, eject script executed if provided.
;
;Example:
;heli1 will move from current position to "mk_land" marker pos in "steps" of 2Km and at a height of 40m
;If heli1 gets more than 0.5 damage, ejectnow.sqs will be executed
;Once the destination is reached, heli1 will land, descending at 4m/s and will stop its engine
;when closer to 0.2m of any surface (ground, sea, roofs), once landed and stopped, landed.sqs will be executed.
;The camera will follow heli1 until fully landed.
;[heli1,getMarkerPos "mk_land",2000,40,0.5,false,"landed.sqs","ejectnow.sqs",true,-4,0.2,true]exec"mandoheliroute.sqs"

_heli          = _this select 0
_finpos        = _this select 1
_length        = _this select 2
_height        = _this select 3
_maxdmg        = _this select 4
_slowaproach   = _this select 5
_arrivalscript = _this select 6
_ejectscript   = _this select 7
_land          = _this select 8
_veldown       = _this select 9
_minalt        = _this select 10
_camera        = _this select 11

?_height > 80:_height = 80
?_maxdmg > 0.9:_maxdmg = 0.9
?_camera: _heli switchCamera "EXTERNAL"

;Global to use from external scripts, indicates the helicopter is moving to destination
mandoheliroute = 1

_pilot = driver _heli
_pos1 = [getPos _heli select 0,getPos _heli select 1,0]
_log1 = "logic" createvehicle _pos1
_log2 = "logic" createvehicle _finpos
_log3 = "logic" createvehicle [0,0,0]
_dist = _log1 distance _log2
_ang = ((_finpos select 0) - (_pos1 select 0)) atan2 ((_finpos select 1) - (_pos1 select 1))
_steps = _dist / _length
_i = 0
_pos = _pos1

?_height > 0:_heli flyInHeight _height;_pilot Move getPos _heli

#move
_dist = _log1 distance _log2
?_dist > _length:_dist = _length
_pos = [(_pos select 0) + sin(_ang)*_dist,(_pos select 1) + cos(_ang)*_dist]
_log3 setPos _pos
?_height > 0:_heli flyInHeight _height
_pilot Move _pos
~1
@((_heli distance _log3) < 1000) || (damage _heli > _maxdmg)
?(damage _heli > _maxdmg): goto "eject"
?(_heli distance _log2) < 1050: goto "goal"
_log1 setPos _pos
_i = _i + 1
?_i < _steps:goto "move"

#goal
?_height > 0:_heli flyInHeight _height
?_slowaproach:group _pilot setSpeedMode "LIMITED"
_pilot Move _finpos
~1
@(unitReady _pilot) || (damage _heli > _maxdmg) || ((_heli distance _log2)<200.0)
?(damage _heli > _maxdmg): goto "eject"
?((_heli distance _log2) < 200.0) && _land:mandoheliroute = 2;goto "landsequence"
@(unitReady _pilot) || (damage _heli > _maxdmg)
?(damage _heli > _maxdmg): goto "eject"
mandoheliroute = 2
?_arrivalscript != "":[_heli]exec _arrivalscript
#exit
?_slowaproach:group _pilot setSpeedMode "NORMAL"
deleteVehicle _log1
deleteVehicle _log2
deleteVehicle _log3
~5
?_camera: player switchCamera "EXTERNAL"
exit

#eject
mandoheliroute = 4
?_ejectscript != "":[_heli]exec _ejectscript
goto "exit"


#landsequence
?_veldown > -1:_veldown = -4
?_veldown < -6:_veldown = -4
?_minalt < 0.2:_minalt = 0.2
hint "LAND"
?_height > 0:_heli flyInHeight _height
?_height <= 0:_heli flyInHeight 30
_pilot move getPos _heli
@(getPos _heli select 2) > 25
~1
@((unitReady _pilot)||(damage _heli > _maxdmg))
?(damage _heli > _maxdmg): goto "eject"
@abs(speed _heli)<5.0
_posh = getPos _heli
_ang = ((_finpos select 0)-(_posh select 0)) atan2 ((_finpos select 1)-(_posh select 1))
_dir = getDir _heli
_dif = _ang - _dir
_delta = _dif / 100.0
_i = 0
#aim
_dir = _dir + _delta
_heli setVelocity [0,0,0]
_heli setDir _dir
_i = _i + 1
~0.05
?(damage _heli > _maxdmg): goto "eject"
?_i < 100:goto "aim"


_vel = [10*sin(_dir),10*cos(_dir), 0]
_log = "logic" createvehicle [_finpos select 0, _finpos select 1, _posh select 2]
_distold = 99999
#move2
_heli setVelocity _vel
_heli setDir _dir
~0.05
?(damage _heli > _maxdmg): deleteVehicle _log;goto "eject"
_dist = _log distance _heli
?_dist < _distold:_distold = _dist;goto "move2"
deleteVehicle _log


_vel = [0,0,_veldown]
#descend
_heli setVelocity _vel
_heli setDir _dir
~0.05
?(damage _heli > _maxdmg): goto "eject"
?(getPos _heli select 2) < _minalt:_heli action ["engine off"];_vel = [0,0,0]
?isEngineOn _heli:goto "descend"


_i = 0
#stop
_heli setVelocity _vel
_heli setDir _dir
~0.05
_i = _i + 1
?(damage _heli > _maxdmg): goto "eject"
?_i < 100:goto "stop"
mandoheliroute = 3
?_arrivalscript != "":[_heli]exec _arrivalscript
goto "exit"

Thats the modified working version where it hovers then descends vertically. Does Arma suffer from the same problem as OFP with the heli's over long distances as if not then it would negate the need to segment the trip into smaller parts?

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Mando Heliroute
« Reply #12 on: 06 Jul 2007, 21:38:12 »
Yep, Arma has the same problem, you need something like the heliroute script to travel long distances, else you need to put several move waypoints or ArmA engine stalls and timeouts resolving the path.

I already recovered my old script and it seems to work in ArmA (I'm quite surprised  :blink:), but you'll need to change the _heli action ["engine off"] by _pilot action ["engine off", _heli].

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re: Mando Heliroute
« Reply #13 on: 06 Jul 2007, 22:23:49 »
_pilot action ["engineoff", _heli]


Planck
I know a little about a lot, and a lot about a little.

Offline the corinthian

  • Members
  • *
  • I'm a llama!
Re: Mando Heliroute
« Reply #14 on: 08 Jul 2007, 13:23:47 »
Looking at the above script then which is the easiest way to get it to start doing the descent as it approaches the landing zone as opposed to once its reached it? I was thinking of nesting the landing sequence inside the goal sequence and for the last say 100m reducing the height of the heli as well as guiding it nearer the location.

My attempts to do this though have failed miserably as I am not a scripter.

Another thing that puzzles me is that #goal seems to trigger landsequence when the distance is <200m if this is the case why then does the heli stay at the same height until it reaches the landing zone?

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Mando Heliroute
« Reply #15 on: 08 Jul 2007, 23:25:51 »
You want to start the descend in the #move2 loop, which uses a velocity vector of _vel = [10*sin(_dir),10*cos(_dir), 0]
You may try to change it to _vel = [10*sin(_dir),10*cos(_dir), _veldown] if it is above _minalt and _vel = [10*sin(_dir),10*cos(_dir), _veldown] if it is above _minalt. Add these checks inside #move2 loop:

Code: [Select]
#move2
_vel = [10*sin(_dir),10*cos(_dir), 0]
? (getPos _heli select 2) > _minalt: _vel = [10*sin(_dir),10*cos(_dir), _veldown]

_heli setVelocity _vel
_heli setDir _dir
~0.05
?(damage _heli > _maxdmg): deleteVehicle _log;goto "eject"
_dist = _log distance _heli
?_dist < _distold:_distold = _dist;goto "move2"
deleteVehicle _log

Offline the corinthian

  • Members
  • *
  • I'm a llama!
Re: Mando Heliroute
« Reply #16 on: 10 Jul 2007, 15:51:54 »
I tried the modification you suggested but now what happens is the heli flies along, then when approaches the landing site it does a 320 degree turn then starts gradually reducing height as it approaches the landing zone. It better but its still short of the quick insertion and dust-off method im trying for

Offline ARMAVIDZ

  • Members
  • *
Re: Mando Heliroute
« Reply #17 on: 23 Aug 2007, 07:37:46 »
First off, thank you Mandoble for creating some of the awesome scripts you have. Bypassing engine limitations! ~nice! About the heliroute script:

I tried using this script but the chopper would fly out about two kilometers (give or take) and then come in for a long, high decent on the marker. To make the chopper land in the middle of a street (littlebird) and unload troops the chopper would always collide with a building.

The strange part is if you move the chopper near the second move part of the script, it skips the first part(success) and goes right to final approach. Is there a way to skip the first three parts, takeoff, stage 1, stage 2 and go straight to final approach?

Also, no matter the speed inputted into the init, or trigger, the helo would approach and a brutally slow speed. Any hints or tips would be very much appreciated.

 :good:  ;)
ArmAVidz

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Mando Heliroute
« Reply #18 on: 23 Aug 2007, 09:07:04 »
Well, as said, this is an OFP script and I havent had time to adapt it to ArmA yet, meanwhile you may try mando_land.sqf which works well with harriers and probably will work well also with choppers.

Offline ARMAVIDZ

  • Members
  • *
Re: Mando Heliroute
« Reply #19 on: 23 Aug 2007, 11:51:19 »
Well, as said, this is an OFP script and I havent had time to adapt it to ArmA yet

Oh, sorry Mandoble, I missed that.  :-[  Eagerly waiting for when you can get to it.  :good: I'll give the mando_land.sqf a try. Thanks again!

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Mando Heliroute
« Reply #20 on: 23 Aug 2007, 11:58:39 »
OK, you got me interested into this again (after some years  :P), so expect "something" just for choppers in the very near future  ;)

Offline ARMAVIDZ

  • Members
  • *
Re: Mando Heliroute
« Reply #21 on: 24 Aug 2007, 08:21:19 »
 :clap:  :good:  :D yes!

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Mando Heliroute
« Reply #22 on: 26 Aug 2007, 01:16:33 »