Home   Help Search Login Register  

Author Topic: Question Regarding: Parachuting in General (Solved)  (Read 6639 times)

0 Members and 1 Guest are viewing this topic.

Offline trooper543

  • Members
  • *
Question Regarding: Parachuting in General (Solved)
« on: 18 Oct 2007, 22:10:13 »
Hi there all

I have read the various forum entries on parachuting

Please do bear with me as i am very new to arma mission editing and have very much enjoyed the tutorial that opec have set up and look forward to the next installment!

My question to the community

How do you stop the paras from being spread so far out when they do normal para jump from a plane?

What i am trying to do is:

I have the BE32K airplane / DC3 flyinheight 200 m moving along a waypoint and then i have a trigger which when the aircraft triggers the paras begin their jump sequence

However i have noticed that the troops are very much spread out once they jump and what i would like to know is how do you get them to land in a radius of 50m from their DZ marker. Just that i am trying to simulate static line jump and would like to have so that when they land they are not completly spread out for miles.

i dont know very much about scripting and if there is anyone that can help me out there i would be most grateful. May i also take this oppotunity to say thanks to all those people that make this game more enjoyable each day with the new scripts that they share with the community

Cheers

« Last Edit: 31 May 2008, 00:18:13 by Mandoble »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Question Regarding: Parachuting in General
« Reply #1 on: 19 Oct 2007, 10:56:25 »
Try something a bit extreme, as ejecting all the cargo at once. Lets say the leader of the ejecting group is named "corporal1" and the plane is named "transport1":

Code: [Select]
{_x action ["EJECT", transport1]} forEach units group corporal1
You may start trying the execution of that code from the action of a trigger.

Offline trooper543

  • Members
  • *
Re: Question Regarding: Parachuting in General
« Reply #2 on: 19 Oct 2007, 19:32:35 »
Hi

Thank you for the fast response

The syntax works but it is rather ugly if i am honest,(Please dont think i am unappreicatative  :confused: )just wish BIS had released a proper way of doing this.

I really wish that there was a proper  jumpscript available. that would allow them to jump as they do then drift towards the dz

thanks for the help Mandoble, i really appreciate the help


Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Question Regarding: Parachuting in General
« Reply #3 on: 19 Oct 2007, 20:06:17 »
Code: [Select]
// ejectgroup.sqf
// example:
// res = [plane1, group leader1, 0.5]execVM"ejectgroup.sqf"
_transport = _this select 0;
_group      = _this select 1;
_delay      = _this select 2;
{
   _x action ["EJECT", _transport];
   Sleep _delay;
} forEach units _group;

Offline trooper543

  • Members
  • *
Re: Question Regarding: Parachuting in General
« Reply #4 on: 19 Oct 2007, 20:52:04 »
Where do i start ....

Mandoble this is really fantastic awesome ! Thank you very much, if ever i get the chance to pick up your beer tab then so be it!
It works really cool and i am vey grateful for the help.

If i may ask a question, i have the Mapfact Pack where they give the round type chute (which in my opion i prefer and looks the works.)
Could you perhaps show me how i insert this into this wonderful script of yours.

Sorry for the stupid questions, but my second question is once they jump could they be made to land within a certian radius of a marker?

Please forgive me for such a dumb question.

But once again thank you for the help,


Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Question Regarding: Parachuting in General
« Reply #5 on: 19 Oct 2007, 21:25:17 »
Sorry for the stupid questions, but my second question is once they jump could they be made to land within a certian radius of a marker?

Yes, but it would require heavy scripting to "guide" the chutes to the target. ArmA AI is not able to do it by its own.

Offline trooper543

  • Members
  • *
Re: Question Regarding: Parachuting in General
« Reply #6 on: 19 Oct 2007, 22:32:40 »
Mandoble

Thanks for the response ! I understand that it would take a lot of work

If you dont mind me asking how would it be possible to be able to have the round parachute in the script

Sorry, but i honestly do appreciate the help

Once again cant thank you enough mate


Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Question Regarding: Parachuting in General
« Reply #7 on: 19 Oct 2007, 23:37:19 »
First, get the object class of the parachute you want to use (I assume it comes with an addon)
Not tested, but try the following:

Code: [Select]
// ejectgroup.sqf
// example:
// res = [plane1, group leader1, 0.5]execVM"ejectgroup.sqf"
_transport = _this select 0;
_group      = _this select 1;
_delay      = _this select 2;
{
   _x action ["EJECT", _transport];
   [_x, _transport] spawn
   {
      _unit = _this select 0;
      _veh = _this select 1;
      waitUntil {(vehicle _unit != _unit) && (vehicle _unit != _veh)};
      _veh = vehicle _unit;
      _pos = getPos _veh;
      _dir  = vectorDir _veh;
      _up = vectorUp _veh;
      _vel = velocity _veh;
      deleteVehicle _veh;

      // LOOK HERE TO PUT THE CORRECT CLASS NAME OF YOUR DESIRED CHUTE
      _veh = "your_chute_class_name" createVehicle _pos;
      _veh setPos _pos;
      _veh setVectorDir _dir;
      _veh setVectorUp _up;
      _veh setVelocity _vel;
      _unit moveInDriver _veh;
   };
   Sleep _delay;
} forEach units _group;

Offline trooper543

  • Members
  • *
Re: Question Regarding: Parachuting in General
« Reply #8 on: 20 Oct 2007, 02:48:03 »
Mandoble

You sir are a gentlemen and scholar ! Master and Commander of the scripting world

THANK YOu SIR

The script rocks!


Code: [Select]
//////////////////////////////////////////////////////////////////
// Function file for Armed Assault
// Created by:  Mandoble
// Credit to Mandoble  for the script and Mapfact for the Chute
//////////////////////////////////////////////////////////////////

// ejectgroup.sqf
// example:
// res = [plane1, group leader1, 0.5]execVM"ejectgroup.sqf"
_transport = _this select 0;
_group      = _this select 1;
_delay      = _this select 2;
{
   _x action ["EJECT", _transport];
   [_x, _transport] spawn
   {
      _unit = _this select 0;
      _veh = _this select 1;
      waitUntil {(vehicle _unit != _unit) && (vehicle _unit != _veh)};
      _veh = vehicle _unit;
      _pos = getPos _veh;
      _dir  = vectorDir _veh;
      _up = vectorUp _veh;
      _vel = velocity _veh;
      deleteVehicle _veh;

      // LOOK HERE TO PUT THE CORRECT CLASS NAME OF YOUR DESIRED CHUTE
      _veh = "MAP_OPC_GU" createVehicle _pos;
      _veh setPos _pos;
      _veh setVectorDir _dir;
      _veh setVectorUp _up;
      _veh setVelocity _vel;
      _unit moveInDriver _veh;
   };
   Sleep _delay;
} forEach units _group;

You can close this topic this is one very happy receipent!!!
Once again Mandoble thanks mate !!

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Question Regarding: Parachuting in General
« Reply #9 on: 22 Oct 2007, 15:38:28 »
As for getting your units to land closer to a designated LZ, check your friendly neighbourhood Ed Depot!  Raptosaurus wrote a script for OFPR that does exactly what you want.  Find it here.

Offhand you will need the following changes for ArmA:
1)Change all lines in para_init.sqs that have
Code: [Select]
blah = preProcessFile "blah.sqf"to
Code: [Select]
blah = compile preProcessFile "blah.sqf"
2)As the docs say, you must can add whatever parachute types you want to the following array in the main script
Code: [Select]
_parachutes = ["ParachuteWest", "ParachuteEast", "ParachuteC", "ParachuteG"]You'll have to add your round chute "MAP_OPC_GU":
Code: [Select]
_parachutes = ["ParachuteWest", "ParachuteEast", "ParachuteC", "ParachuteG","MAP_OPC_GU"]
I think it work with these changes but we won't know until you test it. The code is not perfect for ArmA but it may work well enough for your purposes.


« Last Edit: 22 Oct 2007, 15:49:52 by Mr.Peanut »
urp!

Offline trooper543

  • Members
  • *
Re: Question Regarding: Parachuting in General
« Reply #10 on: 22 Oct 2007, 18:52:30 »
@Mr.Peanut

Thanks for pointing me in the right direction Mr Peanut, but alas i am no scripter ,please understand that i am really new to this all,

 "you get noobies, then noobie noobies, then noobie noobie noobies and then you get me  :dunno: Mate i have only just learnt to turn on a PC lol!"

I hope you see the funny side of my comment,

I must admit i sit in awe and amazment at what you guys create and i do find it an inspiration to learn form you guys, but i am a slow learner

at present i am trying to work out how to do the same thing but this time time with ammo boxes

But anyway thanks for the help

Cheers

Offline trooper543

  • Members
  • *
Re: Question Regarding: Parachuting in General
« Reply #11 on: 25 May 2008, 22:16:32 »
hi there all

I was wondering if you guys could again point me in the right direction / correct me /help

i have a dc3 flying along a waypoint and have a trigger that it is activated by the dc3 with the following in the activation field

res = [plane1, group leader1, 0.5]execVM"ejectgroup.sqf"

this works fantastic, however when i try to execute the following scripts(para lz by Raptorsaurus)
 to get the para's to land within a a dz i get an error

i have changed the scripts as Mr peanut suggested but i get an error message that comes something to with "atan ...."

this is what i have in my mission folder

init.sqs
Code: [Select]
[] exec "Para_LZ\para_init.sqs"

exit

para_init.sqs
Code: [Select]
SetObjPosObj = compile preProcessFile  "Para_LZ\Functions\SetObjPosObj.sqf"
RandPos = compile preProcessFile  "Para_LZ\Functions\RandPos.sqf"
IncVeltoTarg = compile preProcessFile  "Para_LZ\Functions\IncVeltoTarg.sqf"
DirOfMove = compile preProcessFile  "Para_LZ\Functions\DirOfMove.sqf"
SetSpd = compile preProcessFile  "Para_LZ\Functions\SetSpd.sqf"
DisOverGnd = compile preProcessFile  "Para_LZ\Functions\DisOverGnd.sqf"
ObjElevObj  = compile preProcessFile  "Para_LZ\Functions\ObjElevObj.sqf"
GetPosOffset = compile preProcessFile  "Para_LZ\Functions\GetPosOffset.sqf"
getAlt = compile preProcessFile  "Para_LZ\Functions\getAlt.sqf"

exit

para_LZ
Quote
;****************************************************************************
;          para_LZ Script by Raptorsaurus
;      v1.2
;
;    Helps control where paratroopers land
;
;****************************************************************************
; this script requires the following functions (included in the {Para_LZ\Functions} folder):

;SetObjPosObj.sqf
;RandPos.sqf
;IncVeltoTarg.sqf
;DirOfMove.sqf
;SetSpd.sqf
;DisOverGnd.sqf
;ObjElevObj.sqf
;GetPosOffset.sqf
;getAlt.sqf

;call the script using this in the initfield of paratrooper, or from script or
;in activation field of trigger or waypoint

;[man, pos, mindis, maxdis, releaseAlt] exec "Para_LZ\para_LZ.sqs"

;further explaination after the code

_unit = _this select 0
_pos = _this select 1
_dismin = _this select 2
_dismax = _this select 3
_alt = _this select 4

;**************************  USER ADJUSTABLE PARAMETERS ***********************************

;array of all parachute types (so script can test for parachute deployment, you can add new parachutes to this list if you know the "typOf" name.)
_parachutes = ["ParachuteWest", "ParachuteEast", "ParachuteC", "ParachuteG"]
;maximum glide ratio of parachute (the horizontal distance vs. vertical drop, so if it moves 6 m forward for each 1 m drop its glide ratio is 6)
_grate = 6
;*********************************************************************************************************

;wait for parachute to be deployed
@ typeOf (vehicle _unit) in _parachutes || ! alive _unit
? (! alive _unit) : goto "end"

_para = vehicle _unit
_typ = typeOf _para

;wait for full deployment and vertical slowdown
~2
@ ((velocity _para select 2) < 5) || ! alive _unit
? (! alive _unit) : goto "end"

_LZ = "logic" createVehicle ([_pos, 0, _dismin, _dismax, -180, 180, 0, 0, 1] call RandPos)
_LZ setPos [getPos _LZ select 0, getPos _LZ select 1, _alt]
_FT= "logic" createVehicle [0,0,0]

_reset = false
_lim = 30
_tinc = 1
_ainc = 20
_smax = 50
_smin = 25
_smod = 20
_ASLi = ( ([_para] call getAlt) select 0)
_DISi = [_para, _LZ] call DisOverGnd
_ang = atan (1 / _grate)
_zoff = (([_LZ, _para] call GetPosOffset) select 2) - (_DISi * tan _ang)
? (_zoff < 0) : _zoff = 0
[_LZ, _FT, 0, 0, _zoff] call SetObjPosObj

#loop
setAccTime 1
_para setVelocity ( ([_para, _FT, _tinc, _ainc, _smod] call IncVeltoTarg) select 0 )
? (speed _para > _smax) : _para setVelocity ([_para, _smax, true] call SetSpd)
? (speed _para < _smin) : _para setVelocity ([_para, _smin, true] call SetSpd)
? ( ([_LZ, _para] call ObjElevObj) > _lim ) : goto "calcang"
~.01
_para setDir ([_para] call DirOfMove)
? (alive _unit) && (typeOf _para == _typ) && ((getPos _unit select 2) > _alt) : goto "loop"

@ (! alive _unit) || (typeOf _para != _typ)
? (alive _unit) : _unit setDir _dir

#end
deleteVehicle _LZ
deleteVehicle _FT
exit

#calcang
_ASLf = ( ([_para] call getAlt) select 0 )
_DISf = [_para, _LZ] call DisOverGnd
_actGR = (_DISi - _DISf) / (_ASLi - _ASLf)
_GRcor = _grate / _actGR
_reqGR = (_DISf / (([_LZ, _para] call GetPosOffset) select 2)) * _GRcor
_ang = atan (1 / _reqGR)
_zoff = ((([_LZ, _para] call GetPosOffset) select 2) - (_DISf * tan _ang))
? (_zoff < 0) : _zoff = 0
_ASLi = ( ([_para] call getAlt) select 0)
_DISi = [_para, _LZ] call DisOverGnd
_grate = _actGR
[_LZ, _FT, 0, 0, _zoff] call SetObjPosObj
_reset = true
_tinc = 5
? (_lim < 80) : _lim = _lim + 5
? (_lim > 60) : _smax = 10; _smin = 5; _smod = 10
goto "loop"

exit

;Parameter Explaination

;[man, pos, mindis, maxdis, releaseAlt] exec "Para_LZ\para_LZ.sqs"

;man - this it the unit who's parachute will be directed to the LZ
;pos - this is the position of the LZ it can be a 2 or 3 dim position ( [x, y, z] or [x , y] ) or
;      it can be a reference object or marker.  For an object as reference use: (getPos objectname)
;      for marker reference use: (getMarkerPos "markername")
;mindis - this is the minimum distance the unit will land from the target area; he WILL not ever
;         land closer than this distance, so this can be used to prevent him from landing in the
;         midst of hostiles if the target area is in the center of hostile territory
;maxdis - this is the maximum distance the unit will land from the target area; he will rarely land
;         further away than this (unless the LZ is upwind from the DZ).
;releaseAlt - this is the altitude at which the script releases control of the chute, it will fall
;             naturally once this altitude is reached.  I generally use a value between 1 and 5.  If
;             you use 0 the unit could be killed or injured because even though his veritcal velocity
;             is slow, his forward velocity might be high enough to cause damage.
;
;Example:

;[player, (getMarkerPos "LZ"), 20, 75, 3] exec "Para_LZ\para_LZ.sqs"

;This will make the player (once his chute deploys), land in a random spot at least 20 m from the
;marker named "LZ" but no further than 75 m from the LZ.  When the player is 3 m above the ground
;the script will release control over to the parachute and it will drift according to the OFP engine
;for the last 3 m.

i attach the zip file of the orginal scripts

please could some one enlighten me on how to fix this

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Question Regarding: Parachuting in General
« Reply #12 on: 26 May 2008, 18:13:38 »
I am only guessing, but it could be a division by zero error. Try changing:
Code: [Select]
_ang = atan (1 / _reqGR)to
Code: [Select]
_ang = atan (1 / (_reqGR + 0.001))and let me know.
« Last Edit: 26 May 2008, 18:43:15 by Mr.Peanut »
urp!

Offline trooper543

  • Members
  • *
Re: Question Regarding: Parachuting in General
« Reply #13 on: 26 May 2008, 19:41:38 »
thnaks for the response mr peanut

i get the following error

_GR cor = _grate # /_actGR

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Question Regarding: Parachuting in General
« Reply #14 on: 26 May 2008, 20:24:13 »
trooper, that code is a bit obsolete with ArmA, I'll try to publish something similar all in a single sqf script as long as free-time allows.