FlathEarth__Cultist 0 Posted February 15, 2020 Im trying to spawn jet with crew (pilot) in air, but "BIS_fnc_spawnVehicle" don't return even empty array, code: _spawnMarker = selectRandom ["markerSPopforAC2", "markerSPopforAC1", "markerSPopforAC0"]; _enemiesCount = selectRandom [2, 3, 4]; _height = selectRandom [700, 1000, 1250, 1500]; _isSaD = false; _position = getMarkerPos _spawnMarker; _position set [2, _height]; //fix height if(_spawnMarker == "markerSPopforAC2") then { _isSad = true; }; try { ["Spawning root at: %1 // count: %2 // SaD: %3", _spawnMarker, str _enemiesCount, str _isSad] call fnLog; _root = [_position, 180, "O_Plane_CAS_02_F", east] call BIS_fnc_spawnVehicle; _rootGroup = _root select 2; _rootVehicle = _root select 0; ["Spawn pos: %1, root: %2", str _position, str root] call fnLog; // for [{_i = 0}, {_i < (_enemiesCount - 1)}, {_i = _i + 1}] do { // _child2DPos = [_position, 100, 500, 0, 1, 0, 0] call BIS_fnc_findSafePos; // _childFixedPos = [_child2DPos select 0, _child2DPos select 1, _height]; //setup array with missing height // _child = [_position, 180, "O_Plane_CAS_02_F", east] call BIS_fnc_spawnVehicle; // //_childCrew IS ARRAY // _childCrew = _child select 1; // //take first member of crew (we have only one pilot) // //and join him to group // [_childCrew select 0] join _rootGroup; // }; _waypointPos = _position; _waypointType = "CYCLE"; // if(_isSaD) then { // _waypointPos = getMarkerPos "marker_10"; // _waypointType = "SAD"; // }; _waypoint = _rootGroup addWaypoint [_waypointPos, 0, 1]; _waypoint setWaypointType _waypointType; } catch { ["Error occured: %1", str _exception] call fnLog; hint str _exception; }; Sample debug output: Spawning root at: markerSPopforAC0 // count: 4 // SaD: false Spawn pos: [12715.8,29182.7,1000], root: I would be thankful for any suggestions. Share this post Link to post Share on other sites
7erra 629 Posted February 15, 2020 1 hour ago, FlathEarth__Cultist said: ["Spawn pos: %1, root: %2", str _position, str root] call fnLog; root has to be local: _root 1 Share this post Link to post Share on other sites
Harzach 2507 Posted February 15, 2020 Works fine for me. How are you calling this script? You must remove the comments if you are running from debug. (7erra's point inclusive) Share this post Link to post Share on other sites
FlathEarth__Cultist 0 Posted February 15, 2020 33 minutes ago, 7erra said: root has to be local: _root Yes, thats my bad. fnLog don't show any errors even if some vars are missing. Share this post Link to post Share on other sites
beno_83au 1362 Posted February 16, 2020 11 hours ago, Harzach said: You must remove the comments if you are running from debug. I think now days // to comment out a line in debug is ok, but commenting out blocks using /* xxx */ is not. Share this post Link to post Share on other sites
Harzach 2507 Posted February 16, 2020 2 hours ago, beno_83au said: I think now days // to comment out a line in debug is ok, but commenting out blocks using /* xxx */ is not. It's either inconsistent, or there is a rule I can't figure out. If I put a comment anywhere in the OP's code, it will not execute and throws a seemingly nonsensical error near the comment location. If I put a comment in a simple vehicle spawn snippet it works fine. If I put a comment in a relatively complex AI debug snippet, it works fine. I am confused. 1 Share this post Link to post Share on other sites
Harzach 2507 Posted February 16, 2020 It seems to have something to do with error logging. If I remove all logging code, I can comment with no errors. Anyway, this is tangential to the topic, so I'll go bang my head against this brick wall elsewhere. 1 Share this post Link to post Share on other sites
Coladebote 46 Posted February 18, 2020 Hi: This script is the one I use to do airstrikes. You can use one or several planes and it works perfectly. If you need it, I can pass you a demo mission. LINK:https://forums.bohemia.net/forums/topic/227128-air-attack-by-script/?tab=comments#comment-3391152 Share this post Link to post Share on other sites