OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Multiplayer => Topic started by: CAS_Daniel on 20 Jan 2008, 13:49:48

Title: SOLVED: Parachuting script issues
Post by: CAS_Daniel on 20 Jan 2008, 13:49:48
I'm using the BIS parachuting script in a defend mission to drop units over a firebase. Unfortunately additional parachutes are deployed for each extra person on the server. Which, yeah, gets pretty interesting with two choppers bailing troops and twenty people on the server.  :whistle:

Basically after a little script that will delete empty parachutes for the duration of the drop rather than try and fix the script itself. Any help would be much appreciated. Cheers!

Dan
Title: Re: Parachuting script issues
Post by: Mandoble on 20 Jan 2008, 14:00:22
If you know the drop position, and you know when the drop script is executed, you may execute another that looks for parachutes in the area using nearestObjects (http://www.ofpec.com/COMREF/index.php?action=list&game=All&letter=n#661) command, then check which ones have no driver and delete them.

Something like:
Code: [Select]
// remove_empty_chutes.sqf
Sleep 2;
_chutes = nearestObjects[_pos_chute_drop, ["ParachuteWest"], 200];
{
   if (!alive driver _x) then
   {
      deleteVehicle _x;
   };
} forEach _chutes;

Make sure to use the correct chute type for your mission.
Title: Re: Parachuting script issues
Post by: CAS_Daniel on 20 Jan 2008, 14:49:04
Thanks for the quick reply and explanation! Much appreciated. I havn't used .sqf files in ArmA yet, never needed them in OFP. I assume they're similar to .sqs scripts. I'll have a bash now.
Title: Re: Parachuting script issues
Post by: Mandoble on 20 Jan 2008, 15:29:19
SQS
Code: [Select]
;remove_empty_chutes.sqs
~2
_chutes = nearestObjects[_pos_chute_drop, ["ParachuteWest"], 200]
{if (!alive driver _x) then {deleteVehicle _x}} forEach _chutes
Title: Re: Parachuting script issues
Post by: CAS_Daniel on 20 Jan 2008, 16:32:37
Thanks!

Trying it out, currently getting this error.

(http://img237.imageshack.us/img237/4262/chuteerrorte3.jpg)

I've changed ["ParachuteWest"] to ["ParachuteEast"].
Title: Re: Parachuting script issues
Post by: Mandoble on 20 Jan 2008, 17:27:45
Did you set _pos_chute_drop to the drop position?
Title: Re: Parachuting script issues
Post by: CAS_Daniel on 20 Jan 2008, 18:34:05
Have now  :whistle:

Sorry, learning chunks everytime I try to use a script.  :P It's working now, very happy indeed!
However, some of the empty chutes don't get deleted. I've tried setting the 200 in the nearestobject part to 2000, i'm guessing thats the distance from the drop position. Is there another reason? Does the script stop running after a short period of time?

Again, much appreciated.
Title: Re: Parachuting script issues
Post by: Mandoble on 20 Jan 2008, 21:40:32
The script in that shape runs and checks for the chutes only once. You might run it more than once waiting 2 or 3 seconds. Or:
Code: [Select]
~2
_chutes = nearestObjects[_pos_chute_drop, ["ParachuteWest"], 200]
{if (!alive driver _x) then {deleteVehicle _x}} forEach _chutes
~2
_chutes = nearestObjects[_pos_chute_drop, ["ParachuteWest"], 200]
{if (!alive driver _x) then {deleteVehicle _x}} forEach _chutes
~2
_chutes = nearestObjects[_pos_chute_drop, ["ParachuteWest"], 200]
{if (!alive driver _x) then {deleteVehicle _x}} forEach _chutes
~2
_chutes = nearestObjects[_pos_chute_drop, ["ParachuteWest"], 200]
{if (!alive driver _x) then {deleteVehicle _x}} forEach _chutes

That will delete chutes ever 2 seconds four times.
Title: Re: Parachuting script issues
Post by: CAS_Daniel on 20 Jan 2008, 22:35:26
Works like a charm!

Thanks a lot.  :good: