LSValmont 789 Posted February 27, 2019 Hello guys. I need your help once again. I have this line of code working perfectly for the Server Host: openMap true; MapClicked = false; onMapSingleClick "HHH setPos [_pos select 0,_pos select 1, 0] ;(group transportHeli) move _pos; MapClicked = true; onMapSingleClick ''; true;"; Where HHH is the name of a Helipad placed on the Eden Editor. That previous line does not work in MP of course since when a client calls the script the helicopter with crew (also placed via Editor) nor the Helipad move to the onMapSingleClick location. I've tried the following remoteExec code: onMapSingleClick "[HHH,[_pos select 0,_pos select 1, 0]] remoteExec ["setPos", HHH]; [(group transportHeli),[_pos]] remoteExec ["move", (group transportHeli)]; MapClicked = true; onMapSingleClick ''; true;"; But I get this error: Error SETPOS: TYPE ANY , EXPECTED OBJECT. If I remove: "[HHH,[_pos select 0,_pos select 1, 0]] remoteExec ["setPos", HHH]; And just leave: [(group transportHeli),[_pos]] remoteExec ["move", (group transportHeli)]; Then the error is: Error MOVE: TYPE ANY , EXPECTED OBJECT. But I double checked and the location of both the SetPos and Move commands on the remoteExec are in the correct location and should be working... BIS BUG? Any ideas on how I can solve this issue and/or any other method to get the client to move the server placed helicopter on command? Thanks in advanced. Share this post Link to post Share on other sites
LSValmont 789 Posted February 28, 2019 Ok, I got it to work with this: onMapSingleClick "[HHH,[_pos select 0,_pos select 1, 0]] remoteExec ['setPos', HHH]; [(group transportHeli),[getPos HHH select 0,getPos HHH select 1,0]] remoteExec ['move', (group transportHeli)]; {(group transportHeli) move [getPos HHH select 0,getPos HHH select 1,0];} remoteExec ['bis_fnc_spawn', 0]; MapClicked = true; onMapSingleClick ''; true;"; Just in case it is useful to someone. EDIT: Scratch all that... it is only working for the host again... and now with no errors... IDK why it is not working... Share this post Link to post Share on other sites
Grumpy Old Man 3545 Posted February 28, 2019 Why remoteExec? setPos is global. Cheers 3 Share this post Link to post Share on other sites
LSValmont 789 Posted February 28, 2019 11 hours ago, Grumpy Old Man said: Why remoteExec? setPos is global. Cheers That is good to know, thanks! The script is called via a custom UI interface with: Spoiler class text1: RscButton { text = "1. Drop Off at Location and RTB"; SizeEx = 0.035; colorText[] = {0.8,0.8,0.8,1}; style = ST_LEFT; colorBackgroundActive[] = {0.35,0.95,0.15,0.5}; x = 0.210 * safezoneW + safezoneX; y = 0.440 * safezoneH + safezoneY; w = 0.260 * safezoneW; h = 0.025 * safezoneH; action = "closeDialog 0; heliOrder = 1; [] execVM ""radioControl\transportHeli.sqf"""; }; I made it work in Hosted MP with this (full script so you can understand the context): Spoiler //transportHeli.sqf if (isNil "transHeliInUse") then {transHeliInUse = false; publicVariable "transHeliInUse";}; if (transHeliInUse) exitWith {hint "Transport Heli in use, wait your turn.";}; transHeliInUse = true; publicVariable "transHeliInUse"; if (isNil "TransHeliNewOrder") then {TransHeliNewOrder = true;}; 0 = [] spawn { if (TransHeliNewOrder) exitWith { TransHeliNewOrder = false; hint "Trans Heli has new no previus orders"; }; if (!TransHeliNewOrder) exitWith { TransHeliNewOrder = true; hint "Trans Heli has new orders"; }; }; sleep 2; TransHeliNewOrder = false; _vPad = ""; _codeName = ""; mainBase = getMarkerPos "BASE"; publicVariable "mainBase"; _markerName = ""; // VIRTUAL HELIPAD EDEN EDITOR OBJECT NAME = HHH _nameAirTransport_1 = "SKY-RANGER (UH-80 Ghosthawk)"; _nameAirTransport_2 = "BLACKBIRD (UH-80 Ghosthawk)"; _nameAirTransport_3 = "LITTLE-BIRD (MH-6 Little Bird)"; _nameAirTransport_4 = "ANGEL-MEDEVAC (CH-49 Mohawk)"; _nameAirCAS_1 = "REAPER (AH-99 Blackfoot)"; missionNamespace setVariable [(str Skyranger) + "heliName", _nameAirTransport_1]; missionNamespace setVariable [(str Blackbird) + "heliName", _nameAirTransport_2]; missionNamespace setVariable [(str Littlebird) + "heliName", _nameAirTransport_3]; missionNamespace setVariable [(str Angel) + "heliName", _nameAirTransport_4]; missionNamespace setVariable [(str Reaper) + "heliName", _nameAirCAS_1]; if (transportHeli == Skyranger) then {_markerName = _nameAirTransport_1; _codeName = "SKY-RANGER"}; if (transportHeli == Blackbird) then {_markerName = _nameAirTransport_2; _codeName = "BLACKBIRD"}; if (transportHeli == Littlebird) then {_markerName = _nameAirTransport_3; _codeName = "LITTLE-BIRD"}; if (transportHeli == Angel) then {_markerName = _nameAirTransport_4; _codeName = "ANGEL-MEDEVAC"}; _transportHeli = transportHeli; transportHeli = _transportHeli; publicVariable "transportHeli"; transportHeliGroup = (group _transportHeli); publicVariable "transportHeliGroup"; transportHeliGroup setSpeedMode "FULL"; _outOfService = _codeName + " is out of service"; if (!alive _transportHeli) exitWith {hint _outOfService}; deleteMarker _codeName; _heliMarker = createMarker [_codeName, getPos _transportHeli]; _heliMarker setMarkerColor "ColorGreen"; _heliMarker setMarkerShape "ICON"; _heliMarker setMarkerType "mil_dot"; _heliMarker setMarkerText _codeName; if (heliOrder == 1) then { player sidechat _codeName+" requesting a DROP OFF at... "; }; if (heliOrder == 2) then { player sidechat _codeName+" requesting a PICK UP at... "; }; if (heliOrder == 3) then { player sidechat _codeName+" proceed to and wait for further instruction... "; }; if (heliOrder == 4) then { player sidechat _codeName+" RETURN TO BASE"; 0 = [_codeName] Spawn { playMusic "RadioAmbient30"; sleep 3; [west, "HQ"] sideChat "Copy that HunterZ, Air Transport is RTB..."; }; }; heliTransPos = getPos transportHeli; grpToTransport = (group Player); publicVariable "grpToTransport"; // SENDING TO DESTINATION if (heliOrder != 4) then { openMap true; MapClicked = false; publicVariable "MapClicked"; onMapSingleClick " heliTransPos = _pos; publicVariable 'heliTransPos'; [HHH,[heliTransPos select 0,heliTransPos select 1, 0]] remoteExec ['setPos', 2]; {(group transportHeli) move [getPos HHH select 0,getPos HHH select 1,0]; LZ = (getPos HHH); publicVariable 'LZ'; transportHeli setVariable ['LZ', (getPos HHH), true];} remoteExec ['bis_fnc_spawn', 2]; MapClicked = true; publicVariable 'MapClicked'; onMapSingleClick ''; true; "; waitUntil {sleep 0.5; MapClicked OR TransHeliNewOrder}; if (TransHeliNewOrder) exitWith {hint "Canceling Previous Transport Heli Order";}; destination = transportHeli getVariable "LZ"; _heliMarker setMarkerPos destination; if (heliOrder == 1) then { _heliMarker setMarkerText _codeName+" DROP POINT"; _heliMarker setMarkerType "mil_start"; 0 = [] Spawn { playMusic "RadioAmbient30"; sleep 3; [west, "HQ"] sideChat "Coordinates received HunterZ, buckle up for DROP OFF..."; }; }; if (heliOrder == 2) then { _heliMarker setMarkerText _codeName+" PICK UP"; _heliMarker setMarkerType "mil_pickup"; 0 = [] Spawn { playMusic "RadioAmbient30"; sleep 3; [west, "HQ"] sideChat "Coordinates received HunterZ, Air Transport Inbound..."; }; }; if (heliOrder == 3) then { _heliMarker setMarkerText _codeName+" WAIT"; 0 = [] Spawn { playMusic "RadioAmbient30"; sleep 3; [west, "HQ"] sideChat "Coordinates received HunterZ, in route for location..."; }; }; if (heliOrder == 4) then { }; waitUntil {sleep 1; !visibleMap}; sleep 2; {(group transportHeli) setBehaviour "CARELESS"; (group transportHeli) setSpeedMode "FULL";} remoteExec ['bis_fnc_spawn', 2]; waitUntil {sleep 1; (transportHeli distance destination) < 800 OR TransHeliNewOrder}; if (TransHeliNewOrder) exitWith {hint "Canceling Previous Transport Heli Order";}; {(group transportHeli) setSpeedMode "LIMITED";} remoteExec ['bis_fnc_spawn', 2]; hint format["%1 has reached destination",_codeName]; _heliMarker setMarkerType "Empty"; while {((alive transportHeli) && !(unitReady transportHeli))} do {sleep 1}; }; // IF DROP OFF REQUEST if (heliOrder == 1) then { {transportHeli land "GET OUT";} remoteExec ["bis_fnc_spawn", 2]; waitUntil {sleep 1; {_x in transportHeli} count (units grpToTransport) == 0 OR TransHeliNewOrder}; if (TransHeliNewOrder) exitWith {hint "Canceling Previous Transport Heli Order";}; sleep 15; //SQUAD SAFETY DELAY }; // IF PICK UP REQUEST if (heliOrder == 2) then { {transportHeli land "GET IN";} remoteExec ["bis_fnc_spawn", 2]; waitUntil {sleep 1; {_x in transportHeli} count (units grpToTransport) == count (units grpToTransport) OR TransHeliNewOrder}; if (TransHeliNewOrder) exitWith {hint "Canceling Previous Transport Heli Order";}; }; //RETURN TO BASE if (heliOrder != 3) then { transHeliInUse = false; publicVariable "transHeliInUse"; {(group transportHeli) move mainBase; (group transportHeli) setSpeedMode "FULL";} remoteExec ["bis_fnc_spawn", 2]; _heliMarker setMarkerPos mainBase; _heliMarker setMarkerType "Empty"; waitUntil {sleep 1; (transportHeli distance mainBase) < 800 OR TransHeliNewOrder}; if (TransHeliNewOrder) exitWith {hint "Canceling Previous Transport Heli Order";}; {(group transportHeli) setSpeedMode "LIMITED";} remoteExec ["bis_fnc_spawn", 2]; while {((alive transportHeli) && !(unitReady transportHeli))} do {sleep 1}; {transportHeli land "LAND";} remoteExec ["bis_fnc_spawn", 2]; while {(count (waypoints (group transportHeli))) > 0} do {deleteWaypoint ((waypoints (group transportHeli)) select 0)}; }; And this is how it looks IN GAME: Spoiler Any advice on performance/network optimizations for the script would be greatly appreciated. (PS: I am quite new at MP scripting so you will find lots of redundancies in the script :() 1 Share this post Link to post Share on other sites