Jump to content
sarogahtyp

[RELEASE] Sarogahtyps Simple Crew Spawner - SSCS V-1.2

Recommended Posts

Sarogahtyps Simple Crew Spawner - SSCS - 1.2

Fills your vehicles with AI on all seats you want to.

 

This script was initially thought for creating a place where you can drive any vehicle to to fill the empty seats where can be shot from with AI.

Now it has a much wider usability range. You can spawn AI at any seat maybe by a chance or absolutely random. You have various options for spawning AI for an empty vehicle or for use of a player which is inside of vehicle already.

You are able to set side and faction of the AI, randomly determine it or using players side and faction.

Also Pilot seats will spawn pilots and crew seats will spawn crew units.

 

It can be used in any trigger or in an addAction or just by another script.

Its intended to be executed server side. It needs the vehicle object as parameter. All other parameters are optional.

 

Why server side? Because AI which is controlled by server uses it's AI-Mod. That means if the server has VCOM AI installed then the spawned AI will behave using VCOM AI as long as it is located on server. This way you could fly a helicopter and the AI on its guns uses servers AI mod even if your client has not installed any AI mod.

 

Integration in addAction is described in this post:

https://forums.bohemia.net/forums/topic/222484-release-sarogahtyps-simple-ai-gunners-ssaig-v-11/?do=findComment&comment=3348933

 

DOWNLOAD SSCS 1.2

 

SSCS code:

Spoiler

if (!isServer) exitWith {true};
/*
	Author: Sarogahtyp
	Title: SSAIG - Sarogahtyps Simple AI Gunners

	Description: Embarks AI gunners for a player driven vehicle. Is thought to be executed server-side and not on client.

	Arguments:
1.	object - vehicle which should be filled with AI gunners

					 
2.	boolean/number - FFV - true if AI should be spawned on cargo places where they can shoot with their own weapon from (FFV).
                         - false if no AI should spawn on Fire From Vehicle (FFV) seats.
					     - number can be 0-100 and is the chance to spawn AI on each FFV seat.
						   50 means a vehicle with 30 FFV seats should spawn about 15 FFV AIs.
						 - default is true

						 
3.	number/boolean - driver/commander/gunner spawn - true means spawn driver/commander/gunner on available seats - default is true
	                                               - false means to not spawn all of them
												   - number can be 0-7 and defines which of them should be spawned. look at table:
												   
                                                    driver commander gunner number spawn
	                                                   0      0       0    =  |0|  nobody
													   0      0       1    =  |1|  gunner only
													   0      1       0    =  |2|  commander only
													   0      1       1    =  |3|  no driver
													   1      0       0    =  |4|  driver only
                                                       1      0       1    =  |5|  no commander
													   1      1       0    =  |6|  no gunner
													   1      1       1    =  |7|  all
													   X      X       X    >= |8|  totally random

                                                   - 8 or greater means random spawn on available seats.
													   

4.  boolean/number - cargo spawn - true if all possible cargo AI which can not fire from vehicle should spawn.
	                             - false if no cargo AI which can not FFV should spawn.
						         - number can be 0-100 and is the chance to spawn AI on each cargo seat.
						           50 means a vehicle with 30 cargo seats should spawn about 15 cargo AIs
						         - default is false

								 
5.	boolean - group player - if true then AI joins players group (order is join the player who is driver, commander, gunner, elsewhere) 
						   - false means own group for AI - default is false

						   
6.	side - side of spawned AI - default is west if no player is in vehicle
	                          - if any player is inside then side is determined by players side

							  
7.  boolean/string - faction    - true means random faction of given side
                     of         - false means players faction. if there is no player in vehicle or players side does not match given side then random faction of given side.
					 spawned AI	- "westnato", "blunato" or "blu_f" means NATO faction. side must be west then, if not then random faction of given side.
							    - "westfia", "blufia" or "blu_g_f" means FIA faction. side must be west then, if not then random faction of given side.
							    - "eastcsat", "opfcsat" or "opf_f" means CSAT faction. side must be east then, if not then random faction of given side.
							    - "eastfia", "opffia" or "opf_g_f" means FIA faction. side must be east then, if not then random faction of given side.
							    - "indaaf", "gueraaf" or "ind_f" means AAF faction. side must be resistance then, if not then random faction of given side.
							    - "indfia", "guerfia" or "ind_g_f" means FIA faction. side must be resistance then, if not then random faction of given side.
                                - default is true

								
8.	number - timeout - seconds after the AI gets deleted
					 - default is 3600 (1h) - 0 or lower means not to delete after a timeout
					 
					 
Return value:
	boolean - true if script has been finished
*/

//***********************************
//***		SCRIPT START          ***
//***********************************

// declaring parameters, check parameter types and set default values
params [
["_vec", objNull, [objNull]], 			// 1. vehicle object
["_dcg_spawn", true, [true, ""]],		// 2. driver/commander/gunner spawn - default is spawn all
["_own_gun", true, [true, 0]], 			// 3. spawn on FFV seats - default is yes
["_cargo_spawn", false, [true, 0]],		// 4. spawn on other cargo seats - default is no
["_group_player", false, [true]],		// 5. ai joins players group - default is no
["_side", west, [west]], 				// 6. side if no player in vehicle - default is west
["_faction", true, [true, ""]],			// 7. faction if no player in vehicle - default is random
["_AI_timeout", 3600, [0]]];			// 8. time after AI gets deleted - default is 1 hour

//if we do not have a valid vehicle then finish here
if (!(_vec in vehicles) || {isNull _vec or {damage _vec isEqualTo 1}}) exitWith {true};

//***********************************
//***		SPAWN POOLS           ***
//***********************************

//west spawn pools
_spawn_pool_west_nato_air = ["B_recon_F", "B_recon_LAT_F", "B_recon_exp_F", "B_recon_medic_F", "B_recon_TL_F", "B_recon_M_F", "B_recon_JTAC_F", "B_spotter_F", "B_sniper_F"];

_spawn_pool_west_nato_grnd = ["B_Soldier_F", "B_Soldier_lite_F", "B_Soldier_GL_F", "B_soldier_AR_F", "B_Soldier_SL_F", "B_Soldier_TL_F", "B_soldier_M_F", "B_soldier_LAT_F", "B_medic_F",
			      "B_soldier_repair_F", "B_soldier_exp_F", "B_Soldier_A_F", "B_soldier_AT_F", "B_soldier_AA_F", "B_engineer_F", "B_officer_F", "B_soldier_PG_F", "B_soldier_UAV_F",
			      "B_soldier_AAR_F", "B_soldier_AAT_F", "B_soldier_AAA_F", "B_support_MG_F", "B_support_GMG_F", "B_support_Mort_F", "B_support_AMG_F", "B_support_AMort_F", "B_Patrol_Soldier_TL_F",
			      "B_Patrol_Soldier_UAV_F", "B_Patrol_Soldier_M_F", "B_Patrol_Medic_F", "B_Patrol_Soldier_AR_F", "B_Patrol_Soldier_MG_F", "B_Patrol_Soldier_A_F", "B_Patrol_Soldier_AT_F",
			      "B_Patrol_Engineer_F", "B_soldier_LAT2_F"];

_spawn_pool_west_nato_crew = ["B_crew_F"];

_spawn_pool_west_nato_hcrew = ["B_helicrew_F"];

_spawn_pool_west_nato_hpilot = ["B_Helipilot_F"];

_spawn_pool_west_nato_pilot = ["B_Pilot_F"];

_spawn_pool_west_fia = ["B_G_Soldier_F", "B_G_Soldier_lite_F", "B_G_Soldier_SL_F", "B_G_Soldier_TL_F", "B_G_Soldier_AR_F", "B_G_medic_F", "B_G_engineer_F", "B_G_Soldier_exp_F", "B_G_Soldier_GL_F",
			     "B_G_Soldier_M_F", "B_G_Soldier_LAT_F", "B_G_Soldier_A_F", "B_G_officer_F", "B_G_Soldier_LAT2_F"];


// east spawn pools
_spawn_pool_east_csat_air = ["O_recon_exp_F", "O_recon_JTAC_F", "O_recon_M_F", "O_recon_medic_F", "O_recon_F", "O_recon_LAT_F", "O_recon_TL_F", "O_sniper_F", "O_spotter_F"];

_spawn_pool_east_csat_grnd = ["O_Soldier_A_F", "O_soldierU_A_F", "O_Soldier_AAR_F", "O_soldierU_AAR_F", "O_support_AMG_F", "O_support_AMort_F", "O_Soldier_AHAT_F", "O_Soldier_AAA_F", "O_soldierU_AAA_F",
			      "O_Soldier_AAT_F", "O_soldierU_AAT_F", "O_Soldier_AR_F", "O_soldierU_AR_F", "O_medic_F", "O_soldierU_medic_F", "O_engineer_F", "O_engineer_U_F", "O_soldier_exp_F", "O_soldierU_exp_F",
			      "O_Soldier_GL_F", "O_SoldierU_GL_F", "O_support_GMG_F", "O_support_MG_F", "O_support_Mort_F", "O_soldier_M_F", "O_soldierU_M_F", "O_Soldier_AA_F", "O_soldierU_AA_F", "O_Soldier_AT_F",
			      "O_soldierU_AT_F", "O_officer_F", "O_soldier_PG_F", "O_soldier_repair_F", "O_soldierU_repair_F", "O_Soldier_F", "O_soldierU_F", "O_Soldier_LAT_F", "O_soldierU_LAT_F", "O_Soldier_HAT_F",
			      "O_Soldier_lite_F", "O_Soldier_SL_F", "O_SoldierU_SL_F", "O_Soldier_TL_F", "O_soldierU_TL_F", "O_soldier_UAV_F"];

_spawn_pool_east_csat_crew = ["O_crew_F"];

_spawn_pool_east_csat_hcrew = ["O_helicrew_F"];

_spawn_pool_east_csat_hpilot = ["O_helipilot_F"];

_spawn_pool_east_csat_pilot = ["O_Pilot_F"];

_spawn_pool_east_fia = ["O_G_Soldier_A_F", "O_G_Soldier_AR_F", "O_G_medic_F", "O_G_engineer_F", "O_G_Soldier_exp_F", "O_G_Soldier_GL_F", "O_G_Soldier_M_F", "O_G_officer_F", "O_G_Soldier_F", "O_G_Soldier_LAT_F",
		        "O_G_Soldier_LAT2_F", "O_G_Soldier_lite_F", "O_G_Soldier_SL_F", "O_G_Soldier_TL_F"];
				
				
// guerilla spawn pools
_spawn_pool_guer_aaf = [" I_soldier_F", "I_Soldier_lite_F", "I_Soldier_A_F", "I_Soldier_GL_F", "I_Soldier_AR_F", "I_Soldier_SL_F", "I_Soldier_TL_F", "I_Soldier_M_F", "I_Soldier_LAT_F", "I_Soldier_AT_F", "I_Soldier_AA_F",
			"I_medic_F", "I_Soldier_repair_F", "I_Soldier_exp_F", "I_engineer_F", "I_officer_F", "I_soldier_UAV_F", "I_Spotter_F", "I_Sniper_F", "I_Soldier_AAR_F", "I_Soldier_AAT_F", "I_Soldier_AAA_F",
			"I_support_MG_F", "I_support_GMG_F", "I_support_Mort_F", "I_support_AMG_F", "I_support_AMort_F", "I_Soldier_LAT2_F"];

_spawn_pool_guer_aaf_crew = ["I_crew_F"];

_spawn_pool_guer_aaf_hcrew = ["I_helicrew_F"];

_spawn_pool_guer_aaf_hpilot = ["I_helipilot_F"];

_spawn_pool_guer_aaf_pilot = ["I_pilot_F"];  

_spawn_pool_guer_fia = ["I_G_Soldier_F", "I_G_Soldier_lite_F", "I_G_Soldier_SL_F", "I_G_Soldier_TL_F", "I_G_Soldier_AR_F", "I_G_medic_F", "I_G_engineer_F", "I_G_Soldier_exp_F", "I_G_Soldier_GL_F", "I_G_Soldier_M_F",
			"I_G_Soldier_LAT_F", "I_G_Soldier_A_F", "I_G_officer_F", "I_G_Soldier_LAT2_F"];
			
			
// civilian spawn pool
_spawn_pool_civ = ["C_man_1", "C_man_1_1_F", "C_man_1_2_F", "C_man_1_3_F", "C_man_polo_1_F", "C_man_polo_1_F_afro", "C_man_polo_1_F_euro", "C_man_polo_1_F_asia", "C_man_polo_2_F", 
				   "C_man_polo_2_F_afro", "C_man_polo_2_F_euro", "C_man_polo_2_F_asia" ,"C_man_polo_3_F" ,"C_man_polo_3_F_afro" ,"C_man_polo_3_F_euro" ,"C_man_polo_3_F_asia" ,
				   "C_man_polo_4_F" ,"C_man_polo_4_F_afro" ,"C_man_polo_4_F_euro" ,"C_man_polo_4_F_asia" ,"C_man_polo_5_F" ,"C_man_polo_5_F_afro" ,"C_man_polo_5_F_euro",
				   "C_man_polo_5_F_asia"];

//***********************************
//***		VARIABLE INITS        ***
//***********************************

_driver_spawn = true;
_commander_spawn = true;
_gunner_spawn = true;

_dcg_spawn_arr = [
[false, false, false],
[false, false, true],
[false, true, false],
[false, true, true],
[true, false, false],
[true, false, true],
[true, true, false],
[true, true, true]];

// setup faction arrays
_west_nato = ["westnato", "blunato", "blu_f"];
_west_fia = ["westfia", "blufia", "blu_g_f"];

_east_csat = ["eastcsat", "opfcsat", "opf_f"];
_east_fia = ["eastfia", "opffia", "opf_g_f"];

_guer_aaf = ["indaaf", "gueraaf", "ind_f"];
_guer_fia = ["indfia", "guerfia", "ind_g_f"];


_spawn_pool_pilot = [];
_spawn_pool_hpilot = [];
_spawn_pool_hcrew = [];
_spawn_pool_crew = [];
_spawn_pool_cargo_grnd = [];
_spawn_pool_cargo_air = [];

_turrets = fullCrew [_vec, "", true];
_squadpos = _vec getPos [10, random 360];
_squad = grpNull;
_vec_full = true;
_player = objNull;

_own_gun_cpy = _own_gun;
_cargo_spawn_cpy = _cargo_spawn;

_empty_seats = [];
_player_seats = [];
_AI_seats = [];

//***********************************
//***	   HANDLE 2. PARAM        ***
//***********************************

//determine driver, commander, gunner spawn
if (typeName _dcg_spawn isEqualTo "BOOL") then
{
 if(_dcg_spawn) then
 {
  _driver_spawn = true;
  _commander_spawn = true;
  _gunner_spawn = true;
 }
 else
 {
  _driver_spawn = false;
  _commander_spawn = false;
  _gunner_spawn = false;
 };
}
else
{
 if (_dcg_spawn > -1 && _dcg_spawn < 8) then
 {
  _dcg_spawn_arr = _dcg_spawn_arr select _dcg_spawn;

  _driver_spawn = _dcg_spawn_arr select 0;
  _commander_spawn = _dcg_spawn_arr select 1;;
  _gunner_spawn = _dcg_spawn_arr select 2;;
 }
 else
 {
  _dcg_spawn_arr = selectRandom _dcg_spawn_arr;
  
  _driver_spawn = _dcg_spawn_arr select 0;
  _commander_spawn = _dcg_spawn_arr select 1;;
  _gunner_spawn = _dcg_spawn_arr select 2;;
 };
};

//***********************************
//***     PLAYER DETECTION        ***
//***********************************

if (isNil "SSAIG_seat_array_switch") then
{
 SSAIG_seat_array_switch = compile
 "
  params ['_unit'];
  
  if (isNull _unit) exitWith {_empty_seats pushBack _this};
  if (isPlayer _unit) exitWith {_player_seats pushBack _this};
  _AI_seats pushBack _this; 
 ";
};

{
 _role = toLower (_x select 1);
 
 if !(_role isEqualTo "commander" || _role isEqualTo "gunner" || _role isEqualTo "driver") then
 {
  _index = _x call SSAIG_seat_array_switch;
 }; 
} count (fullCrew [_vec, "", true]);

_commander = fullCrew [_vec, "commander", true];
_commander = if (count _commander > 0) then {_commander select 0} else {_commander};

_gunner = fullCrew [_vec, "gunner", true];
_gunner = if (count _gunner > 0) then {_gunner select 0} else {_gunner};

_driver = fullCrew [_vec, "driver", true];
_driver = if (count _driver > 0) then {_driver select 0} else {_driver};

//detect if a player is in vehicle and catch him
if( count _driver > 0 && {isPlayer (_driver select 0)}) then
{
 _player = _driver select 0;
}
else
{
 if( count _commander > 0 && {isPlayer (_commander select 0)}) then
 {
  _player = _commander select 0;
 }
 else
 {
  if( count _gunner > 0 && {isPlayer (_gunner select 0)}) then
  {
   _player = _gunner select 0;
  }
  else
  {
   if( count _player_seats > 0 ) then
   {
    _player = _player_seats select 0 select 0;
   };
  };
 };
};

//manage grouping and side
if (!isNull _player) then
{
 _side = side _player;

 if (_group_player) then {_squad = group _player;}
 else {_squad = createGroup [_side, false];};
}
else
{
 _squad = createGroup [_side, false];
};

_squad addVehicle _vec;

//***********************************
//***	   HANDLE FACTION         ***
//***********************************

// mangage faction
_faction_bool = if (typeName _faction isEqualTo "BOOL") then {true} 
else
{
 if (typeName _faction isEqualTo "STRING" && 
    { (_side isEqualTo west && (_faction in _west_nato || _faction in _west_fia)) ||
	  (_side isEqualTo east && (_faction in _east_csat || _faction in _east_fia)) ||
	  (_side isEqualTo resistance && (_faction in _guer_aaf || _faction in _guer_fia)) }) 
 then {false} else {_faction = true; true};
};

if (_faction_bool && {_faction || {!_faction && isNull _player}}) then
{
 if (_side isEqualTo west) then
 {
  if( random 100 < 50) then
  {
   _spawn_pool_pilot = _spawn_pool_west_nato_pilot;
   _spawn_pool_hpilot = _spawn_pool_west_nato_hpilot;
   _spawn_pool_hcrew = _spawn_pool_west_nato_hcrew;
   _spawn_pool_crew = _spawn_pool_west_nato_crew;
   _spawn_pool_cargo_grnd = _spawn_pool_west_nato_grnd;
   _spawn_pool_cargo_air = _spawn_pool_west_nato_air;
  }
  else
  {
   _spawn_pool_pilot = _spawn_pool_west_nato_pilot;
   _spawn_pool_hpilot = _spawn_pool_west_fia;
   _spawn_pool_hcrew = _spawn_pool_west_fia;
   _spawn_pool_crew = _spawn_pool_west_fia;
   _spawn_pool_cargo_grnd = _spawn_pool_west_fia;
   _spawn_pool_cargo_air = _spawn_pool_west_fia;    
  };
 }
 else
 {
  if (_side isEqualTo east) then
  {
   if( random 100 < 50) then
   {
    _spawn_pool_pilot = _spawn_pool_east_csat_pilot;
    _spawn_pool_hpilot = _spawn_pool_east_csat_hpilot;
    _spawn_pool_hcrew = _spawn_pool_east_csat_hcrew;
    _spawn_pool_crew = _spawn_pool_east_csat_crew;
    _spawn_pool_cargo_grnd = _spawn_pool_east_csat_grnd; 
    _spawn_pool_cargo_air = _spawn_pool_east_csat_air;
   }
   else
   {
    _spawn_pool_pilot = _spawn_pool_east_csat_pilot;
    _spawn_pool_hpilot = _spawn_pool_east_fia;
    _spawn_pool_hcrew = _spawn_pool_east_fia;
    _spawn_pool_crew = _spawn_pool_east_fia;
    _spawn_pool_cargo_grnd = _spawn_pool_east_fia;
    _spawn_pool_cargo_air = _spawn_pool_east_fia;    
   };
  }
  else
  {
   if (_side isEqualTo resistance) then
   {
    if( random 100 < 50) then
    {
     _spawn_pool_pilot = _spawn_pool_guer_aaf_pilot;
     _spawn_pool_hpilot = _spawn_pool_guer_aaf_hpilot;
     _spawn_pool_hcrew = _spawn_pool_guer_aaf_hcrew;
     _spawn_pool_crew = _spawn_pool_guer_aaf_crew;
     _spawn_pool_cargo_grnd = _spawn_pool_guer_aaf;
     _spawn_pool_cargo_air = _spawn_pool_guer_aaf;
    }
    else
    {
     _spawn_pool_pilot = _spawn_pool_guer_aaf_pilot;
     _spawn_pool_hpilot = _spawn_pool_guer_fia;
     _spawn_pool_hcrew = _spawn_pool_guer_fia;
     _spawn_pool_crew = _spawn_pool_guer_fia;
     _spawn_pool_cargo_grnd = _spawn_pool_guer_fia;;
     _spawn_pool_cargo_air = _spawn_pool_guer_fia;
    };
   }
   else
   {
    _spawn_pool_pilot = _spawn_pool_civ;
    _spawn_pool_hpilot = _spawn_pool_civ;
    _spawn_pool_hcrew = _spawn_pool_civ;
    _spawn_pool_crew = _spawn_pool_civ;
    _spawn_pool_cargo_grnd = _spawn_pool_civ;
    _spawn_pool_cargo_air = _spawn_pool_civ;
   };
  };
 };
}
else
{

 // if faction is bool then it is also false because we are in else part
 // setting up players faction
 //if faction is not bool then it is already valid determined in _faction
 _faction = if(_faction_bool) then {toLower (faction player)} else {toLower _faction};

 if (_side isEqualTo west) then
 {
  if(_faction in _west_nato) then
  {
   _spawn_pool_pilot = _spawn_pool_west_nato_pilot;
   _spawn_pool_hpilot = _spawn_pool_west_nato_hpilot;
   _spawn_pool_hcrew = _spawn_pool_west_nato_hcrew;
   _spawn_pool_crew = _spawn_pool_west_nato_crew;
   _spawn_pool_cargo_grnd = _spawn_pool_west_nato_grnd;
   _spawn_pool_cargo_air = _spawn_pool_west_nato_air;
  }
  else
  {
   _spawn_pool_pilot = _spawn_pool_west_nato_pilot;
   _spawn_pool_hpilot = _spawn_pool_west_fia;
   _spawn_pool_hcrew = _spawn_pool_west_fia;
   _spawn_pool_crew = _spawn_pool_west_fia;
   _spawn_pool_cargo_grnd = _spawn_pool_west_fia;
   _spawn_pool_cargo_air = _spawn_pool_west_fia;    
  };
 }
 else
 {
  if (_side isEqualTo east) then
  {
   if(_faction in _east_csat) then
   {
    _spawn_pool_pilot = _spawn_pool_east_csat_pilot;
    _spawn_pool_hpilot = _spawn_pool_east_csat_hpilot;
    _spawn_pool_hcrew = _spawn_pool_east_csat_hcrew;
    _spawn_pool_crew = _spawn_pool_east_csat_crew;
    _spawn_pool_cargo_grnd = _spawn_pool_east_csat_grnd; 
    _spawn_pool_cargo_air = _spawn_pool_east_csat_air;
   }
   else
   {
    _spawn_pool_pilot = _spawn_pool_east_csat_pilot;
    _spawn_pool_hpilot = _spawn_pool_east_fia;
    _spawn_pool_hcrew = _spawn_pool_east_fia;
    _spawn_pool_crew = _spawn_pool_east_fia;
    _spawn_pool_cargo_grnd = _spawn_pool_east_fia;
    _spawn_pool_cargo_air = _spawn_pool_east_fia;    
   };
  }
  else
  {
   if (_side isEqualTo resistance) then
   {
    if( _faction in _guer_aaf) then
    {
     _spawn_pool_pilot = _spawn_pool_guer_aaf_pilot;
     _spawn_pool_hpilot = _spawn_pool_guer_aaf_hpilot;
     _spawn_pool_hcrew = _spawn_pool_guer_aaf_hcrew;
     _spawn_pool_crew = _spawn_pool_guer_aaf_crew;
     _spawn_pool_cargo_grnd = _spawn_pool_guer_aaf;
     _spawn_pool_cargo_air = _spawn_pool_guer_aaf;
    }
    else
    {
     _spawn_pool_pilot = _spawn_pool_guer_aaf_pilot;
     _spawn_pool_hpilot = _spawn_pool_guer_fia;
     _spawn_pool_hcrew = _spawn_pool_guer_fia;
     _spawn_pool_crew = _spawn_pool_guer_fia;
     _spawn_pool_cargo_grnd = _spawn_pool_guer_fia;;
     _spawn_pool_cargo_air = _spawn_pool_guer_fia;
    };
   }
   else
   {
    _spawn_pool_pilot = _spawn_pool_civ;
    _spawn_pool_hpilot = _spawn_pool_civ;
    _spawn_pool_hcrew = _spawn_pool_civ;
    _spawn_pool_crew = _spawn_pool_civ;
    _spawn_pool_cargo_grnd = _spawn_pool_civ;
    _spawn_pool_cargo_air = _spawn_pool_civ;
   };
  };
 };
};

//***********************************
//***	  SPAWN ON EMPTY SEATS    ***
//***********************************

// ********** Check if there is a seat where an AI can be spawned and spawn it
{
 _x params ["_seat", "_role", "_c_t3", "_turret_path", "_ffv"];
 
 _role = toLower _role;
 _path_cnt = count _turret_path;
  
 _is_locked = if ( _path_cnt > 0 && {_vec lockedTurret _turret_path}) then {true} else {false};
  
 //seat empty and not locked?
 if(isNull _seat && !_is_locked) then  
 {
   _own_gun = _own_gun_cpy;

  if (_role isEqualTo "turret" && _ffv) then
  {
   _rand = random 100;
   
   if (((typeName _own_gun) isEqualTo "BOOL" && {_own_gun}) ||
                  {typeName _own_gun isEqualTo "SCALAR" && {_rand < _own_gun}} ) 
				  then {_own_gun = true;} else {_own_gun = false;};
  }
  else
  {
   _own_gun = false;
  };
  
  //handle "turret" type seats?
  if( ((_own_gun && _ffv) || !_ffv) && {_role isEqualTo "turret"} || {!(isNull gunner _vec) && {_role isEqualTo "gunner"}} ) then
  {

   //finally assign spawn pool for turrets and FFV seats
   _spawn_pool = if (_ffv) then
   {
    if (_vec isKindOf "Air") then {_spawn_pool_cargo_air} else {_spawn_pool_cargo_grnd};
   }
   else
   {
    if (_vec isKindOf "Air") then {_spawn_pool_hcrew} else {_spawn_pool_crew};
   };

   _unit = _squad createUnit [(selectRandom _spawn_pool), [0, 0, 0] , [], 0, "NONE"];
   _unit assignAsTurret [_vec, _turret_path];  
   _unit moveInTurret [_vec, _turret_path];
   _vec_full = false;
  }
  else
  {
   // is turret gunner seat?
   if(_gunner_spawn && {_role isEqualTo "gunner"}) then
   {

    //finally assign spawn pool for gunner seat
    _spawn_pool = if (_vec isKindOf "Air") then {_spawn_pool_hcrew} else {_spawn_pool_crew};

    _unit = _squad createUnit [(selectRandom _spawn_pool), [0, 0, 0], [], 0, "NONE"];
    _unit assignAsGunner _vec;
    _unit moveInGunner _vec; 
    _vec_full = false;
   }
   else
   {
    // is turret commander seat?
    if(_commander_spawn && {_role isEqualTo "commander"}) then
    {

    //finally assign spawn pool for commander seat
     _spawn_pool = if (_vec isKindOf "Air") then {_spawn_pool_hcrew} else {_spawn_pool_crew};

     _unit = _squad createUnit [(selectRandom _spawn_pool), [0, 0, 0], [], 0, "NONE"];
     _unit assignAsCommander _vec;  
     _unit moveInCommander _vec; 
	 _squad selectLeader _unit;
     _vec_full = false;
    }
    else
    {
     // is turret driver seat?
     if(_driver_spawn && {_role isEqualTo "driver"}) then
     {
      //finally assign spawn pool for driver seat
      _spawn_pool = if (_vec isKindOf "Air") then 
	  {
	   if (_vec isKindOf "Plane") then {_spawn_pool_pilot} else {_spawn_pool_hpilot};
	  }
	  else {_spawn_pool_crew};

      _unit = _squad createUnit [(selectRandom _spawn_pool), [0, 0, 0], [], 0, "NONE"];
      _unit assignAsDriver _vec;  
      _unit moveInDriver _vec; 
      _vec_full = false;
     }
     else
     {
      _cargo_spawn = _cargo_spawn_cpy;
	 
	  if (((typeName _cargo_spawn) isEqualTo "BOOL" && {_cargo_spawn}) ||
           {typeName _cargo_spawn isEqualTo "SCALAR" && {random 100 < _cargo_spawn}} ) 
	  then {_cargo_spawn = true;} else {_cargo_spawn = false;};

      // is turret cargo seat and should cargo AI be spawned?
				  
      if(_role isEqualTo "cargo" && _cargo_spawn) then
      {
	   //finally assign spawn pool for cargo seat
       _spawn_pool = if (_vec isKindOf "Air") then {_spawn_pool_cargo_air} else {_spawn_pool_cargo_grnd};

       _unit = _squad createUnit [(selectRandom _spawn_pool), [0, 0, 0], [], 0, "NONE"];
       _unit assignAsCargo _vec;  
       _unit moveInCargo [_vec, _c_t3];
       _vec_full = false;
      }; // cargo end
	 }; //driver end
    }; // commander end
   }; // gunner end
  }; // turret end
 }; // empty seat end
 true
} count _turrets;

//exit if no AI was spawned
if (_vec_full) exitWith {true};

//***********************************
//***		SELECT LEADER         ***
//***********************************

if (_group_player && {!(isNull _player)}) then 
{
 _squad selectLeader _player;
}
else
{
 _commander = (fullCrew [_vec, "commander", false]) select {!(isPlayer (_x select 0))};
 _commander = if (count _commander > 0) then {_commander select 0} else {_commander};

 if( count _commander > 0) then
 {
  _squad selectLeader (_commander select 0);
 }
 else
 {
  _gunner = (fullCrew [_vec, "gunner", false]) select {!(isPlayer (_x select 0))};
  _gunner = if (count _gunner > 0) then {_gunner select 0} else {_gunner};

  if( count _gunner > 0) then
  {
   _squad selectLeader (_gunner select 0);
  }
  else
  {
   _driver = (fullCrew [_vec, "driver", false]) select {!(isPlayer (_x select 0))};
   _driver = if (count _driver > 0) then {_driver select 0} else {_driver};

   if( count _driver > 0) then
   {
    _squad selectLeader (_driver select 0);
   };
  };
 };
};

_vec setUnloadInCombat [false, false];

//*******************************
//***		SKILL AI          ***
//*******************************

{
 _x setSkill 1;
 _x setskill ["aimingAccuracy", 1];
 _x setskill ["aimingShake", 1];
 _x setskill ["aimingSpeed", 1];
 _x setskill ["endurance", 1];
 _x setskill ["spotDistance", 1];
 _x setskill ["spotTime", 1];
 _x setskill ["courage", 1];
 _x setskill ["reloadSpeed", 1];
 _x setskill ["commanding", 1];
 _x setskill ["general", 1];
 true
} count (units _squad);

 // make squad agressive and skilled
 _squad setCombatMode "YELLOW";
 _squad setBehaviour "AWARE";

//***********************************
//***		AI LIFE TIME          ***
//***********************************

//track _units for later deletion
[_vec, _squad, _AI_timeout] spawn 
{
 params ["_vec", "_squad", "_AI_timeout"];
 
 _delay = _AI_timeout / 10;
 _rnd_delay = _delay / 10;
 
 _timeout = time + _AI_timeout;
	
 waitUntil 
 {
  sleep (_delay + random _rnd_delay); 
  (damage _vec isEqualTo 1 or isNull _vec or {alive _x} count units _squad < 1 or (time > _timeout && _AI_timeout > 0))
 };

 _squad deleteGroupWhenEmpty true;

 {
  deleteVehicle _x;
 } count units _squad;
};
true

 

 

 

Usage Examples

 

1. vehicles init line, driver/gunner/commander spawn, all FFV seats spawn, no cargo spawn, AI has own group (not players), side west, random faction, delete AI after 1 hour

 

_d = [this] execVM "SSCS.sqf"


  - if a player is inside vehicle during script execution then side will be the players side and random faction of players side.

 

 

2. vehicles init line, no FFV seats spawn, driver/commander spawn - no gunner spawn, spawn 80% of cargo seats, AI joins players group, side east, faction FIA, delete AI after 10 min

 

_d = [this, false, 6, 80, true, east, "eastfia", 600] execVM "SSCS.sqf"

 

 - if no player in vehicle then AI get it's own group (not players)
 - if player of side east is in vehicle then side will be east and faction FIA
 - if player of other side than east in vehicle then AI spawns on players side with random faction

 

 

3. vehicles init line, spawn 50% of FFV seats, spawn no driver but commander and gunner, spawn no cargo, AI has own group, side west, random faction, no AI deletion

 

_d = [this, 50, 3, false, false, west, true, 0] execVM "SSCS.sqf"


or using nil for default values

 

_d = [this, 50, 3, nil, nil, nil, nil, 0] execVM "SSCS.sqf"

 

 - if no player in vehicle then AI spawns as side west and random faction (NATO or FIA)
 - if player in vehicle then AI spawns as players side and random faction

 

 

Changelog V-1.2

- added possibility to spawn AI by chance for cargo FFV seats (Fire From Vehicle)

- added possibility to spawn AI by chance for common cargo seats.

- added all usefull unit classes of vanilla without any DLC classes

- added side and faction handling (see argument/parameter description on top of script)

- added workaround for bug with CUPs BMP-3 (https://dev.cup-arma3.org/T3216)

- added possibility to spawn AI (or not) on driver, commander and gunner seat (look at 3rd parameter description)

- deleted spawn restrictions, AI can now be spawned in any case as long as a vehicle object is given.

renameing the script into Sarogahtyps Simple Crew Spawner - SSCS because of wider usage possibilities.

 

Changelog V-1.1 hotfix 1:

- fixed bug where AI joined players group but player was not leader

 

Changelog V-1.1:

features

 -added option for timout after which AI gets deleted

 -added option for spawning (or not) cargo AI which can fire its weapon from vehicle (FFV)

 -added option for spawning cargo AI which can not fire from vehicle

 -added AI joins players group option (may cause Multiplayer conflicts but this is not tested)

 -added option for suppressing hint messages

 

bug fixes

 - worked around a CUP mod bug where more seats are returned by CUP as really exists in vehicle. CUP is not able to fix this bug on teir own.

 

Changelog V-1.0:

-added script

 

 

 

If you have any questions then just ask, please!

 

Edited by sarogahtyp
  • Like 5

Share this post


Link to post
Share on other sites

I can place addaction in the vehicle init I want to have "Embark AI Crew" and the SSAIG.sqf in my vehicle spawn script.

 

The addaction is straight forward, but I not quite sure the vehicle spawner is going to work. I need to test but am not home.

 

Spoiler

this addAction ["Embark AI Crew", "SA\scripts\SSAIG.sqf", [], 0, true, true, "", "true", -1, false, "", ""];

 

 

Spoiler

[_vehicle] spawn SSAIG.sqf;

 

 

THanks for great script.

  • Like 1

Share this post


Link to post
Share on other sites
7 hours ago, Jnr4817 said:

I can place addaction in the vehicle init I want to have "Embark AI Crew" and the SSAIG.sqf in my vehicle spawn script.

 

The addaction is straight forward, but I not quite sure the vehicle spawner is going to work. I need to test but am not home.

 

 

yes, this is a good way to use the script. Ill tweak it within the next weak. In current version a gunner of a tank will not fire at an enemy (all other AI will fire but not the gunner). This will be fixed with next version.

I think u could also use a delete AI script to get rid of em 🙂

  • Thanks 1

Share this post


Link to post
Share on other sites

It would be nice to have the delete group function in the script itself.

  • Like 1

Share this post


Link to post
Share on other sites
9 minutes ago, Jnr4817 said:

It would be nice to have the delete group function in the script itself.

planned feature is to have a parameter where you can tell after how much seconds they get deleted. actually the AI gets deleted

after 3600 seconds (1 hour).

  • Like 1

Share this post


Link to post
Share on other sites

This is how I added into my vehicle spawner script.

[_vehicle, ["Embark AI Crew", "SA\scripts\SSAIG.sqf", nil, 2, true, true, "", "true", 3.5, false]] remoteExec ["addAction",0, true];

Thanks

  • Like 1

Share this post


Link to post
Share on other sites

So, I tested this out last night for several hours.

In a helicopter, which my main use, only the co-pilot seat and door gunner seats are spawning AI.

It would be nice to have some of the seats AI can also shoot from, like on the CUP MH60 or MELB, etc.

 

I also noticed if you spawn a new vehicle, the spawn the AI, then change the vehicle, the AI just fall out of aircraft and then you cant embark anymore until those are gone. 

Another example, try embarking on 1 aircraft, the move to another and do the same.

 

One more questions, anyway to make the embarking AI join your group, so they can laser designate for you?

 

Awesome work.

Share this post


Link to post
Share on other sites
1 hour ago, Jnr4817 said:

So, I tested this out last night for several hours.

In a helicopter, which my main use, only the co-pilot seat and door gunner seats are spawning AI.

It would be nice to have some of the seats AI can also shoot from, like on the CUP MH60 or MELB, etc.

 

I also noticed if you spawn a new vehicle, the spawn the AI, then change the vehicle, the AI just fall out of aircraft and then you cant embark anymore until those are gone. 

Another example, try embarking on 1 aircraft, the move to another and do the same.

 

One more questions, anyway to make the embarking AI join your group, so they can laser designate for you?

 

Awesome work.

I need a workshop link for the mod and the classname of the vehicles pls. But I think this is a CUP problem but I ll check it

Share this post


Link to post
Share on other sites

@Jnr4817

I downloaded the mod and I'm still testing. There are some bugs in CUP vehicles where more AI is spawning than places are available. Also there are vehicles where no AI spawns (MLRS). The issue is in CUPS vehicle config which gives wrong results when using the fullCrew command. I will create a workaround to get some of those bugs handled but other may be unfixable for me.

It will take a while until I've a complete list of the wrong results for CUP vehicles. If I finally have that list then I ll report the issue on CUPs bug tracker.

 

On ‎3‎/‎29‎/‎2019 at 2:37 PM, Jnr4817 said:

I also noticed if you spawn a new vehicle, the spawn the AI, then change the vehicle, the AI just fall out of aircraft and then you cant embark anymore until those are gone. 

Another example, try embarking on 1 aircraft, the move to another and do the same.

I don't understand this. Could you explain a bit more detailed pls.

 

On ‎3‎/‎29‎/‎2019 at 2:37 PM, Jnr4817 said:

One more questions, anyway to make the embarking AI join your group, so they can laser designate for you?

This is one feature I work on. In future you ll be able to tell the script if AI should join players group or not.

Share this post


Link to post
Share on other sites

Awesome.

 

You will need a spawn vehicle script to test, like VVS or Ghost or MGI.\

 

Once you've integrated your script into it, spawn a vehicle.

 

Now spawn a different vehicle. It kicks out the AI you embarked and wont let you respawn anymore, because they are still alive.

Share this post


Link to post
Share on other sites

Okay, I'm testing all CUP vehicles currently but bug reporting is no pleasure...

Upto now these are the tested vehicle which work as intended:

Spoiler

*************************************************
*************************************************
SIDE: EAST
FACTION: Armed Forces of the Russian Federation
Type: Cars
*************************************************
*************************************************


"BM-21"
"CUP_O_BM21_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"cargo",0,[],false],[<NULL-object>,"gunner",-1,[0],false]]

existing seats: 1 driver, 1 cargo, 1 gunner

result: WORKS - array is matching

*************************************************************
 
"Kamaz 5350"
"CUP_O_Kamaz_RU"

[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"cargo",0,[],false],[<NULL-object>,"cargo",1,[],false],[<NULL-object>,"cargo",2,[],false],
 [<NULL-object>,"cargo",3,[],false],[<NULL-object>,"cargo",4,[],false],[<NULL-object>,"cargo",5,[],false],[<NULL-object>,"cargo",6,[],false],
 [<NULL-object>,"cargo",7,[],false],[<NULL-object>,"cargo",8,[],false],[<NULL-object>,"cargo",9,[],false],[<NULL-object>,"cargo",10,[],false],
 [<NULL-object>,"cargo",11,[],false],[<NULL-object>,"cargo",12,[],false],[<NULL-object>,"cargo",13,[],false],[<NULL-object>,"cargo",14,[],false],
 [<NULL-object>,"cargo",15,[],false]]

existing seats: 1 driver, 2 cargo (front), 14 cargo (back)

result: WORKS - array is matching

**************************************************************
"Kamaz 5350 (Open)"
"CUP_O_Kamaz_Open_RU"

[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"cargo",0,[],false],[<NULL-object>,"cargo",1,[],false],[<NULL-object>,"cargo",2,[],false],
 [<NULL-object>,"cargo",3,[],false],[<NULL-object>,"cargo",4,[],false],[<NULL-object>,"cargo",5,[],false],[<NULL-object>,"cargo",6,[],false],
 [<NULL-object>,"cargo",7,[],false],[<NULL-object>,"cargo",8,[],false],[<NULL-object>,"cargo",9,[],false],[<NULL-object>,"cargo",12,[],false],
 [<NULL-object>,"cargo",13,[],false],[<NULL-object>,"cargo",14,[],false],[<NULL-object>,"cargo",15,[],false],[<NULL-object>,"Turret",10,[0],true],
 [<NULL-object>,"Turret",11,[1],true]]

existing seats: 1 driver, 2 cargo front, 12 cargo back, 2 cargo FFV back (done as turret)

result: WORKS - array is matching

**************************************************************

"Kamaz 5350 (Repair)"
"CUP_O_Kamaz_Repair_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"cargo",0,[],false],[<NULL-object>,"cargo",1,[],false]]

existing seats: 1 driver, 2 cargo

result: WORKS - array is matching

**************************************************************

"Kamaz 5350 (Ammo)"
"CUP_O_Kamaz_Reammo_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"cargo",0,[],false],[<NULL-object>,"cargo",1,[],false]]

existing seats: 1 driver, 2 cargo

result: WORKS - array is matching

**************************************************************

"Kamaz 5350 (Fuel)"
"CUP_O_Kamaz_Refuel_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"cargo",0,[],false],[<NULL-object>,"cargo",1,[],false]]

existing seats: 1 driver, 2 cargo

result: WORKS - array is matching

**************************************************************

"Towing Tractor"
"CUP_O_TowingTractor_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false]]

existing seats: 1 driver

result: WORKS - array is matching

**************************************************************

"UAZ"
"CUP_O_UAZ_Unarmed_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"cargo",0,[],false],[<NULL-object>,"cargo",1,[],false],[<NULL-object>,"cargo",2,[],false],
 [<NULL-object>,"cargo",3,[],false],[<NULL-object>,"cargo",4,[],false],[<NULL-object>,"cargo",5,[],false]]
 
 existing seats: 1 driver, 6 cargo

 result: WORKS - array is matching

**************************************************************

"UAZ (Open)"
"CUP_O_UAZ_Open_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[B Alpha 2-2:1,"cargo",4,[],false],[B Alpha 2-2:2,"Turret",2,[0],true],[B Alpha 2-2:3,"Turret",5,[1],true],
 [B Alpha 2-2:4,"Turret",0,[2],true],[B Alpha 2-2:5,"Turret",1,[3],true],[B Alpha 2-2:6,"Turret",3,[4],true]]
 
 existing seats: 1 driver, 1 cargo, 5 cargo FFV (done as turret)

 result: WORKS - array is matching

**************************************************************

"UAZ (DShKM)"
"CUP_O_UAZ_MG_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"Turret",0,[0],true],[<NULL-object>,"gunner",-1,[1],false]]

 existing seats: 1 driver, 1 gunner, 1 cargo FFV (done as turret)

 result: WORKS - array is matching

**************************************************************

"UAZ (AGS-30)"
"CUP_O_UAZ_AGS30_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"Turret",0,[0],true],[<NULL-object>,"gunner",-1,[1],false]]

 existing seats: 1 driver, 1 gunner, 1 cargo FFV (done as turret)

 result: WORKS - array is matching

**************************************************************

"UAZ (SPG-9)"
"CUP_O_UAZ_SPG9_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"Turret",0,[0],true],[<NULL-object>,"gunner",-1,[1],false]]

 existing seats: 1 driver, 1 gunner, 1 cargo FFV (done as turret)

 result: WORKS - array is matching

**************************************************************

"UAZ (Metis-M)"
"CUP_O_UAZ_METIS_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"Turret",0,[0],true],[<NULL-object>,"gunner",-1,[1],false]]

 existing seats: 1 driver, 1 gunner, 1 cargo FFV (done as turret)

 result: WORKS - array is matching

**************************************************************

"Ural"
"CUP_O_Ural_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"cargo",0,[],false],[<NULL-object>,"cargo",1,[],false],[<NULL-object>,"cargo",2,[],false],
 [<NULL-object>,"cargo",3,[],false],[<NULL-object>,"cargo",4,[],false],[<NULL-object>,"cargo",5,[],false],[<NULL-object>,"cargo",6,[],false],
 [<NULL-object>,"cargo",7,[],false],[<NULL-object>,"cargo",8,[],false],[<NULL-object>,"cargo",9,[],false],[<NULL-object>,"cargo",12,[],false],
 [<NULL-object>,"cargo",13,[],false],[<NULL-object>,"Turret",11,[0],true],[<NULL-object>,"Turret",10,[1],true]]
 
 existing seats: 1 driver, 2 cargo front, 10 cargo back, 2 cargo FFV back (done as turret)

 result: WORKS - array is matching

**************************************************************

"Ural (Open)"
"CUP_O_Ural_Open_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"cargo",0,[],false],[<NULL-object>,"cargo",1,[],false],[<NULL-object>,"cargo",2,[],false],
 [<NULL-object>,"cargo",3,[],false],[<NULL-object>,"cargo",4,[],false],[<NULL-object>,"cargo",5,[],false],[<NULL-object>,"cargo",6,[],false],
 [<NULL-object>,"cargo",7,[],false],[<NULL-object>,"cargo",8,[],false],[<NULL-object>,"cargo",9,[],false],[<NULL-object>,"cargo",12,[],false],
 [<NULL-object>,"cargo",13,[],false],[<NULL-object>,"Turret",11,[0],true],[<NULL-object>,"Turret",10,[1],true]]
 
  existing seats: 1 driver, 2 cargo front, 10 cargo back, 2 cargo FFV back (done as turret)

 result: WORKS - array is matching

**************************************************************

"Ural (Empty)"
"CUP_O_Ural_Empty_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"cargo",0,[],false],[<NULL-object>,"cargo",1,[],false]]

existing seats: 1 driver, 2 cargo

result: WORKS - array is matching


*************************************************
*************************************************
SIDE: EAST
FACTION: Armed Forces of the Russian Federation
Type: AA vehicles
*************************************************
*************************************************


"2S6 Tunguska"
"CUP_O_2S6_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"gunner",-1,[0],true],[<NULL-object>,"commander",-1,[0,0],true]]

 existing seats: 1 driver, 1 gunner, 1 commander

 result: WORKS - array is matching

**************************************************************

"2S6M Tunguska-M"
"CUP_O_2S6M_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"gunner",-1,[0],true],[<NULL-object>,"commander",-1,[0,0],true]]

 existing seats: 1 driver, 1 gunner, 1 commander

 result: WORKS - array is matching

**************************************************************

"Ural (ZU-23)"
"CUP_O_Ural_ZU23_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[B Alpha 2-1:1,"cargo",0,[],false],[B Alpha 2-1:2,"cargo",1,[],false],[B Alpha 2-1:3,"cargo",2,[],false],[B Alpha 2-1:4,"gunner",-1,[0],false]]

 existing seats: 1 driver, 1 gunner, 2 cargo front, 1 cargo back

 result: WORKS - array is matching


*************************************************
*************************************************
SIDE: EAST
FACTION: Armed Forces of the Russian Federation
Type: Aircraft
*************************************************
*************************************************

 
"Su-34"
"CUP_O_SU34_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"gunner",-1,[0],false]]

 existing seats: 1 driver, 1 gunner

 result: WORKS - array is matching

**************************************************************

"Su-25T Frogfoot"
"CUP_O_Su25_Dyn_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false]]
 
 existing seats: 1 driver

 result: WORKS - array is matching


*************************************************
*************************************************
SIDE: EAST
FACTION: Armed Forces of the Russian Federation
Type: Helicopter
*************************************************
*************************************************


"Ka-50 Black Shark"
"CUP_O_Ka50_DL_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false]]
 
 existing seats: 1 driver

 result: WORKS - array is matching

 

I found the first not working vehicle (Bug Report) but the result is not as I wanted:

Spoiler

"Ka-52"
"CUP_O_Ka52_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[B Alpha 1-5:1,"gunner",-1,[0],false],[<NULL-object>,"commander",-1,[1],false]]
 
 existing seats: 1 driver. 1 gunner

 result: BUG - array is NOT matching
 description: Ka-52 has 2 seats the driver and the gunner. fullCrew is returning a commander seat which does not exist on this vehicle.
 
 REPORT: https://dev.cup-arma3.org/T3198
 was marked as invalid by admin because extra seat is needed for switching to autocanon.
 
 WORKAROUND (not yet released): wrote workaround which deletes all spawned units which are not inside of the vehicle.

 

dev spoiler:

Spoiler

*************************************************
*************************************************
SIDE: EAST
FACTION: Armed Forces of the Russian Federation
Type: Cars
*************************************************
*************************************************


"BM-21"
"CUP_O_BM21_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"cargo",0,[],false],[<NULL-object>,"gunner",-1,[0],false]]

existing seats: 1 driver, 1 cargo, 1 gunner

result: WORKS - array is matching

*************************************************************
 
"Kamaz 5350"
"CUP_O_Kamaz_RU"

[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"cargo",0,[],false],[<NULL-object>,"cargo",1,[],false],[<NULL-object>,"cargo",2,[],false],
 [<NULL-object>,"cargo",3,[],false],[<NULL-object>,"cargo",4,[],false],[<NULL-object>,"cargo",5,[],false],[<NULL-object>,"cargo",6,[],false],
 [<NULL-object>,"cargo",7,[],false],[<NULL-object>,"cargo",8,[],false],[<NULL-object>,"cargo",9,[],false],[<NULL-object>,"cargo",10,[],false],
 [<NULL-object>,"cargo",11,[],false],[<NULL-object>,"cargo",12,[],false],[<NULL-object>,"cargo",13,[],false],[<NULL-object>,"cargo",14,[],false],
 [<NULL-object>,"cargo",15,[],false]]

existing seats: 1 driver, 2 cargo (front), 14 cargo (back)

result: WORKS - array is matching

**************************************************************
"Kamaz 5350 (Open)"
"CUP_O_Kamaz_Open_RU"

[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"cargo",0,[],false],[<NULL-object>,"cargo",1,[],false],[<NULL-object>,"cargo",2,[],false],
 [<NULL-object>,"cargo",3,[],false],[<NULL-object>,"cargo",4,[],false],[<NULL-object>,"cargo",5,[],false],[<NULL-object>,"cargo",6,[],false],
 [<NULL-object>,"cargo",7,[],false],[<NULL-object>,"cargo",8,[],false],[<NULL-object>,"cargo",9,[],false],[<NULL-object>,"cargo",12,[],false],
 [<NULL-object>,"cargo",13,[],false],[<NULL-object>,"cargo",14,[],false],[<NULL-object>,"cargo",15,[],false],[<NULL-object>,"Turret",10,[0],true],
 [<NULL-object>,"Turret",11,[1],true]]

existing seats: 1 driver, 2 cargo front, 12 cargo back, 2 cargo FFV back (done as turret)

result: WORKS - array is matching

**************************************************************

"Kamaz 5350 (Repair)"
"CUP_O_Kamaz_Repair_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"cargo",0,[],false],[<NULL-object>,"cargo",1,[],false]]

existing seats: 1 driver, 2 cargo

result: WORKS - array is matching

**************************************************************

"Kamaz 5350 (Ammo)"
"CUP_O_Kamaz_Reammo_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"cargo",0,[],false],[<NULL-object>,"cargo",1,[],false]]

existing seats: 1 driver, 2 cargo

result: WORKS - array is matching

**************************************************************

"Kamaz 5350 (Fuel)"
"CUP_O_Kamaz_Refuel_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"cargo",0,[],false],[<NULL-object>,"cargo",1,[],false]]

existing seats: 1 driver, 2 cargo

result: WORKS - array is matching

**************************************************************

"Towing Tractor"
"CUP_O_TowingTractor_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false]]

existing seats: 1 driver

result: WORKS - array is matching

**************************************************************

"UAZ"
"CUP_O_UAZ_Unarmed_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"cargo",0,[],false],[<NULL-object>,"cargo",1,[],false],[<NULL-object>,"cargo",2,[],false],
 [<NULL-object>,"cargo",3,[],false],[<NULL-object>,"cargo",4,[],false],[<NULL-object>,"cargo",5,[],false]]
 
 existing seats: 1 driver, 6 cargo

 result: WORKS - array is matching

**************************************************************

"UAZ (Open)"
"CUP_O_UAZ_Open_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[B Alpha 2-2:1,"cargo",4,[],false],[B Alpha 2-2:2,"Turret",2,[0],true],[B Alpha 2-2:3,"Turret",5,[1],true],
 [B Alpha 2-2:4,"Turret",0,[2],true],[B Alpha 2-2:5,"Turret",1,[3],true],[B Alpha 2-2:6,"Turret",3,[4],true]]
 
 existing seats: 1 driver, 1 cargo, 5 cargo FFV (done as turret)

 result: WORKS - array is matching

**************************************************************

"UAZ (DShKM)"
"CUP_O_UAZ_MG_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"Turret",0,[0],true],[<NULL-object>,"gunner",-1,[1],false]]

 existing seats: 1 driver, 1 gunner, 1 cargo FFV (done as turret)

 result: WORKS - array is matching

**************************************************************

"UAZ (AGS-30)"
"CUP_O_UAZ_AGS30_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"Turret",0,[0],true],[<NULL-object>,"gunner",-1,[1],false]]

 existing seats: 1 driver, 1 gunner, 1 cargo FFV (done as turret)

 result: WORKS - array is matching

**************************************************************

"UAZ (SPG-9)"
"CUP_O_UAZ_SPG9_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"Turret",0,[0],true],[<NULL-object>,"gunner",-1,[1],false]]

 existing seats: 1 driver, 1 gunner, 1 cargo FFV (done as turret)

 result: WORKS - array is matching

**************************************************************

"UAZ (Metis-M)"
"CUP_O_UAZ_METIS_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"Turret",0,[0],true],[<NULL-object>,"gunner",-1,[1],false]]

 existing seats: 1 driver, 1 gunner, 1 cargo FFV (done as turret)

 result: WORKS - array is matching

**************************************************************

"Ural"
"CUP_O_Ural_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"cargo",0,[],false],[<NULL-object>,"cargo",1,[],false],[<NULL-object>,"cargo",2,[],false],
 [<NULL-object>,"cargo",3,[],false],[<NULL-object>,"cargo",4,[],false],[<NULL-object>,"cargo",5,[],false],[<NULL-object>,"cargo",6,[],false],
 [<NULL-object>,"cargo",7,[],false],[<NULL-object>,"cargo",8,[],false],[<NULL-object>,"cargo",9,[],false],[<NULL-object>,"cargo",12,[],false],
 [<NULL-object>,"cargo",13,[],false],[<NULL-object>,"Turret",11,[0],true],[<NULL-object>,"Turret",10,[1],true]]
 
 existing seats: 1 driver, 2 cargo front, 10 cargo back, 2 cargo FFV back (done as turret)

 result: WORKS - array is matching

**************************************************************

"Ural (Open)"
"CUP_O_Ural_Open_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"cargo",0,[],false],[<NULL-object>,"cargo",1,[],false],[<NULL-object>,"cargo",2,[],false],
 [<NULL-object>,"cargo",3,[],false],[<NULL-object>,"cargo",4,[],false],[<NULL-object>,"cargo",5,[],false],[<NULL-object>,"cargo",6,[],false],
 [<NULL-object>,"cargo",7,[],false],[<NULL-object>,"cargo",8,[],false],[<NULL-object>,"cargo",9,[],false],[<NULL-object>,"cargo",12,[],false],
 [<NULL-object>,"cargo",13,[],false],[<NULL-object>,"Turret",11,[0],true],[<NULL-object>,"Turret",10,[1],true]]
 
  existing seats: 1 driver, 2 cargo front, 10 cargo back, 2 cargo FFV back (done as turret)

 result: WORKS - array is matching

**************************************************************

"Ural (Empty)"
"CUP_O_Ural_Empty_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"cargo",0,[],false],[<NULL-object>,"cargo",1,[],false]]

existing seats: 1 driver, 2 cargo

result: WORKS - array is matching


*************************************************
*************************************************
SIDE: EAST
FACTION: Armed Forces of the Russian Federation
Type: AA vehicles
*************************************************
*************************************************


"2S6 Tunguska"
"CUP_O_2S6_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"gunner",-1,[0],true],[<NULL-object>,"commander",-1,[0,0],true]]

 existing seats: 1 driver, 1 gunner, 1 commander

 result: WORKS - array is matching

**************************************************************

"2S6M Tunguska-M"
"CUP_O_2S6M_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"gunner",-1,[0],true],[<NULL-object>,"commander",-1,[0,0],true]]

 existing seats: 1 driver, 1 gunner, 1 commander

 result: WORKS - array is matching

**************************************************************

"Ural (ZU-23)"
"CUP_O_Ural_ZU23_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[B Alpha 2-1:1,"cargo",0,[],false],[B Alpha 2-1:2,"cargo",1,[],false],[B Alpha 2-1:3,"cargo",2,[],false],[B Alpha 2-1:4,"gunner",-1,[0],false]]

 existing seats: 1 driver, 1 gunner, 2 cargo front, 1 cargo back

 result: WORKS - array is matching


*************************************************
*************************************************
SIDE: EAST
FACTION: Armed Forces of the Russian Federation
Type: Aircraft
*************************************************
*************************************************

 
"Su-34"
"CUP_O_SU34_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"gunner",-1,[0],false]]

 existing seats: 1 driver, 1 gunner

 result: WORKS - array is matching

**************************************************************

"Su-25T Frogfoot"
"CUP_O_Su25_Dyn_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false]]
 
 existing seats: 1 driver

 result: WORKS - array is matching


*************************************************
*************************************************
SIDE: EAST
FACTION: Armed Forces of the Russian Federation
Type: Helicopter
*************************************************
*************************************************


"Ka-50 Black Shark"
"CUP_O_Ka50_DL_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false]]
 
 existing seats: 1 driver

 result: WORKS - array is matching

**************************************************************

"Ka-52"
"CUP_O_Ka52_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[B Alpha 1-5:1,"gunner",-1,[0],false],[<NULL-object>,"commander",-1,[1],false]]
 
 existing seats: 1 driver, 1 gunner

 result: BUG - array is NOT matching
 description: Ka-52 has 2 seats the driver and the gunner. fullCrew is returning a commander seat which does not exist on this vehicle.
 
 REPORT: https://dev.cup-arma3.org/T3198
 was marked as invalid by admin because extra seat is needed for switching to autocanon.
 
 WORKAROUND: wrote workaround which deletes all spawned units which are not inside of the vehicle.

**************************************************************

"Ka-60 Kasatka Grey (Rockets)"
"CUP_O_Ka60_Grey_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"cargo",0,[],false],[<NULL-object>,"cargo",1,[],false],[<NULL-object>,"cargo",2,[],false],
 [<NULL-object>,"cargo",3,[],false],[<NULL-object>,"cargo",4,[],false],[<NULL-object>,"cargo",5,[],false],[<NULL-object>,"cargo",6,[],false],
 [<NULL-object>,"cargo",7,[],false],[<NULL-object>,"Turret",-1,[0],false]]
 
 existing seats: 1 driver, 1 gunner, 8 cargo back

 result: BUG - array is NOT matching
 description: fullCrew is returning a turret seat which does not exist on this vehicle.
 
 REPORT: not reported
 
 WORKAROUND: wrote workaround which deletes all spawned units which are not inside of the vehicle.

**************************************************************
 
"Mi-24P"
"CUP_O_Mi24_P_Dynamic_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[B Alpha 1-3:1,"cargo",0,[],false],[B Alpha 1-3:2,"cargo",1,[],false],[B Alpha 1-3:3,"cargo",2,[],false],
 [B Alpha 1-3:4,"cargo",3,[],false],[B Alpha 1-3:5,"cargo",4,[],false],[B Alpha 1-3:6,"cargo",5,[],false],[B Alpha 1-3:7,"cargo",6,[],false],
 [B Alpha 1-3:8,"cargo",7,[],false],[B Alpha 1-3:9,"gunner",-1,[0],false]]
 
existing seats: 1 driver, 1 gunner, 8 cargo

result: WORKS - array is matching

**************************************************************

"Mi-6A Hook (VIV)"
"CUP_O_MI6A_RU"
[[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"Turret",-1,[0],false],[<NULL-object>,"Turret",-1,[1],false],[<NULL-object>,"Turret",-1,[2],false],
 [<NULL-object>,"Turret",-1,[3],false]]

HAS TO BE REVIEWED
**************************************************************
 
 8:39:07 "Mi-6T Hook"
 8:39:07 "CUP_O_MI6T_RU"
 8:39:07 [[B Alpha 1-2:1 (Sarogahtyp),"driver",-1,[],false],[<NULL-object>,"cargo",0,[],false],[<NULL-object>,"cargo",1,[],false],[<NULL-object>,"cargo",2,[],false],[<NULL-object>,"cargo",3,[],false],[<NULL-object>,"cargo",4,[],false],[<NULL-object>,"cargo",5,[],false],[<NULL-object>,"cargo",6,[],false],[<NULL-object>,"cargo",7,[],false],[<NULL-object>,"cargo",8,[],false],[<NULL-object>,"cargo",9,[],false],[<NULL-object>,"cargo",10,[],false],[<NULL-object>,"cargo",11,[],false],[<NULL-object>,"cargo",12,[],false],[<NULL-object>,"cargo",13,[],false],[<NULL-object>,"cargo",14,[],false],[<NULL-object>,"cargo",15,[],false],[<NULL-object>,"cargo",16,[],false],[<NULL-object>,"cargo",17,[],false],[<NULL-object>,"cargo",18,[],false],[<NULL-object>,"cargo",19,[],false],[<NULL-object>,"cargo",20,[],false],[<NULL-object>,"cargo",21,[],false],[<NULL-object>,"cargo",22,[],false],[<NULL-object>,"cargo",23,[],false],[<NULL-object>,"cargo",24,[],false],[<NULL-object>,"cargo",25,[],false],[<NULL-object>,"cargo",26,[],false],[<NULL-obj
 
 must use other method, diag_log does not log the complete array.

 

Share this post


Link to post
Share on other sites

Released:

Sarogahtyps Simple AI Gunners - SSAIG V-1.1

 

Changelog V-1.1:

features

 -added option for timout after which AI gets deleted

 -added option for spawning (or not) cargo AI which can fire its weapon from vehicle (FFV)

 -added option for spawning cargo AI which can not fire from vehicle

 -added AI joins players group option

 -added option for suppressing hint messages

 

bugs

 - worked around a CUP mod bug where more seats are returned by CUP as really exists in vehicle. CUP is not able to fix this bug on teir own.

  • Like 2

Share this post


Link to post
Share on other sites
14 hours ago, sarogahtyp said:

Released:

Sarogahtyps Simple AI Gunners - SSAIG V-1.1

 

Changelog V-1.1:

features

 -added option for timout after which AI gets deleted

 -added option for spawning (or not) cargo AI which can fire its weapon from vehicle (FFV)

 -added option for spawning cargo AI which can not fire from vehicle

 -added AI joins players group option

 -added option for suppressing hint messages

 

bugs

 - worked around a CUP mod bug where more seats are returned by CUP as really exists in vehicle. CUP is not able to fix this bug on teir own.

I will test later today.

 

How do I add the new params into this statement.

[_vehicle, ["Embark AI Crew", "SA\scripts\SSAIG.sqf", nil, 2, true, true, "", "true", 3.5, false]] remoteExec ["addAction",0, true];

 

  • Thanks 1

Share this post


Link to post
Share on other sites
2 hours ago, Jnr4817 said:

I will test later today.

 

How do I add the new params into this statement.


[_vehicle, ["Embark AI Crew", "SA\scripts\SSAIG.sqf", nil, 2, true, true, "", "true", 3.5, false]] remoteExec ["addAction",0, true];

 

good question. I did not think about the first 3 parameters which are passed to the script by addAction.

 

change this line in SSAIG script:

params [["_vec", objNull, [objNull]], ["_AI_timeout", 3600, [0]], ["_own_gun", true, [true]], ["_cargo_spawn", false, [true]], ["_group_player", false, [true]], ["_quite", false, [true]]];

to:

(_this select 3) params [["_vec", objNull, [objNull]], ["_AI_timeout", 3600, [0]], ["_own_gun", true, [true]], ["_cargo_spawn", false, [true]], ["_group_player", false, [true]], ["_quite", false, [true]]];

 

now you are able to pass all parameters as array to addAction. If you want just to change to join players group and suppress the hints it would be this:

[_vehicle, ["Embark AI Crew", "SA\scripts\SSAIG.sqf", [_vehicle, nil, nil, nil, true, true], 2, true, true, "", "true", 3.5, false]] remoteExec ["addAction",0, true];

if u for example just like to change the timeout then it would be:

[_vehicle, ["Embark AI Crew", "SA\scripts\SSAIG.sqf", [_vehicle, 1200], 2, true, true, "", "true", 3.5, false]] remoteExec ["addAction",0, true];

default values would be this:

[_vehicle, ["Embark AI Crew", "SA\scripts\SSAIG.sqf", [_vehicle], 2, true, true, "", "true", 3.5, false]] remoteExec ["addAction",0, true];

 

  • Like 1

Share this post


Link to post
Share on other sites

I tested and this isn't working.

 

Using default option for testing. No errors are being populated either.

 

Not sure what happens.

 

I am not getting the addaction to "Embark AI Crew"

Share this post


Link to post
Share on other sites
11 hours ago, Jnr4817 said:

I will test later today.

 

How do I add the new params into this statement.


[_vehicle, ["Embark AI Crew", "SA\scripts\SSAIG.sqf", nil, 2, true, true, "", "true", 3.5, false]] remoteExec ["addAction",0, true];

 

I tested this with is your old version. It does not show the action as well. Did you copy paste a not working version of the command?

 

this is working without remoteExec in vehicles init:

this addAction ["Embark AI Crew", "SSAIG2.sqf", [this], 0, true, true, "", "true", -1, false, "", ""]

 

Share this post


Link to post
Share on other sites

I tested on hosted with what you advised changing in the script with 1.1and the new params and the new addaction

[_vehicle, ["Embark AI Crew", "SA\scripts\SSAIG.sqf", [_vehicle, nil, nil, nil, true, true], 2, true, true, "", "true", 3.5, false]] remoteExec ["addAction",0, true];

 

Share this post


Link to post
Share on other sites
14 minutes ago, Jnr4817 said:

I tested on hosted with what you advised changing in the script with the new params and the new addaction


[_vehicle, ["Embark AI Crew", "SA\scripts\SSAIG.sqf", [_vehicle, nil, nil, nil, true, true], 2, true, true, "", "true", 3.5, false]] remoteExec ["addAction",0, true];

 

 

yeah, I din't test that. I just modified your statement cause I thought that it works with the old version. but this seems not to be the case:

12 hours ago, Jnr4817 said:

I will test later today.

 

How do I add the new params into this statement.


[_vehicle, ["Embark AI Crew", "SA\scripts\SSAIG.sqf", nil, 2, true, true, "", "true", 3.5, false]] remoteExec ["addAction",0, true];

 

 

EDIT: something like this should work I guess:

[_vehicle, ["Embark AI Crew", "SA\scripts\SSAIG.sqf", [_vehicle, nil, nil, nil, true, true], 0, true, true, "", "true", -1, false, "", ""]] remoteExec ["addAction",0, true];

 

Share this post


Link to post
Share on other sites

Hmm, I can change defaults in the script and try it with old addaction...

Share this post


Link to post
Share on other sites
1 minute ago, Jnr4817 said:

Hmm, I can change defaults in the script and try it with old addaction...

see the edited above post

Share this post


Link to post
Share on other sites

tested with 1.1 and still wont populate the addaction in the spawned vehicle

In the vehicles in editor, it gives the addaction but wont spawn any ai.

 

using this one you posted for vehicle spawner.

[_vehicle, ["Embark AI Crew", "SA\scripts\SSAIG.sqf", [_vehicle], 2, true, true, "", "true", 3.5, false, "", ""]] remoteExec ["addAction",0, true];

Using this for vehicles already in editor

this addAction ["Embark AI Crew", "SA\scripts\SSAIG.sqf", [_vehicle], 2, true, true, "", "true", 3.5, false, "", ""];	

 

I still have 1.1 but with the line you said to change. Using all defaults now for debug.

I hope im giving you enough info to help. again i am not getting any errors in game or rpt.

 

Thanks

 

code im using

Spoiler

if (!isServer) exitWith {true};
/*
	Author: Sarogahtyp
	Title: SSAIG - Sarogahtyps Simple AI Gunners

	Description: Embarks AI gunners for a player driven vehicle. Is thought to be executed server-side and not on client.

	Arguments:
	object - vehicle which should be filled with AI gunners
	number - timeout - seconds after the AI gets deleted
					 - default is 3600 (1h) - 0 or lower means not to delete after a timeout
	boolean - FFV - true if AI should be spawned on cargo places 
				    where they can shoot with their own weapon from - default is true
	boolean - cargo spawn - if true then cargo AI which can not fire from vehicle is spawned
	boolean - group player - if true then AI joins players group (order is join the player who is driver, commander, gunner, elsewhere) 
						   - false means own group for AI - default is false
	boolean - quite - true if script should be quite (no info hints) - default is false
	 
	Return value:
	boolean - true if script has been finished

	this addAction ["Embark AI Crew", "SA\scripts\SSAIG.sqf", [_vehicle], 0, true, true, "", "true", 3.5, false, "", ""];	
	[_vehicle, ["Embark AI Crew", "SA\scripts\SSAIG.sqf", [_vehicle], 0, true, true, "", "true", 3.5, false]] remoteExec ["addAction",0, true];
	
*/

//params [["_vec", objNull, [objNull]], ["_AI_timeout", 3600, [0]], ["_own_gun", true, [true]], ["_cargo_spawn", false, [true]], ["_group_player", false, [true]], ["_quite", false, [true]]];
(_this select 3) params [["_vec", objNull, [objNull]], ["_AI_timeout", 1800, [0]], ["_own_gun", true, [true]], ["_cargo_spawn", false, [true]], ["_group_player", true, [true]], ["_quite", true, [true]]];

if ((!(_vec in vehicles) and !isPlayer _vec) or isNull _vec or damage _vec isEqualTo 1) exitWith {true};

_player = driver _vec;

if (!isPlayer _player or isNull _player or !alive _player) exitWith {true};

if (!_quite && {isNull objectParent _player}) exitWith {["You can get AI gunners for any vehicle here."] remoteExec ["hintSilent", _player]; true}; 

// add class names to _spawn_pool to get your prefered classes spawned
_spawn_pool = ["B_Soldier_GL_F","B_HeavyGunner_F"];

_turrets = fullCrew [_vec, "", true];
_squadpos = _vec getPos [10, random 360];
_squad = grpNull;
_vec_full = true;

_empty_seats = [];
_player_seats = [];
_AI_seats = [];

if (isNil "SSAIG_seat_array_switch") then
{
 SSAIG_seat_array_switch = compile
 "
  params ['_unit'];
  
  if (isNull _unit) exitWith {_empty_seats pushBack _this};
  if (isPlayer _unit) exitWith {_player_seats pushBack _this};
  _AI_seats pushBack _this; 
 ";
};

{
 _role = toLower (_x select 1);
 
 if !(_role isEqualTo "commander" || _role isEqualTo "gunner" || _role isEqualTo "driver") then
 {
  _index = _x call SSAIG_seat_array_switch;
 }; 
} count (fullCrew [_vec, "", true]);

_commander = fullCrew [_vec, "commander", true];
_commander = if (count _commander > 0) then {_commander select 0} else {_commander};

_gunner = fullCrew [_vec, "gunner", true];
_gunner = if (count _gunner > 0) then {_gunner select 0} else {_gunner};

_driver = fullCrew [_vec, "driver", true];
_driver = if (count _driver > 0) then {_driver select 0} else {_driver};

if (_group_player) then
{
 if( count _driver > 0 && {isPlayer (_driver select 0)}) then
 {
  _squad = group (_driver select 0);
 }
 else
 {
  if( count _commander > 0 && {isPlayer (_commander select 0)}) then
  {
   _squad = group (_commander select 0);
  }
  else
  {
   if( count _gunner > 0 && {isPlayer (_gunner select 0)}) then
   {
    _squad = group (_gunner select 0);
   }
   else
   {
    if( count _player_seats > 0 ) then
    {
	 _squad = group (_player_seats select 0 select 0); 
	}
	else
	{
     _squad = createGroup [west, false];
	};
   };
  };
 };
}
else
{
 _squad = createGroup [west, false];
};

_squad addVehicle _vec;

// ********** Check if there is a seat where an AI can be spawned and spawn it
{
 _x params ["_seat", "_role", "_c_t3", "_turret_path", "_ffv"];
 
  _role = toLower _role;
  _path_cnt = count _turret_path;
  
  _is_locked = if ( _path_cnt > 0 && {_vec lockedTurret _turret_path}) then {true} else {false};
  
 //seat empty?
 if(isNull _seat && !_is_locked) then  
 {
  //handle "turret" type seats?
  if( ((_own_gun && _ffv) || !_ffv) && _role isEqualTo "turret" ) then
  {
   _unit = _squad createUnit [(selectRandom _spawn_pool), (_squadpos getPos [2, (random 360)]), [], 0, "NONE"];
   _unit assignAsTurret [_vec, _turret_path];  
   _unit moveInTurret [_vec, _turret_path];
   _vec_full = false;
  }
  else
  {
   // is turret gunner seat?
   if(_role isEqualTo "gunner") then
   {
    _unit = _squad createUnit [(selectRandom _spawn_pool), (_squadpos getPos [2, (random 360)]), [], 0, "NONE"];
    _unit assignAsGunner _vec;
    _unit moveInGunner _vec; 
    _vec_full = false;
   }
   else
   {
    // is turret commander seat?
    if(_role isEqualTo "commander") then
    {
     _unit = _squad createUnit [(selectRandom _spawn_pool), (_squadpos getPos [2, (random 360)]), [], 0, "NONE"];
     _unit assignAsCommander _vec;  
     _unit moveInCommander _vec; 
	 _squad selectLeader _unit;
     _vec_full = false;
    }
    else
    {
     // is turret cargo seat and should cargo AI be spawned?
     if(_role isEqualTo "cargo" && _cargo_spawn) then
     {
      _unit = _squad createUnit [(selectRandom _spawn_pool), (_squadpos getPos [2, (random 360)]), [], 0, "NONE"];
      _unit assignAsCargo _vec;  
      _unit moveInCargo [_vec, _c_t3];
      _vec_full = false;
     }; // cargo end
    }; // commander end
   }; // gunner end
  }; // turret end
 }; // empty seat end
 true
} count _turrets;

//exit if no AI was spawned
if (!_quite && _vec_full) exitWith {["You ve no empty seat to shoot from on your vehicle."] remoteExec ["hintSilent", _vec]; true};

_vec setUnloadInCombat [false, false];

if (!_quite) then 
{ 
 ["AI gunners embarked. They ll engage enemies now."] remoteExec ["hintSilent", _player];
};

{
 _x setSkill 1;
 _x setskill ["aimingAccuracy", 1];
 _x setskill ["aimingShake", 1];
 _x setskill ["aimingSpeed", 1];
 _x setskill ["endurance", 1];
 _x setskill ["spotDistance", 1];
 _x setskill ["spotTime", 1];
 _x setskill ["courage", 1];
 _x setskill ["reloadSpeed", 1];
 _x setskill ["commanding", 1];
 _x setskill ["general", 1];
 true
} count (units _squad);

 // make squad agressive and skilled
 _squad setCombatMode "YELLOW";
 _squad setBehaviour "AWARE";

//track _units for later deletion
[_vec, _squad, _AI_timeout] spawn 
{
 params ["_vec", "_squad", "_AI_timeout"];
 
 _timeout = time + _AI_timeout;
	
 waitUntil 
 {
  sleep (60 + random 60); 
  (damage _vec isEqualTo 1 or isNull _vec or {alive _x} count units _squad < 1 or (time > _timeout && _AI_timeout > 0))
 };

 _squad deleteGroupWhenEmpty true;

 {
  deleteVehicle _x;
 } count units _squad;
};
true

 

 

Share this post


Link to post
Share on other sites

could u do a simple demo mission which I can look at pls? because the addAction (without remoteExec) I posted above is working on my end. But I can do more test in 6 hours at earliest.

 

Ill upload a working test mission as well then.

 

EDIT: also did u test this line?

[_vehicle, ["Embark AI Crew", "SA\scripts\SSAIG.sqf", [_vehicle, nil, nil, nil, true, true], 0, true, true, "", "true", -1, false, "", ""]] remoteExec ["addAction",0, true];

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×