dave317 0 Posted February 23, 2008 Apparently this is supposed to force troops in a heli out when it lands but as soon as the script starts the troops jump out to their death and the heli lands afterwards. Â Can anyone help fix it? Â Its not my own script just one i found on another ARMA site. ;Script created by Storm aka. 6thStorm. ;This script will force people from choppers to disembark when it's on the ground. ;put this line in the waypoint: [Group, Chopper] exec "Offload.sqs" ;ex. [Rangers, BlackHawk] exec "Offload.sqs" _group = _this select 0 _chopper = _this select 1 _group lockWP true group driver _chopper lockWP true _chopper land "LAND" _groupunits = Units _group _Everyone = Count _GroupUnits _Count = 0 #Getout _ThisUnit = _groupunits Select _Count UnassignVehicle _ThisUnit _ThisUnit action ["getout", _chopper] ? !alive _ThisUnit; goto "Check" #Check _Count = _Count + 1 ? (_Count < _Everyone) : goto "Getout" _group lockWP false group driver _chopper lockWP false Share this post Link to post Share on other sites
Op4 BuhBye 0 Posted February 23, 2008 You need a loop or condition that checks the helo height before executing the eject command. Share this post Link to post Share on other sites
dave317 0 Posted February 23, 2008 Any clues how to do that? I am a complete noob when it comes to scripting. Share this post Link to post Share on other sites
TheJay 0 Posted February 23, 2008 The way I solved this problem was a little different. I used the orderGetIn command. When this is called the helicopter automatically lands and lets them out and takes off again. You have to make sure you have a landing pad for them to land at since they only land on one of them. The invisible landing pad works great. Then you need to use allowGetIn to prevent them from getting back into the helicopter. If you don't they will get out and then get right back in again. Share this post Link to post Share on other sites
dave317 0 Posted February 24, 2008 Thanks TheJay i'll give that a try. Can anyone fix the script though, it would be nice to have it working. Share this post Link to post Share on other sites
snkman 351 Posted February 25, 2008 Well here is a working version with what you need also an example mission is included too. Note: The script let unmount the Chopper crew only pilots will not unmount the Chopper but this can be simply changed if need. Unmount Chopper Hope this is what you was looking for. Oh just to let you know: To check the flight heigh of a Chopper simply do that: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> while {getPos _Chopper select 2 > 5} do { sleep 1; }; hint "The Chopper flight height is less then 5m"; Now the script will loop till the Choppers flight heigh is less then 5m and then you get a hint message telling you "The Chopper flight height is less then 5m" pretty simple. Share this post Link to post Share on other sites
dave317 0 Posted February 25, 2008 Thanks SNKMAN the unmount script is fine but the chopper doesn't take off after the troops have jumped out. I would also like all of them to jump out at the same time like a fast insertion. I don't know where to put your code sample either so i still can't get the original script to work. Share this post Link to post Share on other sites
dave317 0 Posted February 26, 2008 Can anyone help with this or reccomend a good working fast insertion script? Share this post Link to post Share on other sites
mattxr 9 Posted February 27, 2008 Use this... Use this command in a trigger for the helicopter to activate near the LZ.. the WP1 can be anything i usually use a Invisable(H) Quote[/b] ][chopper,wp1] exec "Scripts\land_chopper.sqs"; land_chopper.sqs Quote[/b] ];?!(local server) : exit ; force a chopper to land v1.3 ; changes: ; 1.4 - removed the double check to ensure the waypoint is not activated. was causing issues. ; 1.3 - added the variables var_getout, var_unload and var_eject which will make the units ; in the chopper either getout (all units), unload (all units bar driver and gunner) or ; eject (all units bail out at one second intervals, gunner and driver last) ; 1.2 - script can be cancelled at any time by setting 'var_cancel_landing' equal to the chopper ; 1.2 - the 'fly out height' can be set via the variable '_flyouthgt' ; 1.1 - added the velocity check to ensure the chopper has slowed before touching down ; 1.1 - added the check for Ch47D so the bigger chopper lands well ; by snYpir ; can be called with: ; [unit to land,position where it is to land (should be a waypoint)] exec "land_chopper.sqs" ; to cancel a landing: ; set 'var_cancel_landing = choppername' in the on-activation field of the waypoint previously passed ; into this script ; to force all to disembark from the chopper ; set 'var_getout = choppername' in the on-activation field of the waypoint previously passed ; into this script ; to force cargo units to disembark from the chopper ; set 'var_unload = choppername' in the on-activation field of the waypoint previously passed ; into this script ; to force all to eject from the chopper ; set 'var_eject = choppername' in the on-activation field of the waypoint previously passed ; into this script or anywhere for that matter ; this is the unit we want to force to land _unit = _this select 0 ; this is a position where the chopper will land (expected to be the chopper's waypoint) _landingpos = _this select 1 ; this is the distance away from _landingpos to make the chopper drop to earth ; needs to be big for larger, less manouverable choppers (40 for chinooks) ; 30 is good for blackhawks and 20 is good for hueys. Default is 30 _mindis = 20 ; this is the height the chopper will hover once 'landed' (minimum is 2). If you increase this value, ; the chopper will hover off the ground _minheight = 2 ; this is the maximum speed that the chopper will touch down at. it will not touch down until it is ; going slower than this speed. increase for flare landings (to around 25). careful, some choppers (such ; as blackhawks) don't do flare landings very well. The default for this value is 15. ;_landvel = 15 _landvel = 20 ; this is the 'fly out height' if the landing is cancelled _flyouthgt = 30 ; this check can be taken out if you wish. it simply increases the landing distance and slows the ; landing speed for chinooks. you could add other 'big' helicopter types if you wish ? "Ch47D" counttype [_unit] == 1 : _mindis = _mindis * 2; _landvel = _landvel / 2 ; ----------- edit beyond here at own risk ------------ ; get initial height of chopper _hgt = getpos _unit select 2 _driver = driver _unit ;_gunner = gunner _unit ;_grp = group _driver _driver lockwp true _getout = false _eject = false _cancel = false _unload = false ? _minheight < 2 : _minheight = 2 ; get distance chopper to landing pos at start _x1 = _landingpos select 0 _y1 = _landingpos select 1 _x2 = getPos _unit select 0 _y2 = getPos _unit select 1 _dis = sqrt( (_x1-_x2)^2 + (_y1-_y2)^2 ) ; determine ratio _ratio = _dis / _hgt #loop _x1 = _landingpos select 0 _y1 = _landingpos select 1 _x2 = getPos _unit select 0 _y2 = getPos _unit select 1 _dis = sqrt( (_x1-_x2)^2 + (_y1-_y2)^2 ) _unit flyinheight (_dis / _ratio) ~0.1 ? _dis < _mindis : goto "end" ? var_cancel_landing == _unit : _cancel = true; var_cancel_landing = nil; goto "end2" ? var_eject == _unit : _eject = true; var_eject = nil; goto "end2" ? var_getout == _unit : _getout = true; var_getout = nil ? var_unload == _unit : _unload = true; var_unload = nil ? !alive _driver : exit ; has the unit slowed (maybe missed the waypoint?) drop the unit where it is _x = ((velocity _unit select 0) * sin (getdir _unit)) * 3.445 _y = ((velocity _unit select 1) * cos (getdir _unit)) * 3.445 ? (_x + _y) < 20 : goto "end" goto "loop" #end ; drop the chopper close to the ground _unit flyinheight _minheight * 2 ; pause until the chopper has almost stopped #velloop ~0.1 ? var_cancel_landing == _unit : _cancel = true; var_cancel_landing = nil; goto "end2" ? var_eject == _unit : _eject = true; var_eject = nil; goto "end2" ? var_getout == _unit : _getout = true; var_getout = nil ? var_unload == _unit : _unload = true; var_unload = nil _dir = getdir _unit _x = ((velocity _unit select 0) * sin _dir) * 3.445 _y = ((velocity _unit select 1) * cos _dir) * 3.445 _xy = _x + _y ? _xy > _landvel : goto "velloop" ; put the chopper on the ground _unit flyinheight _minheight #endloop ? var_cancel_landing == _unit : _cancel = true; var_cancel_landing = nil; goto "end2" ? var_eject == _unit : _eject = true; var_eject = nil; goto "end2" ? var_getout == _unit && !_getout : _getout = true; var_getout = nil; goto "end2" ? _getout : goto "end2" ? var_unload == _unit && !_unload : _unload = true; var_unload = nil; goto "end2" ? _unload : goto "end2" ? !alive _driver : exit ~0.1 goto "endloop" #end2 ; added in 1.3 - force all of the occupants of _unit to get out? ? _cancel : goto "nogetout" ? _eject : goto "ejectnow" ; wait until the chopper is on the ground? @getpos _unit select 2 < 2 ; get units out of chopper #ejectnow _ejectpause = 0.5 ? _eject : _ejectpause = 1 _aR_crew = crew _unit ; eject units _i = 0 #loop_eject ? (_aR_crew select _i) != _driver : (_aR_crew select _i) action ["EJECT", _unit]; unassignvehicle (_aR_crew select _i) ~_ejectpause _i = _i + 1 ? _i != count _aR_crew : goto "loop_eject" ; get the pilot and gunner out if not unloading ? _unload : goto "unload" _driver action ["EJECT", _unit]; unassignvehicle _driver #unload @(count crew _unit == 0 && !_unload) || (count crew _unit == 1 && _unload) #nogetout ; make sure the message gets through and the waypoint is unlocked _pos = getpos _driver #stupidailoop _unit flyinheight _flyouthgt _driver lockwp false ~0.5 _x1 = _pos select 0 _y1 = _pos select 1 _x2 = getPos (leader _grp) select 0 _y2 = getPos (leader _grp) select 1 _dis = sqrt( (_x1-_x2)^2 + (_y1-_y2)^2 ) ? _dis < 10 : goto "stupidailoop" exit Share this post Link to post Share on other sites
dave317 0 Posted February 27, 2008 Thanks Matt. The chopper lands really well but the troops just sit in it and don't get out. Do i need to change anything in the script or should anyone in cargo just get out? Share this post Link to post Share on other sites
mattxr 9 Posted February 27, 2008 Well on mine they all get ejected straight away.. let me see. Share this post Link to post Share on other sites
dave317 0 Posted February 27, 2008 OK i've got it to work and it is very good but the gunners of blackhawks get out with the troops then the chopper has to land to pick them up again. Also with different choppers it takes longer for them to get out. I tried it using a Bush Wars Puma and they take forever to get out but in the Blackhawk they jump out as soon as it touches down. Share this post Link to post Share on other sites
dave317 0 Posted March 1, 2008 Don't suppose you have had a chance to check this yet Matt? Share this post Link to post Share on other sites