Jump to content
Sign in to follow this  
RS30002

UAV doesn't connect to terminal after spawning

Recommended Posts

Hi...am trying to make a mission leveraging the "newly found" spawn composition "skills". 

 

Namely, lone bro, traveling around Stratis incognito, making himself accommodations and deploying loitering drones/munitions to harass the military bases that are all occupied on the island.

Tent is interactive, you can put stuff in, skip time/heal, it has a toggleable light 😂

Already have the spawn + task scripts for the bases. (still have to figure out the despawning after player leaves but aight)

 

camp.jpg

 

A lot is going good but am having some problems....namely the tests deploying the drone have not been 100%.

 

After spawning the drone, i can see it in the drone select screen drop down menu for only a second. After that it disappears. 

 

Anyy suggestions are greatly appreciated! 🍻

 

uav_1 = createVehicle ["B_UAV_01_F", screen_1 modelToWorld [0,100,200], [], 0, "FLY"]; 
createVehicleCrew uav_1; 
uav_1 lockCameraTo [screen_1, [0]]; 
uav_1 flyInHeight 200; 
 
_wp = group uav_1 addWaypoint [position screen_1, 0]; 
_wp setWaypointType "LOITER"; 
_wp setWaypointLoiterType "CIRCLE_L"; 
_wp setWaypointLoiterRadius 50; 
 
cam1 = "camera" camCreate [0,0,0]; 
cam1 cameraEffect ["Internal", "BACK", "uavrtt_1"]; 
cam1 attachTo [uav_1, [0,0,0], "PiP0_pos"]; 
cam1 camSetFov 0.2; 
"uavrtt_1" setPiPEffect [0]; 
 
addMissionEventHandler ["Draw3D", { 
    _dir = 
        (uav_1 selectionPosition "PiP0_pos") 
            vectorFromTo 
        (uav_1 selectionPosition "PiP0_dir"); 
    cam1 setVectorDirAndUp [ 
        _dir, 
        _dir vectorCrossProduct [-(_dir select 1), _dir select 0, 0] 
    ]; 
}]; 
 
[screen_1,[0,"#(argb,512,512,1)r2t(uavrtt_1,1.0)"]] remoteExec ['setObjectTextureGlobal',0,screen_1]; 

sleep 2;

screen_1 addAction
[
	"Open UAV Terminal",
	{
		params ["_target", "_caller", "_actionId", "_arguments"];

		_caller linkItem "B_UavTerminal";
		waitUntil{ "B_UavTerminal" in assignedItems _caller};

		_caller action ["UAVTerminalOpen", _caller];
		waitUntil {!isNull findDisplay 160};

		if !(isNil "uav_PVC_EH") then{
			removeMissionEventHandler ["PlayerViewChanged", uav_PVC_EH];
		};

		uav_PVC_EH = addMissionEventHandler ["PlayerViewChanged",
		{
			params ["_oldUnit", "_newUnit", "_vehicleIn", "_oldCameraOn", "_newCameraOn", "_uav"];

			[] spawn{
				findDisplay 160 displayAddEventHandler ["KeyDown", "
					params ['_ctrl', '_dikCode', '_shift', '_ctrlKey', '_alt'];

					if (_dikCode in (actionKeys 'hideMap') || _dikCode in (actionKeys 'ingamePause')) then{
						player connectTerminalToUAV objNull;
						player unlinkItem 'B_UavTerminal';

						removeMissionEventHandler ['PlayerViewChanged', uav_PVC_EH];
					};
				"];
			};
		}];

		findDisplay 160 displayAddEventHandler ["KeyDown", "
			params ['_ctrl', '_dikCode', '_shift', '_ctrlKey', '_alt'];

			if (_dikCode in (actionKeys 'hideMap') || _dikCode in (actionKeys 'ingamePause')) then{
				player connectTerminalToUAV objNull;
				player unlinkItem 'B_UavTerminal';

				if !(isNil 'uav_PVC_EH') then{
					removeMissionEventHandler ['PlayerViewChanged', uav_PVC_EH];
				};
			};
		"];

	},
	nil,
	1.5,
	true,
	true,
	"",
	"true",
	2,
	false,
	"",
	""
];

 

 

 

 

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
Sign in to follow this  

×