Cigs4 18 Posted December 11, 2020 Hello Guys, Here's the problem: Playing on a dedicated server, my team is small and uses UAV's for recon. What is happening is that when the member responsible for the UAV and who has the terminal connected to it is shot and dies, that UAV is stuck to that player and, even if he respawns, it is no longer possible to connect to that UAV. I would like a code that disconnects a dead player's terminal from an UAV. I tried this: while {true} do { {_x connectTerminalToUAV objNull} forEach AllDeadMan; }; sleep 6; But no success... Can someone help me, please?? Thanks in advance. Share this post Link to post Share on other sites
gc8 977 Posted December 11, 2020 You could use EntityKilled EH to disconnect the unit: addMissionEventHandler ["EntityKilled", { params ["_unit", "_killer", "_instigator", "_useEffects"]; _uav = getConnectedUAV _unit; if(!isnull _uav) then { _unit connectTerminalToUAV objNull; }; }]; code not tested 1 Share this post Link to post Share on other sites
Maff 251 Posted December 11, 2020 Nice. I was suggesting the same thing. 1 Share this post Link to post Share on other sites
Cigs4 18 Posted December 11, 2020 Works perfectly !!! Thanks a lot, gc8. And thank you also, Maff!👍 Share this post Link to post Share on other sites
Melody_Mike 130 Posted December 15, 2020 May I ask how you identify the player and reconnect the uav on respawn (in dedicated)? Do you check the player's class in the onPlayerRespawn.sqf, ie: if (typeOf player == "B_Soldier_UAV_F") then { uav1 connectTerminalToUAV player; }; ? Share this post Link to post Share on other sites
gc8 977 Posted December 16, 2020 16 hours ago, Melody_Mike said: May I ask how you identify the player and reconnect the uav on respawn (in dedicated)? Do you check the player's class in the onPlayerRespawn.sqf, ie: if (typeOf player == "B_Soldier_UAV_F") then { uav1 connectTerminalToUAV player; }; ? Edited my code a bit for that: addMissionEventHandler ["EntityKilled", { params ["_unit", "_killer", "_instigator", "_useEffects"]; _uav = getConnectedUAV _unit; if(!isnull _uav) then { _unit connectTerminalToUAV objNull; _unit setVariable ["controlledUAV", _uav ]; // Store last used UAV }; }]; then in onPlayerRespawn.sqf _uav = player getVariable ["controlledUAV", objNull ]; if(isalive _uav) then // Probably also good to check that none has taken the UAV while player is respawning { player connectTerminalToUAV _uav; }; something like that, code not tested Note: That's all client code Share this post Link to post Share on other sites
pierremgi 4905 Posted December 16, 2020 On 12/15/2020 at 8:10 AM, Melody_Mike said: May I ask how you identify the player and reconnect the uav on respawn (in dedicated)? Do you check the player's class in the onPlayerRespawn.sqf, ie: if (typeOf player == "B_Soldier_UAV_F") then { uav1 connectTerminalToUAV player; }; ? UAV disconnect on killed/respawned in dedicated? Share this post Link to post Share on other sites