Jump to content
fathersarge

Sling Loading and Server Lag

Recommended Posts

So this is an issue I encounter on some servers and do not encounter on others. I'm curious if anyone knows what the culprit might be and if there is a fix.

 

For the purposes of this discussion I'm talking about vanilla sling loading, but this occurs more frequently if using Duda's advanced sling loading.

 

In a nutshell, flying around sling loading any object (I really can't stress anymore that is is truly any object completely independent of mass) at a moderate speed (between 40-60kts, appropriate sling speed), the load and the helicopter are treated as completely separate objects and the server will eventually "hiccup" slightly. This causes the server to think the load and the helicopter are beyond range of each other, thus disconnecting the ropes and letting the load fall to the ground.

 

This doesn't seem to happen on some servers, it happens infrequently on others, or even extremely frequently on other servers. Have others encountered this? I don't see any topics about it and to me it seems like a pretty big deal as it essential makes anything other than the old script sling loading completely useless. I can take a guess that is might have something to do with latency between the client and the server but when my ping to the main server I play on is usually less than 50 and I still have this occur all the time, there seems to be something wrong.

 

Let's talk about it.

Share this post


Link to post
Share on other sites

You've mostly figured it out.

 

The pilot of the lifting chopper and the underslung object are remote to each other in other words, the helicopter becomes local to the pilot but the underslung load doesn't - it remains local to the server. Or even worse, the underslung load might have another player in the drivers seat making it local to him. It is the difference in locality that makes the underslung load lag and warp and break the ropes. Flying really slowly can mitigate this a little.

 

The best solution is to make the underslung cargo have the same locality as the pilot of the lifting chopper. setowner.is your friend here.

			if ((owner _smcontainer) != (owner _smheli)) then
				{
				_smcontainer setOwner (owner _smheli);
				};

smcontainerbeing the slingloaded object and smheli being the lift chopper.

Note this code will not work if the underslung object has a player driver, so it's best to make sure there's no driver before lifting

  • Thanks 1

Share this post


Link to post
Share on other sites

Oh nice!

 

For those of us not so scriptingly inclined, how would one implement this in a mission file so it worked across the board, including for in mission spawned Zeus objects?

Share this post


Link to post
Share on other sites

This is the tested (on a dedi) solution for the sling load question. CBA is required for this script. Drop it into the mission init.sqf to install and use. That's it.

 

This is good for anything in your mission, even things spawned in Zeus.

 

This is only setup for vanilla sling loading. However if using Duda's Advanced Sling Loading, the pilot of a helicopter can still get into the driver seat of a vehicle to set locality for the vehicle (just make sure no one gets into the driver seat after the pilot), and they can now use this script to set locality for any other non-vehicle objects you'd like to sling load with Advanced Sling Loading (ammo crates, etc).

 

Thanks for the help everyone.

 

	["lsl_slingLocality", 
		{
			params ["_heli", "_object"];
			private _heliOwner = owner _heli;
			if (_heliOwner != owner _object) then {
			_object setOwner _heliOwner;
			};
		}
	] 
	
	call CBA_fnc_addEventHandler;

	["Helicopter", "init", 
		{
			params ["_heli"];

			_heli addEventHandler ["RopeAttach",
			
			{
				params ["_heli", "", "_object"];
				["lsl_slingLocality", [_heli, _object]] call CBA_fnc_serverEvent;
			}
		];
		}, true, [], true
	]
	
	call CBA_fnc_addClassEventHandler;

 

  • Like 2

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

×