OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: trooper543 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
-
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":
{_x action ["EJECT", transport1]} forEach units group corporal1
You may start trying the execution of that code from the action of a trigger.
-
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
-
// 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;
-
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,
-
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.
-
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
-
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:
// 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;
-
Mandoble
You sir are a gentlemen and scholar ! Master and Commander of the scripting world
THANK YOu SIR
The script rocks!
//////////////////////////////////////////////////////////////////
// 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 !!
-
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 (http://www.ofpec.com/ed_depot/index.php?action=details&id=300&page=0&game=OFP&type=sc&cat=ug).
Offhand you will need the following changes for ArmA:
1)Change all lines in para_init.sqs that have
blah = preProcessFile "blah.sqf"
to
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
_parachutes = ["ParachuteWest", "ParachuteEast", "ParachuteC", "ParachuteG"]
You'll have to add your round chute "MAP_OPC_GU":
_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.
-
@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
-
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
[] exec "Para_LZ\para_init.sqs"
exit
para_init.sqs
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 ;****************************************************************************
; 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
-
I am only guessing, but it could be a division by zero error. Try changing:
_ang = atan (1 / _reqGR)
to
_ang = atan (1 / (_reqGR + 0.001))
and let me know.
-
thnaks for the response mr peanut
i get the following error
_GR cor = _grate # /_actGR
-
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.
-
Mandoble
Once again i cant thank you enough it would be most appreciated
again if you ever here in the uk let me know ..... the beer is on me
really appreciate both your help and Mr Peanuts
again thanks a million
-
Try the attachment ;)
EDIT: Updated to v1.1
-
@ Mandoble
Wow ! Sir that works like a charm cant thank you enough!!
Like i said before if you ever in the Uk please let buy you a beer !
If you dont mind me asking 1 question
1. how would change the type of parachute being used to the mapfact round chute (sorry)
-
which is the chute class used by mapfact?
-
@ mandoble
this is the chute class MAP_OPC_GU
many thanks again
-
Look for
_dir = getDir _chuto;
_chuto setDir _dir;
_cone setDir _dir;
_posc = getPosASL _chuto;
and just below that code add:
deleteVehicle _chuto;
_chuto = "MAP_OPC_GU" createVehicle _posc;
_man moveInDriver _chuto;
_chuto setDir _dir;
Hope that works.
-
Mandoble
Once again thanks ever so much for this it is most appreciated
Is the cone really needed/ or can this be replaced with invisble marker?
However mate i am ever o gratefull for this
Thanks
-
the mistery cone is required, while you may change it by another moveable object, invisible or smaller.
-
Mandoble
I made the chages as you suggested but it still does not change the chute to the round ones
i am still using the init.sqf which i have changed to start.sqf and placed in a trigger and called res= [plane1]execVM"start.sqf"
*************Edit*********************
Just noticed the changes -
When the blokes jump they start of with a square chute then it changes to the MAP chute
But other than that the script really rocks - once again thanks so much
I noticed that when a big group jumps (24) they seem to spread out a bit and dont quite land within the raduis,however they do land a lot better than being spread out all over the island
**********Edit *****************************
Just to let you know this is how i have everything setup
1. Plane [Be32K] with waypoints first waypoint set to limited
2. Barrel as a visual marker
3. Marker named "mk_land"
4. Trigger that is grouped to plane
In the activation field : res= [plane]execVM"start.sqf"
here are the changes as you said i had to make:
_chuto = vehicle _man;
_timeold = time;
_dir = getDir _chuto;
_chuto setDir _dir;
_cone setDir _dir;
_posc = getPosASL _chuto;
deleteVehicle _chuto;
_chuto = "MAP_OPC_GU" createVehicle _posc;
_man moveInDriver _chuto;
_chuto setDir _dir;
_cone = "RoadCone" createVehicleLocal [0,0,0];
_cone setPosASL [_posc select 0, _posc select 1, (_posc select 2)-4 ];
_posc = getPosASL _cone;
-
Yep, with the current version the chutes dont adjust its descending rate (which is fixed), that is the reason that if they jump far away, they will maneouver to head to the target but they might touch the ground well before reaching the target area.
-
Oh Okay
But still i think that this is the best script out so far regarding parachuting !!!
with a small team they land pretty close to the barrel which is pretty close to the real thing i assume
however with the big group most of them land closer together but spread out - which i assume again would happen in real life where you have +50 paras jumping (taking into account wind direction, speed , drift ) not all of the group are gonna land together there would be the odd few that do land a distance away which is good i suspose
Is there a way to try and prevent the Bis chute from showing for a few second before it changes to the Map chute?
On the things that impressed me the most was the way when the blokes jump is the delay before the chute opens which is fantastic
This could really make for some cool cutscenes
Once again Mandoble i am very gratefull for your help with this
Thanks once again.
-
Will try to investigate your chute class to avoid the replacement effect.
EDIT:
Check the above attachment, version updated ;)
-
Thanks so much
Just another question in the init. sqf which i have renamed start sqf how do i add mulitple groups to the script so that i can have on script that starts all groups jumping
i tried doing the following but it bought up an error message
Sleep 3;
{
_x action ["EJECT", vehicle _x];
unassignVehicle _x;
[_x, getPos target, 20]execVM"mando_chute.sqf";
Sleep 1;
} forEach units group [chuteman1,chuteman2,chuteman3];
-
try with:
{
_x spawn
{
{
_x action ["EJECT", vehicle _x];
unassignVehicle _x;
[_x, getPos target, 20, ""]execVM"mando_chute.sqf";
Sleep 1;
} forEach units group _this;
};
} forEach [chuteman1, chuteman2, chuteman3];
EDIT:
Missed the last parameter (chute type), corrected in this code.
-
Again thank you ever so much Mandoble
Like i said if u are ever here in the uk then the beers is on me mate!!
if you dont mind me asking just one last question where about in the script can i increase the time before the chute opens ?
Other than that i am happy to have this thread read as resolved
-
Once the chute is created, the time elapsed before the chute is open depends on the addon itself.
_chuto = _type createVehicle [0,0,0]; // <<<---- chute creation
_chuto setPos _posc;
_chuto setVectorDir _vdir;
_chuto setVectorUp _vup;
_chuto setVelocity _vvel;
_man moveInDriver _chuto;
-
Oh okay i understand
Again Thank you
Cheers for that i must say the script is just awesome,
my only wish is that someone would convert the DC3 addon to a standard millitary one....
The think that i love about is this script is that when the bloke jumps out of the be32k (US Version) it looks almost real especially with the delay ....
Anyway i am happy for this thread to be shown as "Solved"