Gunner no VTOL Xyan

Gunner no VTOL Xyan

« posted: Feb 01, 2018, 03:16 PM »

I have a vtol mission and I would like to know how to put gunner, it passes on the player and not the strip



// ******************************************************************************************
// * This project is licensed under the GNU Affero GPL v3. Copyright © 2014 A3Wasteland.com *
// ******************************************************************************************
//   @file Name: mission_HostileJet.sqf
//   @file Author: JoSchaap, AgentRev

if (!isServer) exitwith {};
#include "hostileairMissionDefines.sqf"

private ["_vehicleClass", "_vehicle", "_createVehicle", "_leader", "_waypoint", "_vehicleName", "_numWaypoints", "_box1", "_box2", "_randomBox", "_randomBox2"];

_setupVars =
{
   _missionType = "Jato Hostil";
   _locationsArray = nil; // locations are generated on the fly from towns
};

_setupObjects =
{
   _missionPos = markerPos (((call cityList) call BIS_fnc_selectRandom) select 0);

   _vehicleClass = if (missionDifficultyHard) then
   {
      ["O_T_VTOL_02_infantry_F"] call BIS_fnc_selectRandom;
   }
   else
   {
      ["O_T_VTOL_02_infantry_F"] call BIS_fnc_selectRandom;
   };

   _createVehicle =
   {
      private ["_type", "_position", "_direction", "_vehicle", "_soldier"];

      _type = _this select 0;
      _position = _this select 1;
      _direction = _this select 2;

      _vehicle = createVehicle [_type, _position, [], 0, "FLY"];
      _vehicle setVariable ["R3F_LOG_disabled", true, true];
      [_vehicle] call vehicleSetup;

      _vehicle setDir _direction;
      _aiGroup addVehicle _vehicle;

      // add a driver/pilot/captain to the vehicle
      // the little bird, orca, and hellcat do not require gunners and should not have any passengers
      _soldier = [_aiGroup, _position] call createRandomSoldierC;
      _soldier moveInDriver _vehicle;

      switch (true) do
      {
         case (_type isKindOf "O_T_VTOL_02_infantry_F"):
         {
            // these choppers have 2 turrets so we need 2 gunners
            _soldier = [_aiGroup, _position] call createRandomSoldierC;
            _soldier moveInTurret [_vehicle, [1]];

            _soldier = [_aiGroup, _position] call createRandomSoldierC;
            _soldier moveInTurret [_vehicle, [2]];
         };

         case (_type isKindOf "O_T_VTOL_02_infantry_F" || _type isKindOf "O_T_VTOL_02_infantry_F"):
         {
            // these choppers need 1 gunner
            _soldier = [_aiGroup, _position] call createRandomSoldierC;
            _soldier moveInGunner _vehicle;
         };
      };
   };

   _aiGroup = createGroup CIVILIAN;

   _vehicle = [_vehicleClass, _missionPos, 0] call _createVehicle;

   _leader = effectiveCommander _vehicle;
   _aiGroup selectLeader _leader;

   _aiGroup setCombatMode "WHITE"; // Defensive behaviour
   _aiGroup setBehaviour "AWARE";
   _aiGroup setFormation "STAG COLUMN";

   _speedMode = if (missionDifficultyHard) then { "NORMAL" } else { "LIMITED" };

   _aiGroup setSpeedMode _speedMode;

   // behaviour on waypoints
   {
      _waypoint = _aiGroup addWaypoint [markerPos (_x select 0), 0];
      _waypoint setWaypointType "MOVE";
      _waypoint setWaypointCompletionRadius 50;
      _waypoint setWaypointCombatMode "WHITE";
      _waypoint setWaypointBehaviour "AWARE";
      _waypoint setWaypointFormation "STAG COLUMN";
      _waypoint setWaypointSpeed _speedMode;
   } forEach ((call cityList) call BIS_fnc_arrayShuffle);

   _missionPos = getPosATL leader _aiGroup;

   _missionPicture = getText (configFile >> "CfgVehicles" >> _vehicleClass >> "picture");
   _vehicleName = getText (configFile >> "CfgVehicles" >> _vehicleClass >> "displayName");

   _missionHintText = format ["Um veiculo aereo esta patrulando altis, derrube o e pegue sua recompensa!", _vehicleName, sideMissionColor];

   _numWaypoints = count waypoints _aiGroup;
};

_waitUntilMarkerPos = {getPosATL _leader};
_waitUntilExec = nil;
_waitUntilCondition = {currentWaypoint _aiGroup >= _numWaypoints};

_failedExec = nil;

// _vehicle is automatically deleted or unlocked in missionProcessor depending on the outcome

_successExec =
{
   // Mission completed

   // wait until heli is down to spawn crates
   _vehicle spawn
   {
      _veh = _this;

      waitUntil
      {
         sleep 0.1;
         _pos = getPos _veh;
         (isTouchingGround _veh || _pos select 2 < 5) && {vectorMagnitude velocity _veh < [1,5] select surfaceIsWater _pos}
      };

      _randomBox = selectRandom ["mission_USLaunchers","mission_Main_A3snipers","mission_Uniform","mission_DLCLMGs","mission_ApexRifles"];
      _randomBox2 = selectRandom ["mission_USSpecial","mission_HVSniper","mission_DLCRifles","mission_HVLaunchers"];
      _box1 = createVehicle ["Box_NATO_Wps_F", (getPosATL _veh) vectorAdd ([[_veh call fn_vehSafeDistance, 0, 0], random 360] call BIS_fnc_rotateVector2D), [], 5, "None"];
      _box1 setDir random 360;
      [_box1, _randomBox] call fn_refillbox;

      _box2 = createVehicle ["Box_East_Wps_F", (getPosATL _veh) vectorAdd ([[_veh call fn_vehSafeDistance, 0, 0], random 360] call BIS_fnc_rotateVector2D), [], 5, "None"];
      _box2 setDir random 360;
      [_box2, _randomBox2] call fn_refillbox;

      { _x setVariable ["R3F_LOG_disabled", false, true] } forEach [_box1, _box2];
   };

   _successHintMessage = "O ceu esta limpo novamente. A patrulha inimiga foi retirada! As caixas de municao cairam perto do destrocos.";
};

_this call sideMissionProcessor;

Re: Gunner no VTOL Xyan

« Reply #1 posted: Feb 06, 2018, 11:47 AM »
Your kinda in the wrong sub-forum here.

You've done kind of a messy mod of the hostile helos missions.

what you want to do is get rid of that whole switch block. You're only spawning one type of vehicle, you don't need it. You could even get rid of the If statement in the _vehicleClass variable, and just set it to the class name of the Xian.

After :

// add a driver/pilot/captain to the vehicle
 // the little bird, orca, and hellcat do not require gunners and should not have any passengers
 _soldier = [_aiGroup, _position] call createRandomSoldierC;
 _soldier moveInDriver _vehicle;

add:

_soldier2  = [_aiGroup, _position] call createRandomSoldierC;
_soldier2 moveingunner _vehicle;

Re: Gunner no VTOL Xyan

« Reply #2 posted: Feb 06, 2018, 02:38 PM »
Your kinda in the wrong sub-forum here.

You've done kind of a messy mod of the hostile helos missions.

what you want to do is get rid of that whole switch block. You're only spawning one type of vehicle, you don't need it. You could even get rid of the If statement in the _vehicleClass variable, and just set it to the class name of the Xian.

After :

// add a driver/pilot/captain to the vehicle
 // the little bird, orca, and hellcat do not require gunners and should not have any passengers
 _soldier = [_aiGroup, _position] call createRandomSoldierC;
 _soldier moveInDriver _vehicle;

add:

_soldier2  = [_aiGroup, _position] call createRandomSoldierC;
_soldier2 moveingunner _vehicle;






I'm sorry for putting the question in the wrong place.

and thank you for the help