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

Paradropping Supplies - Multiplayer Issue

Recommended Posts

Hi,

So I am currently working on a new logistics system for my clan co-op games. So far I have made it so players can pick up boxes, drop them and load them into vehicles everything is working perfectly both in the editor and multiplayer server however if supplies are loaded into an aircraft I would like to give players the option to paradrop the supplies down.

I will give a quick explanation as to what I am doing in my code.

This is the code I am using to let players load boxes onto vehicles. As you can see I am creating an array and storing the name of the box in it.

private ["_unit"];
_unit = player;
box allowDamage false;
_vehicles = vehicles;

{ 
_meters = _unit distance _x; 
if (_x != box && _meters < 5) then { 
	removeAllActions _unit;
	detach box;
	//box setposATL [00000.0,0000.0,0.00000000];
	_teleloc = (GetMarkerPos "supplies");
	box setposATL (_teleloc);

	_unit forceWalk false;
	removeAllActions _x;
	_x addAction ["<t color='#FF0000'>Unload Supplies</t>", "logistics\box_unload.sqf"];

	if (_x isKindOf "Air") then { 		
		_x addAction ["<t color='#FF0000'>Paradrop Supplies</t>", "logistics\box_paradrop.sqf"];
	};

	if (isNil ("ResupplyArray")) then { 
		ResupplyArray = [box];
	} else { 
		ResupplyArray = ResupplyArray + [box];
	}; // Maybe turn these into public variables.
};
sleep 0.05;
//hint format["M: %1 | X: %2 | B: %3 | U: %4",_meters, _x, box, _unit];
} forEach _vehicles;

I can then unload the box using the following code, this is also working perfectly.

private ["_unit"];
_veh = _this select 0;
_box = ResupplyArray select 0;
_unit = player;

_unit forceWalk true;
_box attachTo [_unit, [0,1,0],"Pelvis"];

ResupplyArray = ResupplyArray - [_box];
_count = count ResupplyArray;
if (_count == 0) then {
removeAllActions _veh;
};

_unit addAction ["<t color='#FF0000'>Put Down</t>", "logistics\box_putdown.sqf"];
_unit addAction ["<t color='#FF0000'>Load Up</t>", "logistics\box_loadup.sqf"];

Now moving onto the paradrop code, I am doing pretty much the same as the above but instead I am just getting the position of the player and then moving it slightly. No errors are returned and it simply doesn't work on the server but it works perfectly in the editor, what am I doing wrong?

private ["_unit"];
_veh = _this select 0;
_box = ResupplyArray select 0;
_unit = player;
_height = ((getPosASL _unit) select 2);

if(_height >= 0) then {
ResupplyArray = ResupplyArray - [_box];

_count = count ResupplyArray;
if (_count == 0) then {
	removeAllActions _veh;
};

_pos = GetPos _unit;
//_newpos = [_pos select 0, _pos select 1, (_pos select 2) - 5];
_newpos = [_pos select 0, _pos select 1, (_pos select 2) + 50];
_box setposATL (_newpos);

_chute = createVehicle ["B_Parachute_02_F", [100, 100, 200], [], 0, "FLY"];
_chute setPos (getPos _box);
_box attachTo [_chute, [0, 0, -1.3]];
removeAllActions _box;
_box addAction ["Pick Up", "logistics\box_pickup.sqf"];

_smoke = "SmokeShellRed" createVehicle (position _box);
_smoke attachTo [_box, [0, 0, 0.4]];

hint format["%1 | %2 | %3 | %4 | %5", _veh, _box, _unit, _height, _newpos];

waitUntil {isTouchingGround _box || (getPos _box select 2) < 1};
Sleep 2;
deleteVehicle _smoke;
_smoke = "SmokeShellRed" createVehicle (position _box);
sleep 10;
detach _chute;
deleteVehicle _chute;
_box allowDamage true;
} else {
	titleText ["You can't do that right now!", "PLAIN DOWN"]; 
};

Edited by R4IDER

Share this post


Link to post
Share on other sites

I have managed to get this working now simply by adding a sleep between moving the box and creating the parachute.

Share this post


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

×