Jump to content
soolie

Customizable Supply Drop - Release

Recommended Posts

Finaly i get it to work. Here is my showoff:

Only the despawn thing is still happening and i have still no idea why.

Here is my Script:

openMap [true,true];
clicked = 0;
hintc "Left click on the map where you want the supplies dropped";

["supplymapclick", "onMapSingleClick", {
	_supplyLocArray = [+1000,-1375,-1500,-1125,+1250,-1000,+1375,-1250,+1500,+1125];
//:::::::::::|USE THE ONE BELOW FOR TESTING, IT SPAWNS THE HELI MUCH CLOSER|:::::::::::
//		_supplyLocArray = [+500,-500];
	_supplyRandomLocX = _supplyLocArray select floor random count _supplyLocArray;
	_supplyRandomLocY = _supplyLocArray select floor random count _supplyLocArray;
	_supply = [[(_pos select 0)+_supplyRandomLocX,
				(_pos select 1)+_supplyRandomLocY, 
				(_pos select 2)+50], 180, "I_Heli_Transport_02_F", WEST] call bis_fnc_spawnvehicle;
	_supplyHeli = _supply select 0;
	_supplyHeliPos = getPos _supplyHeli;
	_supplyMrkrHeli = createMarker ["supplyMrkrHeli", _supplyHeliPos];
	_supplyCrew = _supply select 1;
	_supplyGrp = _supply select 2;
	_supplyGrp setSpeedMode "FULL";
	_supplyGrp setBehaviour "CARELESS";
	_supplyWP1 =_supplyGrp addWaypoint [(_pos),1];
	_supplyWP1 setWaypointType "MOVE";
	_supplyWP2 = _supplyGrp addWaypoint [[(_pos select 0)+_supplyRandomLocX, 
										(_pos select 1)+_supplyRandomLocY, 
										_pos select 2], 2];
	_supplyMrkrLZ = createMarker ["supplyMrkrLZ", _pos];
	"supplyMrkrLZ" setMarkerType "Empty";
	"supplyMrkrHeli" setMarkerType "Empty";
	_supplyHeli flyInHeight 150;
	clicked = 1;
	openmap [false,false];
	onMapSingleClick '';}] call BIS_fnc_addStackedEventHandler; 

waitUntil {(clicked == 1)};
	hint "The supplies are on the way";
	_supplyMrkrHeliPos = getMarkerPos "supplyMrkrHeli";
	_supplyMrkrHeliPos2 = [_supplyMrkrHeliPos select 0, 
							_supplyMrkrHeliPos select 1, 
							(_supplyMrkrHeliPos select 2)+50];
	_supplyHeli = _supplyMrkrHeliPos2 nearestObject "I_Heli_Transport_02_F";
	_supplyMrkrLZPos = getMarkerPos "supplyMrkrLZ"; 
	_supplyLZ = createVehicle ["Land_Laptop_device_F", getMarkerPos "supplyMrkrLZ", [], 0, "NONE"];
	deleteMarker "supplyMrkrHeli";
	deleteMarker "supplyMrkrLZ";
	_supplyLZ hideObject true;

waitUntil {( _supplyLZ distance _supplyHeli)<400};
	_supplyHeli animateDoor ["CargoRamp_Open",1];
waitUntil {( _supplyLZ distance _supplyHeli)<200};
	sleep 2;
	_supplyHeli allowDammage false;
	_supplyBoxFnc = "B_CargoNet_01_ammo_F";
	_supplyBox = createVehicle [_supplyBoxFnc, position _supplyHeli, [], 0, "CAN_COLLIDE"];
					clearBackpackCargoGlobal _supplyBox;
					clearWeaponCargoGlobal _supplyBox;
					clearMagazineCargoGlobal _supplyBox;
					clearItemCargoGlobal _supplyBox;
					_supplyBox addWeaponCargoGlobal ["LMG_Mk200_MRCO_F", 2];
					_supplyBox addWeaponCargoGlobal ["arifle_MXM_RCO_pointer_snds_F", 2];
					_supplyBox addMagazineCargoGlobal ["30Rnd_65x39_caseless_mag_Tracer", 4];
					_supplyBox addMagazineCargoGlobal ["200Rnd_65x39_cased_Box_Tracer", 4];
					_supplyBox additemcargoGlobal ["NVG_EPOCH", 2];
					_supplyBox additemcargoGlobal ["Rangefinder", 2];
					_supplyBox additemcargoGlobal ["FirstAidKit", 3];
					_supplyBox additemcargoGlobal ["optic_Arco", 1];
					_supplyBox additemcargoGlobal ["ItemKiloHemp", 3];
					_supplyBox additemcargoGlobal ["ItemRuby", 1];
					_supplyBox additemcargoGlobal ["Pelt_EPOCH", 4];
					_supplyBox additemcargoGlobal ["meatballs_epoch", 2];
					_supplyBox additemcargoGlobal ["HeatPack", 3];
					_supplyBox additemcargoGlobal ["ItemSodaOrangeSherbet", 2];
					_supplyBox additemcargoGlobal ["optic_ACO_grn", 1];
					_supplyBox additemcargoGlobal ["U_O_GhillieSuit", 1];
					_supplyBox addbackpackcargoGlobal ["B_Carryall_cbr", 1];				
	_supplyBox disableCollisionWith _supplyHeli;
	_supplyHeli disableCollisionWith _supplyBox;
	_supplyBox allowDammage false;
	_supplyBox attachTo [_supplyHeli, [0, 0, 0], "CargoRamp"]; 
	_supplyBox setDir ([_supplyBox, _supplyHeli] call BIS_fnc_dirTo);
	detach _supplyBox;

	//:::::::::::|Marker|:::::::::::
	_marker = createMarker ["SupplyMarker1", position _supplyLZ];
	_marker setMarkerType "mil_objective";
	"SupplyMarker1" setMarkerText "Supply Drop";
	"SupplyMarker1" setMarkerColor "ColorKhaki";
	//:::::::::::::::::::::::::::::::

	deleteVehicle _supplyLZ; 

_supplyChute = createVehicle ["B_parachute_02_F", position _supplyBox, [], 0, "FLY"];
_supplyBox attachTo [_supplyChute,[0,1,0]];	
//_supplyChute hideObject true;
_supplyChute setPos getPos _supplyBox;

//:::::::::::|LIGHT|:::::::::::
_supplyLight = "Chemlight_green" createVehicle (position _supplyBox);
_supplyLight attachTo [_supplyBox, [0,0,0]];
//:::::::::::::::::::::::::::::		
sleep 1;
hint "The supplies have been dropped and can be found in the marked zone within a 200m radius.";
_supplyChute hideObject false;
_supplyChute allowDammage false;
_supplyHeli allowDammage true;
_supplyBox allowDammage true;
_supplyHeli animateDoor ["CargoRamp_Open",0];

//:::::::::::|SMOKE|:::::::::::
_supplySmoke = "SmokeShell" createVehicle (position _supplyBox);
_supplySmoke attachTo [_supplyBox, [0,0,0]];
//:::::::::::::::::::::::::::::

waitUntil {(getPos _supplyBox select 2)<2};
//detach _supplyBox;
	//_supplyChute setPos [ (getPos _supplyChute select 0)+0.75, getPos _supplyChute select 1, getPos _supplyChute select 2];
	hint "";
	sleep 5;
	{deleteVehicle _x;}forEach crew _supplyHeli;deleteVehicle _supplyHeli;
	//hint "end";

// Cleanup
sleep 1500;
deleteMarker "SupplyMarker1"; 



Edited by Salutesh

Share this post


Link to post
Share on other sites

I have been playing around with this and its great. One question - say I tied the action to a laptop, but I only wanted the players to be able to call it once - what is the best way to achieve this - I tried adding deleteVehicle this; to the init line, but of course it deleted the laptop before the players could action it. Any advice on this would be appreciated.

Edit: I also had the same issue with multiple drops appearing when this is used on a dedicated server in multiplayer

Edited by CallMeSarge

Share this post


Link to post
Share on other sites

Did anyone got it working in MP corectlly? I have one chopper flying and 2 boxes droped. One is mine one is from the server.

Share this post


Link to post
Share on other sites

Awesome mate. Thanks heaps. Just have 3 questions:

1 - It is possible to have the drop placed randomly on a map (inside a trigger/marker maybe) instead of selecting the drop point on the map?

2 - It is possible to set a cool down so you cannot continuously request a supply drop?

3 - Can I change the helicopter used to bring in the drop to another heli or plane (C130 for example)?

Thanks in advance!

Nate

Share this post


Link to post
Share on other sites
Did anyone got it working in MP corectlly? I have one chopper flying and 2 boxes droped. One is mine one is from the server.

Isn't that fixed by

if (!isServer)

?

Share this post


Link to post
Share on other sites
Isn't that fixed by
if (!isServer)

?

Usually better to use if (isServer) as opposed to to !isServer so that it only runs on the server as opposed to all clients.

3 - Can I change the helicopter used to bring in the drop to another heli or plane (C130 for example)?

You need to look at this line

(_pos select 2)+50], 180, "I_Heli_Transport_02_F", CIVILIAN] call bis_fnc_spawnvehicle;

You need to change

I_Heli_Transport_02_F
to the classname of helicopter that you want to have spawned in. You can find vehicle classnames by going in the editor and creating a unit, the classname will be in the upper right of the unit info box once you have it selected.
Also I also have had the issue with the map showing up for everyone on the server to select the supply drop point.

You need to call the code locally on the player that you want to call in the airdrop. One method of doing so is through an addAction ex: _unitname addAction ["Call in supply drop", "PUT CODE TO CALL Supply.sqf HERE"];

Edited by SpyderBlack723

Share this post


Link to post
Share on other sites
You need to call the code locally on the player that you want to call in the airdrop. One method of doing so is though an addAction ex: _unitname addAction ["Call in supply drop", "PUT CODE TO CALL Supply.sqf HERE"];

Can this be added to the regular support menu ?

Edited by thefinn

Share this post


Link to post
Share on other sites
Can this be added to the regular support menu ?

Not sure, would have to look into it. I don't really use the support menu. Seems like it should be possible, just need to find the means of making it work.

Edit:

Sort of confused by this line; random empty string at the beginning, not sure if that's left over from something or what.

[[["","CLASSNAME OF BOX","FNC NAME"],"supply\supply.sqf"], "BIS_fnc_execVM", true] call BIS_fnc_MP;

This is how you would call it in MP via a trigger (RadioAlpha) in order to have it work properly so that every player isn't given the map prompt

_nul = ["","BOXCLASSNAME","FNCNAME"] execVM "supply\supply.sqf";

For example:

_nul = ["","B_supplyCrate_F","FncSupplyVAS"] execVM "supply\supply.sqf";

Not too familiar with triggers and their locality but I believe this should work, let me know if it doesn't.

Btw soolie, you can use

_light = createVehicle ....

_box setVariable ["chemlight", _light];

and then use

deleteVehicle (_this getVariable "chemlight");

inside the FncBoxLight in order to make it ACE compatible. Otherwise if a player is using ACE and attaches a chemlight to themselves and uses this action, it will simply delete the chemlight attached to them instead of the one attached to the box since that is the closest one. Not a huge deal just something to look out for in the future if you ever update this.

Edited by SpyderBlack723

Share this post


Link to post
Share on other sites

Hi,

 

I was looking for an easy supply drop script. This one works basically, but despite reading through this post I still have problems with locality on my dedicated server. The script fires for every logged in player. I tried as descriped above to run it as a radio command (I only use the "supply.sqf" part): 

 

_nul = execVM "supply\supply.sqf";

the code itself looks like this (I "tried and errored" a bit with the "if (isServer) etc" command, without success:


 

if (isDedicated) then {
 
    _supplyBoxFnc = _this select 1;
    _supplyCargoFnc = _this select 2;
    openMap [true,true];
    clicked = 0;
    hintc "Left click on the map where you want the supplies dropped";
    ["supplymapclick", "onMapSingleClick", {
        _supplyLocArray = [+1000,-1375,-1500,-1125,+1250,-1000,+1375,-1250,+1500,+1125];
//:::::::::::|USE THE ONE BELOW FOR TESTING, IT SPAWNS THE HELI MUCH CLOSER|:::::::::::
//        _supplyLocArray = [+500,-500];
        _supplyRandomLocX = _supplyLocArray select floor random count _supplyLocArray;
        _supplyRandomLocY = _supplyLocArray select floor random count _supplyLocArray;
        _supply = [[(_pos select 0)+_supplyRandomLocX,
                    (_pos select 1)+_supplyRandomLocY, 
                    (_pos select 2)+50], 180, "I_Heli_Transport_02_F", WEST] call bis_fnc_spawnvehicle;
        _supplyHeli = _supply select 0;
        _supplyHeliPos = getPos _supplyHeli;
        _supplyMrkrHeli = createMarker ["supplyMrkrHeli", _supplyHeliPos];
        _supplyCrew = _supply select 1;
        _supplyGrp = _supply select 2;
        _supplyGrp setSpeedMode "FULL";
        _supplyGrp setBehaviour "CARELESS";
        _supplyWP1 =_supplyGrp addWaypoint [(_pos),1];
        _supplyWP1 setWaypointType "MOVE";
        _supplyWP2 = _supplyGrp addWaypoint [[(_pos select 0)+_supplyRandomLocX, 
                                            (_pos select 1)+_supplyRandomLocY, 
                                            _pos select 2], 2];
        _supplyMrkrLZ = createMarker ["supplyMrkrLZ", _pos];
        "supplyMrkrLZ" setMarkerType "Empty";
        "supplyMrkrHeli" setMarkerType "Empty";
        _supplyHeli flyInHeight 150;
        clicked = 1;
        openmap [false,false];
        onMapSingleClick '';}] call BIS_fnc_addStackedEventHandler; 
    waitUntil {(clicked == 1)};
        hint "The supplies are on the way";
        _supplyMrkrHeliPos = getMarkerPos "supplyMrkrHeli";
        _supplyMrkrHeliPos2 = [_supplyMrkrHeliPos select 0, 
                                _supplyMrkrHeliPos select 1, 
                                (_supplyMrkrHeliPos select 2)+50];
        _supplyHeli = _supplyMrkrHeliPos2 nearestObject "I_Heli_Transport_02_F";
        _supplyMrkrLZPos = getMarkerPos "supplyMrkrLZ"; 
        _supplyLZ = createVehicle ["Land_Laptop_device_F", getMarkerPos "supplyMrkrLZ", [], 0, "NONE"];
        deleteMarker "supplyMrkrHeli";
        deleteMarker "supplyMrkrLZ";
        _supplyLZ hideObject true;
        
    waitUntil {( _supplyLZ distance _supplyHeli)<400};
        _supplyHeli animateDoor ["CargoRamp_Open",1];
    waitUntil {( _supplyLZ distance _supplyHeli)<200};
        sleep 2;
        _supplyHeli allowDammage false;
        _supplyBox = createVehicle 
                        [_supplyBoxFnc, position _supplyHeli, [], 0, "CAN_COLLIDE"];
                        clearBackpackCargoGlobal _supplyBox;
                        clearWeaponCargoGlobal _supplyBox;
                        clearMagazineCargoGlobal _supplyBox;
                        clearItemCargoGlobal _supplyBox;    
        _supplyBox disableCollisionWith _supplyHeli;
        _supplyHeli disableCollisionWith _supplyBox;
        _supplyBox allowDammage false;
        _supplyBox attachTo [_supplyHeli, [0, 0, 0], "CargoRamp"]; 
        _supplyBox setDir ([_supplyBox, _supplyHeli] call BIS_fnc_dirTo);
        detach _supplyBox;
        deleteVehicle _supplyLZ;
        [_supplyBox,_supplyCargoFnc,nil,true] spawn BIS_fnc_MP;
        [_supplyBox,"FncSupplyLight",nil,true] spawn BIS_fnc_MP; 
    _supplyChute = createVehicle ["B_parachute_02_F", position _supplyBox, [], 0, "CAN_COLLIDE"];    
    _supplyBox attachTo [_supplyChute,[0,0,-0.5]];    
    _supplyChute hideObject true;
    _supplyChute setPos getPos _supplyBox;
                                                                            
//:::::::::::|LIGHT|:::::::::::
    _supplyLight = "Chemlight_green" createVehicle (position _supplyBox);
    _supplyLight attachTo [_supplyBox, [0,0,0]];
//:::::::::::::::::::::::::::::        
    
    sleep 1;
    hint "The supplies have been dropped";
    _supplyChute hideObject false;
    _supplyHeli allowDammage true;
    _supplyBox allowDammage true;
    _supplyHeli animateDoor ["CargoRamp_Open",0];
    
//:::::::::::|SMOKE|:::::::::::
    _supplySmoke = "SmokeShell" createVehicle (position _supplyBox);
    _supplySmoke attachTo [_supplyBox, [0,0,0]];
//:::::::::::::::::::::::::::::
    
    waitUntil {(getPos _supplyBox select 2)<2}; 
    detach _supplyBox;
        _supplyChute setPos [ (getPos _supplyChute select 0)+0.75, getPos _supplyChute select 1, getPos _supplyChute select 2];
        hint "";
        sleep 5;
        {deleteVehicle _x;}forEach crew _supplyHeli;deleteVehicle _supplyHeli;
        //hint "end";
};

Any ideas?

 

Thanks

Share this post


Link to post
Share on other sites

I need help with this script... When I use it on an dedicated server if one player does the script EVERYONE opens the map and has to drop a supply crate. please help!!

  • Like 1

Share this post


Link to post
Share on other sites

Her you go, you can use this on a dedicated server..

 

player addaction ["<t color='#fcf9f9'>Vehicle Drop Cost 18825$</t>", {["","O_T_LSV_02_unarmed_F","FncSupplyCargo1"] execVM "supply\supply.sqf"}];

	player addaction ["<t color='#fcf9f9'>Vehicle Drop Cost 18825$</t>", {["","O_T_LSV_02_unarmed_F","FncSupplyCargo1"] execVM "supply\supply.sqf"},nil,1.5,true,true,"",'([18825] call HG_fnc_hasEnoughMoney)'];

 

The only thing i got problem with is the box get duplicate all the ammo and weapons.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×