Home   Help Search Login Register  

Author Topic: ejecting/loading heli (low hover)  (Read 1114 times)

0 Members and 1 Guest are viewing this topic.

Offline cj525

  • Members
  • *
ejecting/loading heli (low hover)
« on: 17 Feb 2004, 19:15:16 »
I've been trying to get units to eject and load into a heli in a low hover.

problems:
      ejecting;
                   -initiate eject.sqs, first unit ejects then heli goes into an aggressive climb while ejecting the rest,to a fatal end.

other than putting an eject command for each unit in a trigger or sqs for a simultaneous eject sequence, is there a group eject command out there. I've used the leader action ["eject",heli] comand put that only ejects the leader.

is there a way to prevent the heli from rocketing away
      loading;
                 - the player can board the heli but as soon as the order to board the rest of the team the heli initiates the land sequence.

the problem with this is that if the units are located in bushes the heli will move to an open piece of ground to land, if your in a large valley with elephant grass this creates a problem.

thanks

sa8gecko

  • Guest
Re:ejecting/loading heli (low hover)
« Reply #1 on: 17 Feb 2004, 21:05:37 »
For ejecting people what you need is a sort of script that is used
to parachute, you may find many in the Editors Depot.
The heli probably is trying to recuperate the unit that just disembarked
because you didn't issue the unassignvehicle command.
Down here is a sample of the code:
Code: [Select]
_units = units (_this select 0)
_helicopter = _this select 1
_i = 0
_Max = count _units
#Here
(_units select _i) action ["EJECT",_helicopter]
unassignvehicle (_units select _i)
_i=_i+1
~.3
?_Max>_i:goto "Here"

exit

call this script with : [group_to_eject, chopper] exec "younameit.sqs"
I apologize in advance if someone recognize his own code above.
I have this script, but I'm sorry I don't remember who made it.

As for the pick up sequence, maybe someone else can be more
helpful than me.

Offline cj525

  • Members
  • *
Re:ejecting/loading heli (low hover)
« Reply #2 on: 18 Feb 2004, 21:59:40 »
thanks sa8gecko that solved the problem, I've modified  Skumballs' Helicopter Transport (map click) v1.0, to hover 4' above ground.
 helimove.sqs:
Quote
;Helicopter Transport (map click) v1.0
;by Skumball (simongoddard4@yahoo.co.uk)

_pos = _this select 0

onMapSingleClick {}
2 setRadioMsg "Blackhawk back to base"

"blackhawk" setMarkerType "marker"
"blackhawk" setMarkerPos _pos
hMove setPos [(_pos select 0),(_pos select 1),0]

[_pos] exec "coords.sqs"
heliPilot doMove _pos
heli flyinheight 30
@ (unitReady heliPilot) && ((getPos heli select 2) > 10)
~2
heli flyinheight 4
@ (unitReady heliPilot) && ((getPos heli select 2) < 1)
heliPilot sideChat "Ready"

exit

helibase.sqs:
Quote
;Helicopter Transport (map click) v1.0
;by Skumball (simongoddard4@yahoo.co.uk)

onMapSingleClick {}
2 setRadioMsg "null"

"blackhawk" setMarkerType "empty"

heliPilot sideChat "Heading back"
heliPilot doMove (getPos hBase)
heli flyinheight 30
@ (unitReady heliPilot) && ((getPos heli select 2) > 10)
~2
heli land "land"
@ (unitReady heliPilot) && ((getPos heli select 2) < 1)
heliPilot sideChat "Ready"

exit

using the radio i used the following scripts to load/unload the units.

groupload.sqs:
Quote
_units = units (_this select 0)
_helicopter = _this select 1
_i = 1
_Max = count _units
#Here
(_units select _i) moveincargo _helicopter
(_units select _i) action ["assignascargo",_helicopter]
_i=_i+1
~.3
?_Max>_i:goto "Here"

exit

groupeject.sqs:
Quote
sa8gecko script

the problem you'll find is that the team can board the heli when the heli is on the other side of the island. So I still have to do a check heli pos before enabling the script and also have the team move to the heli then moveincargo to give it a bit of realism.

I would also like to check a radius around the map click where the heli will move to check for objects. If there are objects other than bushes then have the heli hover around 30' and deploy a jungle penetrator with a magurie rigg to pick up the team.

let me know if anyone has any ideas

thanks again

sa8gecko

  • Guest
Re:ejecting/loading heli (low hover)
« Reply #3 on: 19 Feb 2004, 14:16:09 »
You could check the distance between the units of the group and the
heli with the distance command. What you do is: when the pickup
waypoint (or what else it is) is activate you can call a script that check
the distance for each soldier of the group to the heli. You can use two scripts:
the first calls the pickup script for each unit of the group, and the
pickup script checks distance and boards the unit, to evitate that a unit
that is 100 meters away from the others be moved in the chopper.
Then you must check if all units are aboard and release the heli to
its next waypoint :
(next code is untested, execute this after calling the aforementioned
scripts with [group,chopper] exec "this_script.sqs")
Code: [Select]
_units = units (_this select 0)
_helicopter = _this select 1
_i = 0
_aboard =true
_Max = count _units
#Here
? vehicle (_units select _i) != _helicopter:  _aboard = false
_i= _i+1
~.5
? _i < _Max:  goto "Here"
? _aboard: goto "Exit"
_i = 0
_aboard = true
goto "Here"
# Exit
; here set a global variable true to unlock the waypoint
exit

As for the rest: mail me if you can do that ! One thing that could be
done is to place an "emptydetector" or game logic unit above the
pickup point and check its position with the nearestbuilding command.
If you place it high enough it should detect only trees and tall building.
But I've never tangled with nearestbuilding command so I can't
guarantee you that it won't pick up the house 1 km away.
And, still, I don't know if nearestbuilding can detect trees. And, more,
if its range is variable as is nearestobject one, then ...

P.S.: I noted a possible error in groupload.sqs: if you start with
_i=1 then the group leader won't be put aboard the heli.
Lest the group leader is the player and so he boards it by himself.

Offline cj525

  • Members
  • *
Re:ejecting/loading heli (low hover)
« Reply #4 on: 19 Feb 2004, 18:04:29 »
thanks for the reply!

I created a script to check pos of heli, if heli is a certain distance away from team then allow the leader to give the comand to board or eject. I left the team leader out of the script when using the player as the leader. when the comand is given to board I do a getpos of the heli and do a domove of each of the units to the heli pos once the last member is ready "unitready" the moveincargo command is given.  

Code: [Select]
_units = units (lrrpteam)
_helicopter = heli
_i = 1
_Max = count _units
_m = 1
_pos = getpos heli
 
#there
hMove setPos [(_pos select 0),(_pos select 1),0]
[_pos] exec "coords.sqs"
(_units select _m) doMove _pos
_m = _m+1
?_Max>_m:goto "there"

@ (unitready lrrsol)&& ((getPos _helicopter select 2) < 5)
~2
#Here
(_units select _i) moveincargo _helicopter
(_units select _i) action ["assignascargo",_helicopter]
_i=_i+1
~.3
?_Max>_i:goto "Here"

exit

Now I'm not fully versed in coding so there might be some lines which aren't needed. The one problem which I had was in the unit ready check I tried to use this:

@ (unitready (_units select _Max)&& .......

to try to check if last man moved was finished. But this would not work so I inserted the last team members name in to force it to work (I know bad form).

With reguards to the forest check I was thinking along the same line nearestobject but it does a 50m check which would really limit the areas the heli could fly into. Also with the heli only hovering it has a tendancy to slide along the ground for about 50m depending on the terrain, so a check object would have to be a corridoor about 15 by 50. Maybe if the marker dimensions could be made 15 by 50 them do an object check ?

With further thought of the maguire rigg I'm looking at using a rappel script but reversing it and locking the units on the rope and keeping the rope until the heli lands again which would then do a slow descending hover while the units jump off the rope.
Or
As the heli is heading home have the units get to the top of the rope and moveincargo as each unit reaches the top.
Once all units are aboard have the rope removed.
 Anyway I'm going to play around with your script and see how it works.

For now I'm just going to have the team leader inform the heli which type of extraction he thinks he'll need.
thanks again

Offline cj525

  • Members
  • *
Re:ejecting/loading heli (low hover)
« Reply #5 on: 19 Feb 2004, 19:41:19 »
okay I've done a quick mod on Xccess rappel script to have the units climb up the rope.
Code: [Select]
; oneRaple.sqs By XCess
; Edited by Gastovski
; This script is executed from Rapple.sqs, you don't need to call it from anywhere else

_man = _this select 0
_helo = _this select 1

_behave = behaviour _man
_man setbehaviour"CARELESS"

_posx = getpos _helo select 0
_posy = getpos _helo select 1
_posz = getpos _helo select 2
_posm = getpos _man select 2


_man setpos[_posx, _posy]
_man setdir 0

#loop
_posx = getpos _helo select 0
_posy = getpos _helo select 1

_posm = _posm + 0.5

_man setpos [_posx, _posy, _posm]
_man setdir 0
? (getpos _man select 2) >= (_posz - 2)  : goto"load"
~0.5

goto "loop"
# load
; I probably don't need some lines but it seems to be working so i left it.
_man moveincargo _helo

#heloMove
~5
helowaypoint = true
_helo setbehaviour HELOBEHAVIOUR
~5
ropeUp = true


exit

I still have to have the units move to helo pos (I already have that script in the groupload.sqs shown in previous post). what I'm going to do is have the units stop at given points in the rope and stay there until heli starts to land. I think having a guy climb up 25m of rope to heli with gear and weapons is a little unrealistic. Also I'll put a limit to how many units per rope extraction.

If you have any ideas of passing the unit number starting the extraction to stop him at his given point on the rope, between sqs files let me know I'm kinda new to this scripting.

thanks  

sa8gecko

  • Guest
Re:ejecting/loading heli (low hover)
« Reply #6 on: 20 Feb 2004, 07:03:15 »
Quote
Now I'm not fully versed in coding so there might be some lines which aren't needed. The one problem which I had was in the unit ready check I tried to use this:

@ (unitready (_units select _Max)&& .......

to try to check if last man moved was finished. But this would not work so I inserted the last team members name in to force it to work (I know bad form).

The problem here is that _units select _Max doesn't exist.
Last unit in group, using your script is _units select (_Max -1).

As for passing variables through indipendent scripts you can try
using global ones.
If the scripts are not indipendent just call the dependent one
from the first script. If you need a value returned from a script
to another calling it, you can use functions instead.

Offline WizzyWig

  • Members
  • *
  • Mod Maker
    • Oblivion Promotions
Re:ejecting/loading heli (low hover)
« Reply #7 on: 22 Feb 2004, 20:50:39 »
DEmo??

Offline cj525

  • Members
  • *
Re:ejecting/loading heli (low hover)
« Reply #8 on: 23 Feb 2004, 03:08:35 »
demo?

well I'm still working on the maguire rigg. I tried to use the ladder long but the center point of the ladder was about 3 meters off and a couple back when heli is facing north. I used sin and cos functions to find the x and y pos of the door of the slick and setpos of ladder. but I had to rotate the ladder - 90 deg to get it facing the right way. What I found was I had to develop a formula of keeping the ladder in an fixed orbit to the heli while rotating the ladder on an offset orbit(I havn't cracked it yet). I think I'll just have to use O2 and draw a ladder with the center point relative to the left door of the slick.

Until I've done that I'm finishing off a maguire rigg using a rope with fixed positions for six men, I'll release these with the low hover scripts. It will basically be an all in one with the player calling the required extraction.

The low hover  extraction is working fine.  you could use the scripts shown above you just have to put in triggers to enable and disable the ability for the player to give the order to board and exit heli,when the heli is within a certain distance. I'm using a modified Thunder/flash script used in the airborne drops over normandy.