Jump to content
sarogahtyp

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

Recommended Posts

Nice job mate.  How about allowing script to work for AI drivers also?  Seems like that would increase the script's usability.  Just place down vehicles with drivers and add your script to their init and you have AI driven vehicles with max shooters on board!

  • Thanks 1

Share this post


Link to post
Share on other sites
19 minutes ago, johnnyboy said:

Nice job mate.  How about allowing script to work for AI drivers also?  Seems like that would increase the script's usability.  Just place down vehicles with drivers and add your script to their init and you have AI driven vehicles with max shooters on board!

its planned to remove the restriction which allows only player drivers to spawn AI. Ill create options where also the driver can be spawned. with that you can spawn the full crew with it. Also planned is to be able to pass a chance to the script with which are FFV AI is spawned. some vehicles have so many FFV seats that I think it should be adjustable through a chance of spawning those AI.

  • Thanks 1

Share this post


Link to post
Share on other sites
11 minutes ago, sarogahtyp said:

its planned to remove the restriction which allows only player drivers to spawn AI. Ill create options where also the driver can be spawned. with that you can spawn the full crew with it. Also planned is to be able to pass a chance to the script with which are FFV AI is spawned. some vehicles have so many FFV seats that I think it should be adjustable through a chance of spawning those AI.

That all sounds great!   When not filling all FFV seats, consider distributing the AI in the seats so not all one side.  When vanilla AI team boards a big truck, it always has bothered me when they fill up on one side of truck only, leaving the other side empty.

  • Thanks 1

Share this post


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

That all sounds great!   When not filling all FFV seats, consider distributing the AI in the seats so not all one side.  When vanilla AI team boards a big truck, it always has bothered me when they fill up on one side of truck only, leaving the other side empty.

they will spawn on random places then. this is for sure

  • Like 1

Share this post


Link to post
Share on other sites

@sarogahtyp here is my mission.

You'll find your file under sa/scripts/ssaig.sqf

The 3 un manned helos have the addaction in the init.

 

The vehicle spawner is VVS

I added the remotexec under VVS/functions/fn_spawnVehicle.sqf

 

THanks for working on this.

Mission

 

Share this post


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

@sarogahtyp here is my mission.

You'll find your file under sa/scripts/ssaig.sqf

The 3 un manned helos have the addaction in the init.

 

The vehicle spawner is VVS

I added the remotexec under VVS/functions/fn_spawnVehicle.sqf

 

THanks for working on this.

Mission

 

I get an error while unpacking the .pbo with BankRev:

Quote

Missing prefix, cannot process -  BK%20Sandbox.Malden (6 MB)
Failed to convert 1 file(s)

 

Could you please just upload the plain mission directory maybe .zip-ed or .rar-ed? 

 

EDIT: PBO-Manager did it

EDIT2: @Jnr4817 I don't like to install more addons for this. Just do a SIMPLE example mission where you show your problem. If you use CUP vehicles/units/weapons and CBA, this is okay. But not more mods pls. Also don't PBO it... if u want to pack it then use rar or zip pls

Also I already uploaded a working mission file. Why not just looking in it. It is working with remoteExec.

EDIT3: I just viewed your init lines inside your mission.sqm ... what are you doing there? if you run the script in init line of a vehicle then you have to pass the vehicle to the script. in an init line the object which belongs to it is just this. therefore pass this to the script. You ll see that all if u view my example mission.

Share this post


Link to post
Share on other sites

Your init lines:

1. don't use call it's senseless in an init line.

2. _vehicle is unknown in init line use this.

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

 

1. don't use call ...

2. you are passing an empty array to the script. it has to have at least the vehicle object. [] -> [this]

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

And again look in my example mission file!

 

EDIT:  I saw that u r not using the hotfixed version. u ll have a bug with AI joining player groups then. use hotfixed version!

Share this post


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

Your init lines:

1. don't use call it's senseless in an init line.

2. _vehicle is unknown in init line use this.


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

 

1. don't use call ...

2. you are passing an empty array to the script. it has to have at least the vehicle object. [] -> [this]


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

And again look in my example mission file!

 

EDIT:  I saw that u r not using the hotfixed version. u ll have a bug with AI joining player groups then. use hotfixed version!

I am running the script in 2 different areas.

1st, is 3 aircraft that are placed in the editor.

2nd, is a vehicle spawner call VVS.

 

I had your script working in both prior to 1.1, I am not sure what changed that has caused it not work.

 

The only dependent mods I have are CUP, MELB, and CBA. The 3den enhanced and Zec are not causing an issue.

 

Ill open your mission and see whats going on, I haven't had time yet.

 

Ill fix everything and bring up to date with hotfix and test.

 

Thanks

Share this post


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

I am running the script in 2 different areas.

1st, is 3 aircraft that are placed in the editor.

2nd, is a vehicle spawner call VVS.

 

I had your script working in both prior to 1.1, I am not sure what changed that has caused it not work.

 

The only dependent mods I have are CUP, MELB, and CBA. The 3den enhanced and Zec are not causing an issue.

 

Ill open your mission and see whats going on, I haven't had time yet.

 

Ill fix everything and bring up to date with hotfix and test.

 

Thanks

I know what is different.

In version 1.0 there was code in it which auto detected the vehicle if a player driver executed the script. there for it did not matter that u used wrong parameters. The script fixed it for u.

But now since 1.1 I try to achieve  wider usage possibilities for the script. therefore I needed to delete that auto detection and now u need to pass parameters the correct way to the script. 

  • Thanks 1

Share this post


Link to post
Share on other sites
35 minutes ago, sarogahtyp said:

I know what is different.

In version 1.0 there was code in it which auto detected the vehicle if a player driver executed the script. there for it did not matter that u used wrong parameters. The script fixed it for u.

But now since 1.1 I try to achieve  wider usage possibilities for the script. therefore I needed to delete that auto detection and now u need to pass parameters the correct way to the script. 

Got ya.

 

Just tested and seems to be working great now on hosted, for editor vehicles and VVS Spawner.

Of note I modified this line, to change the default params, hope that is ok.

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

 

Using this for editor.

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

 

I had to change the code for the spawner to this.

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

Thanks again, Ill test more later with additional people.

Share this post


Link to post
Share on other sites

to be honest changing the params line in the script is not ok! U should just pass the correct parameters to the script by changing the arrays [this] and [_vehicle] to fit your needs. Also you do not using the  join players group option. You should test it 🙂

 

 

dev container:

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/number - FFV - true if AI should be spawned on cargo places 
				           where they can shoot with their own weapon from 
					     - 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
						 
	boolean/number - cargo spawn - if true then cargo AI which can not fire from vehicle is spawned 
						  - 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
						  
	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
						   
	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
		 
	Return value:
	boolean - true if script has been finished
*/

(_this select 3) params [

["_vec", objNull, [objNull]], 
["_AI_timeout", 3600, [0]], 
["_own_gun", true, [true, 0]], 
["_cargo_spawn", false, [true,0]], 
["_group_player", false, [true]], 
["_side", west, [west]], 
["_faction", true, [true, ""]]];

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

// 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"];
				   

// 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 = [];

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};

/*
diag_log _empty_seats;
diag_log _player_seats;
diag_log _AI_seats;

diag_log _commander;
diag_log _gunner;
diag_log _driver;


diag_log (getText (configFile >> "CfgVehicles" >> (typeOf _vec) >> "displayName"));
diag_log (typeOf _vec);
diag_log fullCrew [_vec, "", true];
*/

//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;

// 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;
   };
  };
 };
};

// ********** 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  
 {
   _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), (_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
   {

    //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), (_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
    {

    //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), (_squadpos getPos [2, (random 360)]), [], 0, "NONE"];
     _unit assignAsCommander _vec;  
     _unit moveInCommander _vec; 
	 _squad selectLeader _unit;
     _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), (_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 (_vec_full) exitWith {true};

if (_group_player) then
{
 if( count _driver > 0 && {isPlayer (_driver select 0)}) then
 {
  _squad selectLeader (_driver select 0);
 }
 else
 {
  if( count _commander > 0 && {isPlayer (_commander select 0)}) then
  {
   _squad selectLeader (_commander select 0);
  }
  else
  {
   if( count _gunner > 0 && {isPlayer (_gunner select 0)}) then
   {
	_squad selectLeader (_gunner select 0);
   }
   else
   {
    if( count _player_seats > 0 ) then
    {
	 _squad selectLeader (_player_seats select 0 select 0);
	};
   };
  };
 };
};

_vec setUnloadInCombat [false, false];

{
 _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

 

 

  • Thanks 1

Share this post


Link to post
Share on other sites
25 minutes ago, sarogahtyp said:

to be honest changing the params line in the script is not ok! U should just pass the correct parameters to the script by changing the arrays [this] and [_vehicle] to fit your needs. Also you do not using the  join players group option. You should test it 🙂

 

 

Ok, Ill change back to default. Please check below to make these are correct defaults

 

I just tested the join players group and works well so far. I did notice, when you have the join player group  set true, the AI does not spawn in Combat Mode Yellow or behavior Aware. At least, the AI doesn't appear to be Yellow or Aware.

 

Latest Version 1.1 with hotfix with corrected arrays for editor or spawner.

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

	Add to init of vehicle: [this, ["Embark AI Crew", "SSAIGv11.sqf", [this], 0, true, true, "", "true", -1, false, "", ""]] remoteExec ["addAction",0, true];
	Add to spawn script: [_vehicle, ["Embark AI Crew", "SA\scripts\SSAIG.sqf", [_vehicle], 0, true, true, "", "true", -1, false, "", ""]] remoteExec ["addAction",0, true];
	
*/

(_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]]];

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};

if (_group_player) then
{
 if( count _driver > 0 && {isPlayer (_driver select 0)}) then
 {
  _squad selectLeader (_driver select 0);
 }
 else
 {
  if( count _commander > 0 && {isPlayer (_commander select 0)}) then
  {
   _squad selectLeader (_commander select 0);
  }
  else
  {
   if( count _gunner > 0 && {isPlayer (_gunner select 0)}) then
   {
	_squad selectLeader (_gunner select 0);
   }
   else
   {
    if( count _player_seats > 0 ) then
    {
	 _squad selectLeader (_player_seats select 0 select 0);
	};
   };
  };
 };
};

_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

 

 

Thanks again for helping me out.

  • Like 1

Share this post


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

 

Ok, Ill change back to default. Please check below to make these are correct defaults

 

I just tested the join players group and works well so far. I did notice, when you have the join player group  set true, the AI does not spawn in Combat Mode Yellow or behavior Aware. At least, the AI doesn't appear to be Yellow or Aware.

 

Latest Version 1.1 with hotfix with corrected arrays for editor or spawner.

  Reveal hidden contents


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

	Add to init of vehicle: [this, ["Embark AI Crew", "SSAIGv11.sqf", [this], 0, true, true, "", "true", -1, false, "", ""]] remoteExec ["addAction",0, true];
	Add to spawn script: [_vehicle, ["Embark AI Crew", "SA\scripts\SSAIG.sqf", [_vehicle], 0, true, true, "", "true", -1, false, "", ""]] remoteExec ["addAction",0, true];
	
*/

(_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]]];

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};

if (_group_player) then
{
 if( count _driver > 0 && {isPlayer (_driver select 0)}) then
 {
  _squad selectLeader (_driver select 0);
 }
 else
 {
  if( count _commander > 0 && {isPlayer (_commander select 0)}) then
  {
   _squad selectLeader (_commander select 0);
  }
  else
  {
   if( count _gunner > 0 && {isPlayer (_gunner select 0)}) then
   {
	_squad selectLeader (_gunner select 0);
   }
   else
   {
    if( count _player_seats > 0 ) then
    {
	 _squad selectLeader (_player_seats select 0 select 0);
	};
   };
  };
 };
};

_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

 

 

Thanks again for helping me out.

just to clarify. it is indeed allowed to do changes to the code of my scripts and if u really desire then you can change the defaults to your needs. All I wanted was that you learn to be able to pass arguments to scripts correctly because I had the impression that this was a stumbling stone for you.

 

I would be happy if you continue to test the script and report bugs if some occur.

  • Thanks 1

Share this post


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

just to clarify. it is indeed allowed to do changes to the code of my scripts and if u really desire then you can change the defaults to your needs. All I wanted was that you learn to be able to pass arguments to scripts correctly because I had the impression that this was a stumbling stone for you.

 

I would be happy if you continue to test the script and report bugs if some occur.

Absolutely, I truly appreciate the education.

I really like this script and am using it now and will cont to test and report any issues.

Thanks again for the hard work and scripts you've published.

Reed

  • Thanks 1

Share this post


Link to post
Share on other sites

added planned changes for 1.2 to the bottom of first post. Should be released within the next days or maybe a week...

  • Like 1

Share this post


Link to post
Share on other sites

RELEASED SSCS V-1.2

 

 

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 possibiolity 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 xase as long as a vehicle object is given.

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

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

@sarogahtyp

 

I am trying to update to the V1.2

 

When trying to make an add action again, it is not working.

Spoiler

[this, ["Embark AI Crew", "SA\scripts\SSAIGv1-2.sqf", [this], true, true, true, true, west, nil, 1800]] remoteExec ["addAction",0, true];

 

 

The last time I had to modify this line:

Spoiler

(_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]]];

 

I don't seem to find a place to modify this, as your params have change.

 

Thanks for any help.

 

Reed

Share this post


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

I don't seem to find a place to modify this, as your params have change.

 

its the same as before but the params line is spread over multiple lines now.

just change this:

// declaring parameters, check parameter types and set default values
params [

to this:

// declaring parameters, check parameter types and set default values
(_this # 3) params [

where _this # 3 is the same as _this select 3

  • Like 1

Share this post


Link to post
Share on other sites

Awesome Job,

Works  very well.

 

I wish I had a away to Disembark crew, or delete them, when I wanted, instead of the timeout.

 

THanks

 

 

Share this post


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

Awesome Job,

Works  very well.

 

I wish I had a away to Disembark crew, or delete them, when I wanted, instead of the timeout.

 

THanks

 

 

 

 

Easy to do. just change this at scripts bottom:

Spoiler

//***********************************
//***		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

 

to this:

Spoiler

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

//track _units for later deletion
[_vec, _squad, _AI_timeout] spawn 
{
 params ["_vec", "_squad", "_AI_timeout"];
 
 _vec setVariable ["saroDeleteCrew", false];
   
 _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) or (_vec getVariable "saroDeleteCrew"))
 };

 _squad deleteGroupWhenEmpty true;

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

 

 

now whenever you want to delete a vehicles crew u can do:

_vehicle setVariable ["saroDeleteCrew", true];

_vehicle should be the variable which holds your vehicles object.

  • Like 1

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

×