iV - Ghost 50 Posted February 12, 2018 I try to teleport players of the callers group into the cargo of a vehicle (Blackfish). The script started by addAction and run on my server. The part for this as follow: { // HANDLE TEAMMATES IN AREA if (_x distance2D _caller < 40) then { // SPAWN TEAMMATES INTO VEHICLE _x moveInCargo _veh; }; } forEach units group _caller; Problem: The players of the callers group was not teleported. Share this post Link to post Share on other sites
johnnyboy 3797 Posted February 12, 2018 try doing assignAsCargo first before moveInCargo.https://community.bistudio.com/wiki/assignAsCargo _x assignAsCargo _veh; _x moveInCargo _veh; 1 Share this post Link to post Share on other sites
iV - Ghost 50 Posted February 12, 2018 I think assignAsCargo is for Ai + oderGetIn and not for players? I'll try, thx. Share this post Link to post Share on other sites
Crielaard 435 Posted February 13, 2018 Take a close look at the wiki https://community.bistudio.com/wiki/addAction Arguments are global Effect is local since the AI is local tot the server, and other players are local to their own computer, they are NOT local to the player who clicks the action. Thus you have to remote exec. However if the AI is in the player's group they ARE local to the player and so you dont need remote exec. https://community.bistudio.com/wiki/remoteExec Share this post Link to post Share on other sites
iV - Ghost 50 Posted February 13, 2018 Yes I know the locality. Thx. But in my case I wanna handle players of my team (if I'am the caller of the script). Share this post Link to post Share on other sites
iV - Ghost 50 Posted February 13, 2018 { // HANDLE TEAMMATES IN AREA if (_x distance2D _caller < 40) then { // SPAWN TEAMMATES INTO VEHICLE _x assignAsCargo _veh; _x moveInCargo _veh; }; } forEach units group _caller; ..is not the way. Players from my team don't teleport in my plane. Share this post Link to post Share on other sites
iV - Ghost 50 Posted February 16, 2018 Can't get it working. Tried with follow: Function: // VARIABLES private ["_veh", "_caller"]; _veh = _this select 0; _caller = _this select 1; // HANDLE TEAMMATES IN AREA { if (_x distance2D _caller < 30) then { // SPAWN TEAMMATES INTO VEHICLE _x moveInCargo _veh; }; } forEach (units (group _caller)); In the script: // VARIABLES private ["_target", "_caller", ...]; _target = _this select 0; _caller = _this select 1; ... // CREATE VEHICLE private ["_vehGroup", "_veh", "_varName", "_destination"]; _vehGroup = createGroup [west, true]; _spawnPos = [_spawnPos select 0, _spawnPos select 1, _flyHeight]; _veh = createVehicle [_vehType, _spawnPos, [], 0, "FLY"]; ... // HANDLE TEAMMATES IN AREA [_veh, _caller] remoteExec ["iV_fnc_moveInCargo", (units (group _caller)), false]; The players of my team don't get teleported inCargo of the vehicle. I'm the only one. Share this post Link to post Share on other sites
pierremgi 4909 Posted February 17, 2018 There is a remoteExec craze for moveincargo on this forum... Share this post Link to post Share on other sites
iV - Ghost 50 Posted February 17, 2018 Can't use the forum search function: Quote Sorry, there is a problem Please wait 24 seconds before attempting another search Error code: 1C205/3 Try now to find more about the remoteExec by using google. Do this for hours now. Share this post Link to post Share on other sites
Schatten 290 Posted February 17, 2018 @iV - Ghost, { if ((_x distance2D _caller) < 30) then { if (local _x) then { _x moveInCargo _veh; } else { [_x, _veh] remoteExec ["moveInCargo", _x]; }; }; } forEach (units (group _caller)); 1 1 Share this post Link to post Share on other sites
iV - Ghost 50 Posted February 17, 2018 Hey @Schatten: Tested but I'm the only one who's getting teleported (moveInCargo). My teammates still standing on the startpoint (startpoint is < 30 to me (_caller)). Share this post Link to post Share on other sites
Schatten 290 Posted February 17, 2018 @iV - Ghost, replace last line of action's script to this one: [_veh, _caller] call iV_fnc_moveInCargo; Share this post Link to post Share on other sites
iV - Ghost 50 Posted February 17, 2018 But I have the "distance to _caller"-check inside my function. Can or should I use them twice? Share this post Link to post Share on other sites
pierremgi 4909 Posted February 18, 2018 6 hours ago, iV - Ghost said: But I have the "distance to _caller"-check inside my function. Can or should I use them twice? The addAction command is AG EL . that means you can run it from server, and you will have the added action on units you want (bunch of players)... if these players exist when you call the command. For example, the result can be different if you disable AI (players slots) in lobby: in this case, switchable units are present on JIP, not before. You can apply also on objects, instead of players (intels, cars....) Then, your command condition will work as is: - if the addAction is applied to player, you have a real "on each frame" EH, testing your "condition code" for firing the code locally. - if the addaction is applied to an object, you have an implicit distance check, hard coded to 15m and you don't have any further "condition code" check, if out of range. Note: this embedded "onEachFramed" EH (perhaps more often checked!) can be easily used: Place in init field of the player: this addAction ["",{},nil,0,false,true,"","hint str diag_TickTime;true" ]; The "condition code" works fine here (true or false doesn't matter, you just need to return a boolean, there is no local code to run!. So, don't confuse the condition code (applied where the addAction is run) , and the local code itself (applied on caller PC by default, if no remoteExec). Share this post Link to post Share on other sites
Schatten 290 Posted February 18, 2018 14 hours ago, iV - Ghost said: But I have the "distance to _caller"-check inside my function. But I wrote that you replace last line in the script, not in function. Share this post Link to post Share on other sites
pierremgi 4909 Posted February 18, 2018 As I said, there is no reason to fail with Schatten's code. Just test: this addAction ["test",{ params ["_target", "_caller"]; {if (local _x) then { _x moveInCargo car1; } else { [_x, car1] remoteExec ["moveInCargo", _x]; }; } forEach (units (group _caller)) },nil,0,false,true,"",""]; on an existing vehicle.That works. You problem here, is not the moveinCargo but the vehicle presence, as you spawn it. I guess you are applying addAction to the player (because the vehicle doesn't exist yet). Difficult to help with part of code without the main command: addAction! So, spawn your vehicle where you want (locally, or hosted here I guess) but wait for a little sleep to make it consistent on each PCs. I'd rather use bis_fnc_spawnGroup, far better than createGroup, createVehicle + crew... With Ais driving crew, the vehicle will be owned by server, anyway. Then apply the code as described above. Share this post Link to post Share on other sites
iV - Ghost 50 Posted February 18, 2018 This is the whole script w/o the functions: Spoiler /* * * Filename: kogs_airdrop.sqf * Author: kogs, [iv] Ghost * Description: Spawn aircraft and set waypoint for helo jump * */ // VARIABLES private ["_target", "_caller", "_rank", "_flyHeight", "_vehType", "_mapSize", "_pos"]; _target = _this select 0; _caller = _this select 1; _rank = rank _caller; _flyHeight = 2800; _vehType = "B_T_VTOL_01_infantry_F"; _mapSize = getNumber (configFile >> "CfgWorlds" >> worldName >> "MapSize"); // IF NO GROUP-LEADER if ((leader group _caller) != _caller) exitWith { hint localize "STR_iV_OnlyGroupLeader"; }; // CHECK RANK if (_rank == "PRIVATE" || _rank == "CORPORAL" || _rank == "SERGEANT") exitWith { hint localize "STR_iV_RankTooLow"; }; // IF SCRIPT IS ACTIVE if (!isNil "HALO_Airbase_1" && {!isNull HALO_Airbase_1} && {alive HALO_Airbase_1}) exitWith { hint localize "STR_iV_ScriptIsActive"; }; // MAX GROUP SIZE if ((count units group _caller) > 12) exitWith { hint localize "STR_iV_MaxGroupSize"; }; // OPEN MAP AND GET CLICKED POS openMap true; mapclick = false; onMapSingleClick " clickpos = _pos; mapclick = true; onMapSingleClick ''; true; "; // CHOOSE IP hint localize "STR_iV_AirSpawn"; waitUntil {mapclick || !(visiblemap)}; if (!visibleMap) exitWith { hint localize "STR_iV_Canceled"; }; // HANDLE SPAWN ON MAP BORDER private ["_spawnPos", "_leftD", "_topD", "_bottomD", "_rightD"]; _spawnPos = clickpos; _leftD = _spawnPos select 0; _topD = _spawnPos select 1; _bottomD = _mapSize - _topD; _rightD = _mapSize - _leftD; // SPAWN AT LEFT BORDER if (_leftD < _topD && _leftD < _bottomD && _leftD < _rightD) then { _spawnPos = [0, _spawnPos select 1]; } else { // SPAWN AT TOP BORDER if (_topD < _leftD && _topD < _bottomD && _topD < _rightD) then { _spawnPos = [_spawnPos select 0, 0]; } else { // SPAWN AT BOTTOM BORDER if (_bottomD < _leftD && _bottomD < _topD && _bottomD < _rightD) then { _spawnPos = [_spawnPos select 0, _mapSize]; } else { // SPAWN AT RIGHT BORDER if (_rightD < _leftD && _rightD < _topD && _rightD < _bottomD) then { _spawnPos = [_mapSize, _spawnPos select 1]; }; }; }; }; // CREATE IP-MARKER private ["_airSpawnMarker"]; _airSpawnMarker = createMarkerLocal ["HALO_Spawn_1", _spawnPos]; _airSpawnMarker setMarkerShape "ICON"; _airSpawnMarker setMarkerType "respawn_para"; _airSpawnMarker setMarkerText "IP"; mapclick = false; // CHOOSE LZ hint localize "STR_iV_ChooseLZ"; onMapSingleClick " clickpos = _pos; mapclick = true; onMapSingleClick ''; true; "; // CHECK IF MAP CLICKED OR CLOSED waitUntil {mapclick or !(visiblemap)}; if (!visibleMap) exitWith { hint localize "STR_iV_Canceled"; deleteMarker _airSpawnMarker; }; _pos = clickpos; openMap false; // MIN DISTANCE BETWEEN IP AND LZ if (_spawnPos distance2D _pos < 6000) exitWith { hint localize "STR_iV_CanceledMinRange"; deleteMarker _airSpawnMarker; }; // CREATE LZ-MARKER private ["_jumpMarker"]; _jumpMarker = createMarker ["HALO_Jump_1", _pos]; _jumpMarker setMarkerPos _pos; _jumpMarker setMarkerShape "ICON"; _jumpMarker setMarkerType "hd_end"; _jumpMarker setMarkerText "LZ HALO"; // CLEAR HINT hint ""; // CREATE VEHICLE private ["_vehGroup", "_veh", "_varName", "_destination"]; _vehGroup = createGroup [west, true]; _spawnPos = [_spawnPos select 0, _spawnPos select 1, _flyHeight]; _veh = createVehicle [_vehType, _spawnPos, [], 0, "FLY"]; _veh setposATL _spawnPos; _veh flyInHeight _flyHeight; // CREATE CREW private ["_pilot", "_loadmaster", "_commander"]; "B_T_Pilot_F" createUnit [_spawnPos, _vehGroup]; "B_T_Pilot_F" createUnit [_spawnPos, _vehGroup]; "B_T_Pilot_F" createUnit [_spawnPos, _vehGroup]; _pilot = (units _vehGroup) select 0; _loadMaster = (units _vehGroup) select 1; _gunner = (units _vehGroup) select 2; _pilot moveInDriver _veh; _pilot assignAsDriver _veh; _loadMaster moveInCargo _veh; _loadMaster assignAsCargo _veh; _gunner moveInCargo _veh; _gunner assignAsCargo _veh; // VARIABLENAME _varName = "HALO_Group_1"; _veh setVehicleVarName _varName; missionNamespace setVariable [_varName, _veh]; publicVariable _varName; // MOVE TO POSITION "LZ" _destination = [_pos select 0, _pos select 1, _flyHeight]; _vehGroup addWaypoint [_destination, 0]; _vehGroup setSpeedMode "LIMITED"; _vehGroup setBehaviour "CARELESS"; // GROUP CHAT [_caller, localize "STR_iV_Go"] remoteExec ["groupChat", (units (group _caller)), false]; sleep 5; // HANDLE TEAMMATES IN AREA [_veh, _caller] call iV_fnc_moveInCargo; // DISTANCE 5000M waitUntil {_veh distance2d _pos < 5000 && (alive _veh)}; if (_veh distance2d _pos < 5000 && (alive _veh)) then { // VEHICLE CHAT [vehicle _pilot, localize "STR_iV_5000m"] remoteExec ["vehicleChat", (units (group _caller)), false]; }; // DISTANCE 1000M & OPEN RAMP waitUntil {_veh distance2d _pos < 1000 && (alive _veh)}; if (_veh distance2d _pos < 1000 && (alive _veh)) then { // VEHICLE CHAT [vehicle _pilot, localize "STR_iV_1000m"] remoteExec ["vehicleChat", (units (group _caller)),false]; // OPEN RAMP _veh animateDoor ['Door_1_source', 1]; }; // DISTANCE 100M waitUntil {_veh distance2d _pos < 100 && (alive _veh)}; if (_veh distance2d _pos < 100 && (alive _veh)) then { // VEHICLE CHAT [vehicle _pilot, localize "STR_iV_100m"] remoteExec ["vehicleChat", (units (group _caller)),false]; }; // CHECK POSITION "LZ" IS REACHED waitUntil {_veh distance2d _pos < 20}; if (_veh distance2d _pos < 20) then { // BACK TO POSITION "IP" _vehGroup addWaypoint [_spawnPos, 0]; // CLOSE RAMP sleep 15; _veh animateDoor ['Door_1_source', 0]; // SET FULL SPEED sleep 10; _vehGroup setSpeedMode "FULL"; }; // DELETE VEHICLE & CREW IF POSITION "IP" IS REACHED OR VEHICLE DEAD waitUntil {_veh distance2d _spawnPos < 100 || !(alive _veh)}; if (_veh distance2d _spawnPos < 100 || !(alive _veh)) then { {_veh deleteVehicleCrew _x} forEach crew _veh; deleteVehicle _veh; deleteGroup _vehGroup; deleteMarker _airSpawnMarker; deleteMarker _jumpMarker; missionNamespace setVariable [_varName, nil]; }; Share this post Link to post Share on other sites
iV - Ghost 50 Posted February 19, 2018 And this is the addAction: this addAction [localize "STR_iV_GroupJump", "scripts\airdrop\kogs_airdrop.sqf"] Share this post Link to post Share on other sites