Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
TrooperWally

Supply dropping without using the module (part 2)

Recommended Posts

Forum etiquette note: This thread is very relevant to what I'm up to but since it's old I followed the advice to start a new thread. Apologies if this is the wrong thing to do and feel free to merge the threads.

What I'm trying to achieve is a script that drops a custom crate at the location of a marker.

I can get it working so that the helicopter spawns, flys to the drop point, drops the crate, the crate falls to the ground and all is good. Except there's no parachute. When I try adding the parachute bit in things go wrong. No matter how I tweak the code I can't seem to get the parachute to spawn. Any ideas how to fix this? I started with the code in the thread linked above and have simplified it for my purposes and this is where I've got to:

//script to make the suppply drop happen

_callsign = "UN Ops Takistan"; 
_spawnPoint = markerPos "dropStart"; 
_dropPos = markerPos "supply_drop"; 
_tmp = "B_TargetSoldier" createVehicle _spawnPoint; 
_tmp2 = [_tmp, player] call BIS_fnc_relativeDirTo;     
_ch = [_spawnPoint, _tmp2, "I_Heli_Transport_02_F", civilian] call BIS_fnc_spawnVehicle; 
deleteVehicle _tmp; 
_helo = _ch select 0; 
_helo flyInHeight 80; 
_helo setCaptive true;
_grp = _ch select 2; 
_grp setBehaviour "CARELESS";
_wp0 = _grp addwaypoint [_dropPos, 0]; 
_wp0 setwaypointtype "MOVE"; 
_wp0 setWaypointBehaviour "SAFE"; 
_wp0 setWaypointStatements ["true","(vehicle this) flyInHeight 250; "]; 

sleep 0.5; 

[player sideChat format ["Is anyone there? Camp  Hope is destoryed and we need medical supplies, over."],"BIS_fnc_spawn",true,false] spawn BIS_fnc_MP; 

sleep 3;

[player sideChat format ["Repeat, we need medical supplies at Camp Hope, over."],"BIS_fnc_spawn",true,false] spawn BIS_fnc_MP; 

sleep 6+(random 2); 

[systemChat  format ["%1: Unknown radio operator transmitting from Camp Hope. This is UN Ops Takistan. Camp Hope was destroyed by hostile forces earlier today. We are scrambling a helicopter to drop medical supplies. We believe hostile forces are still in the area so cannot risk landing to evacuate you, sorry.",_callsign],"BIS_fnc_spawn",true,false] spawn BIS_fnc_MP; 

waitUntil {sleep 1;([getposatl _helo select 0,getposatl _helo select 1,0] distance [(getMarkerPos "supply_drop") select 0, (getMarkerPos "supply_drop") select 1,0]) < 100 }; 

sleep 3; 

if (alive _helo && alive (driver _helo)) then { 

   _crate = "B_supplyCrate_F" createVehicle (getMarkerPos "dropStart"); 
   _crate setPosATL [getPosATL _helo select 0, getPosATL _helo select 1,((getPosATL _helo select 2)-1)]; 
   _crate setVelocity [0,0,-1]; 
   _crate allowdamage false; 
   _wp1 = _grp addwaypoint [_spawnPoint, 200]; 
   _wp1 setwaypointtype "MOVE"; 
   _wp1 setWaypointBehaviour "SAFE"; 
   _wp1 setWaypointStatements ["true","deleteVehicle (vehicle this); {deleteVehicle _x} forEach units this;"]; 

   sleep 2; 

   _chute = createVehicle["B_Parachute",[0,0,3],[],0,"FLY"];
   sleep 0.01; 
   clearWeaponCargoGlobal _crate; 
   clearMagazineCargoGlobal _crate; 
   clearItemCargoGlobal _crate; 

   _crate addItemCargoGlobal ["Medikit",2]; 
   _crate addItemCargoGlobal ["FirstAidKit",20]; 
   if (!isNull _chute) then { 
       _chute setPosATL [getPosATL _crate select 0, getPosATL _crate select 1,(getPosATL _crate select 2)]; 
       _crate attachTo [_chute, [0, 0, -1.3]]; 
   }; 
   waitUntil {sleep 0.3; getPosATL _crate select 2 < 50 }; 
   [systemChat format ["%1: The supplies have been dropped, out.",_callsign],"BIS_fnc_spawn",true,false] spawn BIS_fnc_MP; 

   waitUntil {sleep 0.3; getPosATL _crate select 2 < 30 }; 
   if ((alive driver _helo) && (alive _helo)) then { 
       _flr = createVehicle["F_20mm_White",[0,0,100],[],0,"NONE"]; 
       sleep 0.01; 
       _flr attachTo [_crate,[0,0,0.5]]; 
       waitUntil {position _crate select 2 < 0.5 || isNull _chute}; 
       detach _crate; 
       _crate setPos [position _crate select 0, position _crate select 1, 0.1]; 
       _crate setVelocity [0,0,0]; 

       _crate allowdamage true; 
       sleep 1; 
       detach _flr; 
       sleep 1; 
       _flr setVelocity [random 1,random 1,-0.01]; 
       sleep 5; 
       deleteVehicle _chute; 

   }; 
}else{ 
   sleep 120; 
   {deleteVehicle _x} forEach units _grp; 
   deletevehicle _helo; 
};  

In case it's relevant I'm trying to implement this on a mission using the Zargabad map in Arma 3 (i.e. using the map pack add on).

I'm quite the amateur with scripting and intense googling and experimentation has left me with no idea how to fix this. Any help would be much appreciated.

Share this post


Link to post
Share on other sites

This is a script I use to call in a TANK DROP.

// Drop Tank
// Add radio Command Resupply Tank
// Set to Once.
// Trigger set to 
// null = [this] execVM "scripts\DropTank.sqf";

private ["_para", "_veh","_unit"];
hint "Tank Deployed";

_unit = _this select 0;

_para = createVehicle ["B_Parachute_02_F", [0,0,100], [], 0, ""]; 
_para setPosATL (_unit modelToWorld[0,0,200]); 
_veh = createVehicle ["B_MBT_01_cannon_F", [0,0,80], [], 0, ""]; 
_veh attachTo [_para,[0,0,0]];
_veh allowdamage false;  

// Land safely 
WaitUntil {((((position _veh) select 2) < 0.6) || (isNil "_para"))}; 
detach _veh; 
_veh SetVelocity [0,0,-5];            
sleep 0.3; 
_veh setPos [(position _veh) select 0, (position _veh) select 1, 0.6];  
deletevehicle _para;
_veh allowdamage true;

(Code courtesy of kylania)

I believe it's the parachute classname you're using is wrong. Try "B_Parachute_02_F"

Edited by Beerkan

Share this post


Link to post
Share on other sites

Yup, tested and confirmed working. All I did was change the classname for the parachute in the script I posted above and it worked a treat.

Thanks for the classname. I'd found multiple different classnames for the parachute but the closest I could get was a folded parachute in backpack which doesn't really have the same effect for delivering supplies safely!

Share this post


Link to post
Share on other sites
Sign in to follow this  

×