Jump to content
Blitzen88

Trouble with Beerkan AI SKill Script

Recommended Posts

Im trying to use Beerkan's AI Skill Script to set AI skill levels.  The script seems to run fine for the first interation but seems to run into issues when the script loops.  This is what Im using:

 

ConfigUnits = {
        _unit = _this select 0;
	
	_unit AllowFleeing 0;
	_unit AllowCrewInImmobile True;
	_unit setSkill ["aimingAccuracy", 0.4 + (random 0.25)];
	_unit setSkill ["aimingShake", 0.25 + (random 0.25)];
	_unit setSkill ["aimingSpeed", 0.75 + (random 0.25)];
	_unit setSkill ["commanding", 1 + (random 0.15)];
	_unit setSkill ["courage", 1 + (random 0.15)];
	_unit setSkill ["general", 0.75 + (random 0.25)];
	_unit setSkill ["reloadSpeed", 0.8 + (random 0.05)];
	_unit setSkill ["spotDistance", 1 + (random 0.20)];
	_unit setSkill ["spotTime", 0.75+ (random 0.25)];
                };
                

// Now save this array of units for later use
	_CheckedUnits = allUnits;


// We now have all Units that started on the map with configured with our new settings.
// We can now set up a loop to monitor for anything new being created (3 minute second loop)

while {true} do
{
	_NewUnits = [];					// this variable will contain any new units that were not included on a previous loop

	_NewUnits = allUnits - _CheckedUnits; 		// Remove checked Units from the updated Unit array to create a list of new Units

if (count _NewUnits > 0) then 				// Now only do the following if there are new units found.
	{[_x] spawn ConfigUnits} forEach _NewUnits;	

	composeText [parsetext format["<t size='1.5' align='left' color='#ffffff'>There are <t color='#00ff00'>%1 <t color='#ffffff'>new units found and <t color='#ff0000'>%2 <t color='#ffffff'>Checked Units",count _NewUnits,count _CheckedUnits]] remoteExec ["hint"];// Debug
		_CheckedUnits append _NewUnits;
		sleep 20;
};

Im getting the following error:

 

Undefined variable in expression: _unit

_unit = _this select 0;

#_unit AllowFleeing 0;

Anyone have any ideas?

 

Share this post


Link to post
Share on other sites

Missing braces for IF statement...

if (count _NewUnits > 0) then { //<<<missing
	{[_x] spawn ConfigUnits} forEach _NewUnits;	
}; //<<<missing

Plus _checkedUnits should be a blank array otherwise you are never checking initial existing units.

_CheckedUnits = allUnits;

//snip

//So allunits - allUnits == []
_NewUnits = allUnits - _CheckedUnits;
Spoiler

ConfigUnits = {
	_unit = _this select 0;

	_unit AllowFleeing 0;
	_unit AllowCrewInImmobile True;
	_unit setSkill ["aimingAccuracy", 0.4 + (random 0.25)];
	_unit setSkill ["aimingShake", 0.25 + (random 0.25)];
	_unit setSkill ["aimingSpeed", 0.75 + (random 0.25)];
	_unit setSkill ["commanding", 1 + (random 0.15)];
	_unit setSkill ["courage", 1 + (random 0.15)];
	_unit setSkill ["general", 0.75 + (random 0.25)];
	_unit setSkill ["reloadSpeed", 0.8 + (random 0.05)];
	_unit setSkill ["spotDistance", 1 + (random 0.20)];
	_unit setSkill ["spotTime", 0.75+ (random 0.25)];
};


// Now save this array of units for later use
_CheckedUnits = [];


// We now have all Units that started on the map with configured with our new settings.
// We can now set up a loop to monitor for anything new being created (3 minute second loop)

while {true} do {
	_NewUnits = allUnits - _CheckedUnits; 		// Remove checked Units from the updated Unit array to create a list of new Units

	if (count _NewUnits > 0) then {	// Now only do the following if there are new units found.
		{
			[_x] spawn ConfigUnits
		}forEach _NewUnits;	
	};

	composeText [parsetext format["<t size='1.5' align='left' color='#ffffff'>There are <t color='#00ff00'>%1 <t color='#ffffff'>new units found and <t color='#ff0000'>%2 <t color='#ffffff'>Checked Units",count _NewUnits,count _CheckedUnits]] remoteExec ["hint"];// Debug
	_CheckedUnits append _NewUnits;
	sleep 20;
};

 

 

Share this post


Link to post
Share on other sites
On 8/23/2019 at 9:29 PM, Larrow said:

Missing braces for IF statement...


if (count _NewUnits > 0) then { //<<<missing
	{[_x] spawn ConfigUnits} forEach _NewUnits;	
}; //<<<missing

Plus _checkedUnits should be a blank array otherwise you are never checking initial existing units.


_CheckedUnits = allUnits;

//snip

//So allunits - allUnits == []
_NewUnits = allUnits - _CheckedUnits;
  Reveal hidden contents


ConfigUnits = {
	_unit = _this select 0;

	_unit AllowFleeing 0;
	_unit AllowCrewInImmobile True;
	_unit setSkill ["aimingAccuracy", 0.4 + (random 0.25)];
	_unit setSkill ["aimingShake", 0.25 + (random 0.25)];
	_unit setSkill ["aimingSpeed", 0.75 + (random 0.25)];
	_unit setSkill ["commanding", 1 + (random 0.15)];
	_unit setSkill ["courage", 1 + (random 0.15)];
	_unit setSkill ["general", 0.75 + (random 0.25)];
	_unit setSkill ["reloadSpeed", 0.8 + (random 0.05)];
	_unit setSkill ["spotDistance", 1 + (random 0.20)];
	_unit setSkill ["spotTime", 0.75+ (random 0.25)];
};


// Now save this array of units for later use
_CheckedUnits = [];


// We now have all Units that started on the map with configured with our new settings.
// We can now set up a loop to monitor for anything new being created (3 minute second loop)

while {true} do {
	_NewUnits = allUnits - _CheckedUnits; 		// Remove checked Units from the updated Unit array to create a list of new Units

	if (count _NewUnits > 0) then {	// Now only do the following if there are new units found.
		{
			[_x] spawn ConfigUnits
		}forEach _NewUnits;	
	};

	composeText [parsetext format["<t size='1.5' align='left' color='#ffffff'>There are <t color='#00ff00'>%1 <t color='#ffffff'>new units found and <t color='#ff0000'>%2 <t color='#ffffff'>Checked Units",count _NewUnits,count _CheckedUnits]] remoteExec ["hint"];// Debug
	_CheckedUnits append _NewUnits;
	sleep 20;
};

 

 

All of that got it work perfectly!

 

Is there anyway you could show me how to take the framework of that script and apply it to equiping/removing a unit's nightvision goggles?  I have tried and tried but I dont know what I am doing wrong.  This is what I got:

//Define Variables
_NVGWest = _this select 0;
_NVGEast = _this select 1;
_NVGIndep = _this select 2;





// Now save this array of units for later use
_CheckedUnits = [];

// We now have all Units that started on the map with configured with our new settings.
// We can now set up a loop to monitor for anything new being created (3 minute second loop)

While {True} do {
	_NewUnits = allUnits - _CheckedUnits;		 // Remove checked Units from the updated Unit array to create a list of new Units

	if (count _NewUnits > 0) then {			// Now only do the following if there are new units found.

If (_NVGWest) then {
	{If ((side _x) == West) then {_x AddItem "NVGoggles"; _x AssignItem "NVGoggles";}}forEach allunits;
} Else {_x UnAssignItem "NVGoggles"; _x RemoveItem "NVGoggles";}forEach allunits;

If (_NVGEast) then {
	{If ((side _x) == East) then {_x AddItem "NVGoggles_Opfor"; _x AssignItem "NVGoggles_Opfor";}}forEach allunits;
} Else {_x UnAssignItem "NVGoggles_Opfor"; _x RemoveItem "NVGoggles_Opfor";}forEach allunits;

If (_NVGIndep) then {
	{If ((side _x) == Independent) then {_x AddItem "NVGoggles_Indep"; _x AssignItem "NVGoggles_Indep";}}forEach allunits;
} Else {_x UnAssignItem "NVGoggles_Indep"; _x RemoveItem "NVGoggles_Indep";}forEach allunits

};

composeText [parsetext format["<t size='1.5' align='left' color='#ffffff'>There are <t color='#00ff00'>%1 <t color='#ffffff'>new units found and <t color='#ff0000'>%2 <t color='#ffffff'>Checked Units",count _NewUnits,count _CheckedUnits]] remoteExec ["hint"];// Debug

_CheckedUnits append _NewUnits;

sleep 15;
};

 

Share this post


Link to post
Share on other sites

That's an old version of my ConfigAI script.

 

to remove NV Gogggles add this line.

_unit unlinkItem hmd _unit;

 

Latest Script.

// ConfigAI Skills script
// By Beerkan beta 1.0b
// Also redresses faction OPF with U_O_PilotCoveralls


//Client/Server Check
if (!isServer && hasinterface) exitWith {};

// Setup function to set AI Skill and redress Faction
ConfigAI =
{_unit = _this select 0;
    _unit setskill ['aimingAccuracy',(0.3 + random 0.3)];
    _unit setskill ['aimingShake',(0.3 + random 0.3)];
    _unit setskill ['aimingSpeed',(0.3 + random 0.3)];
    _unit setskill ['commanding',(0.3 + random 0.3)];
    _unit setskill ['courage',1];
//    _unit setskill ['endurance',(0.3 + random 0.5)];// No longer used in ArmA3
    _unit setskill ['general',(0.3 + random 0.4)];
    _unit setskill ['reloadSpeed',(0.2 + random 0.3)];
    _unit setskill ['spotDistance',(0.3 + random 0.3)];
    _unit setskill ['spotTime',(0.3 + random 0.3)];
    _unit allowfleeing 0;
    _unit enableFatigue false;
    _unit enableStamina false;
    removeuniform _unit;
    removevest _unit;
    removeHeadgear _unit;
    removeGoggles _unit;
    _unit unlinkItem hmd _unit; // Remove NV Goggles
    _unit forceadduniform 'U_O_PilotCoveralls';
    _unit addvest 'V_TacVest_oli';
    for '_i' from 1 to 3 do {_unit addItem 'FirstAidKit';_unit addmagazine 'HandGrenade';_unit addmagazine 'SmokeShell';_unit addmagazine 'Chemlight_blue'};
    if ((leader group _unit) isEqualto _unit)
    then {
          _unit addHeadgear 'H_Beret_blk';
          _unit addGoggles 'G_Tactical_Black';
         }
    else {
        _unit addHeadgear selectRandom ['H_Cap_blk','H_MilCap_gry','H_Watchcap_blk','H_Bandanna_sand','H_Bandanna_khk_hs','H_Bandanna_surfer_blk'];
        _unit addGoggles selectRandom ['','','','','','','','','','','','G_Sport_Blackred','G_Tactical_Clear','G_Shades_Blue','G_Aviator',
        'G_Squares_Tinted','G_Squares','G_Shades_Red','G_Balaclava_blk','G_Shades_Black','G_Lowprofile','G_Combat','G_Spectacles_Tinted',
        'G_Spectacles','G_Balaclava_blk','G_Balaclava_combat','G_Balaclava_lowprofile','G_Balaclava_oli','G_Bandanna_aviator',
        'G_Bandanna_beast','G_Bandanna_blk','G_Bandanna_oli','G_Bandanna_khk','G_Bandanna_shades','G_Bandanna_sport'];
        };
    //Give unit basic supplies
    _weaponMag = currentMagazine _unit;
    for '_i' from 1 to 4 do {_unit addmagazine _weaponMag};
    //Now add Flashlight only if it's night..
    _GiveFlashlight = sunOrMoon;
    if (_GiveFlashlight < 1)
        then {
            _unit unassignItem 'acc_pointer_IR';
            _unit removePrimaryWeaponItem 'acc_pointer_IR';
            _unit addPrimaryWeaponItem 'acc_flashlight';
            _unit assignItem 'acc_flashlight';
            _unit enableGunLights 'ForceOn';
            _unit setskill ['spotDistance',(0 + random 0.3)];// Reduce for night time
            _unit setskill ['spotTime',(0 + random 0.3)];
            };
    _unit setface selectrandom ['NATOHead_01','WhiteHead_02','WhiteHead_03','WhiteHead_04','WhiteHead_05','WhiteHead_06','WhiteHead_07','WhiteHead_08',
    'WhiteHead_09','WhiteHead_10','WhiteHead_11','WhiteHead_12','WhiteHead_13','WhiteHead_14','WhiteHead_15'];
};

/* Now set each unit based on Faction
    Factions can be one of the following
    West: "BLU_F" (NATO), "BLU_G_F" (FIA), "BLU_CTRG_F" (NATO CTRG), BLU_GEN_F (POLICE)
    East: "OPF_F" (CSAT), "OPF_G_F" (FIA), "OPF_T_F" (CSAT Tanoa)
    Guer: "IND_F" (AAF),  "IND_G_F" (FIA), "IND_C_F" (SYNDIKAT Tanoa)
    Civ: "CIV_F" (Civilians)
*/

// Check for new units every 20 seconds
[]spawn {
        while {true} do
            {
                if {_x getVariable ["ConfigAISet", nil]} exitWith {};// If unit ConfigAI is already set exit loop.
                    { if (( _x IsKindof 'Man') and (faction _x isEqualTo 'OPF_F'))
                        then {[_x] call ConfigAI}
                        else {if (faction _x isEqualTo 'OPF_F')} then {{[_x] call ConfigAI} forEach crew _x};
                    };
                _x setVariable ["ConfigAISet",1, true];// Set unit ConfigAI on
            } forEach allUnits;
        sleep 20;    
        };

 

  • Like 2

Share this post


Link to post
Share on other sites

Wow, thats a lot of scripting. My feeble mind was able to pick up on the redressing part of the script but then blew a fuse. 

 

Im trying to utilize the frame work of your script to give/remove night vision goggles to units of a particular side. 

 

The thought is to change how the script is called via the init file to easily change who has access to night vision, ie:

 

[true, true, false] execvm script

 

Where each true/false input corresponds to a side. I need the script to loop because I use a lot of spawning in my missions.  

Share this post


Link to post
Share on other sites
//[ east, west, independent ]
// ^^^^^ !!!take note CHANGE in side order so it is compatible with BIS_fnc_sideID

//Make sure passed array has three indexes
_this resize 3;

//Make sure each index is a boolean, if not set as false
_this = _this apply{ [ false, _x ] select( _x isEqualType true ) };

while { true } do {
	//Get all units that have not had their HMD checked
	_newUnits = allUnits select{ !( _x getVariable[ "HMD_Checked", false ] ) && { side _x in [ east, west, independent ] } };

	//For each unit
	{
		//Get there side ID, east = 0, west = 1, independent = 2
		_sideID = side _x call BIS_fnc_sideID;
		
		//If scripts argument for side is true
		if ( _this select _sideID ) then {
			//Add and Assign correct sides NVG
			_x linkItem ( [ "NV_Goggles_Opfor", "NVGoggles", "NVGoggles_Indep" ] select _sideID );
		}else{
			//Unassign and remove units NVG
			_x unlinkItem hmd _x;
		};
		
		//Mark as checked
		_x setVariable[ "HMD_Checked", true ];
	}forEach _newUnits;

	sleep 15;
};

Untested

 

 

@Beerkan

There are loads of errors in your while loop.

[]spawn {
	while {true} do {
		//condition in braces, nil condition, exitWith forfitting other unset units
		if {_x getVariable ["ConfigAISet", nil]} exitWith {};
		{//erronious braces
			//Why only faction OPF_F? isKindOf "MAN" is true its allUnits
			if (( _x IsKindof 'Man') and (faction _x isEqualTo 'OPF_F')) then {
				[_x] call ConfigAI
			}else{
				if (faction _x isEqualTo 'OPF_F')
			} /*missplaced brace causing error to above IF statement*/ then {
				{
					[_x] call ConfigAI
				} forEach crew _x //Why crew? its allUnits
			};
		};//erronious braces
		_x setVariable ["ConfigAISet",1, true]; //setting to 1 does not comply with your original condition
	//foreach on back of while closing brace
	} forEach allUnits;
	sleep 20;    
};

 

 

  • Like 1

Share this post


Link to post
Share on other sites

@Larrow

 

Thank you for your help! Every time you post something I learn of new commands and ways of doing things that I didnt know about before

  • Like 1

Share this post


Link to post
Share on other sites
20 hours ago, Larrow said:

Untested

 

I was able to run it real quick and it seems to work well with units that placed down at the start of the mission but not as well with units that spawn after the mission starts.  Some of the spawned units have their NVG's removed but other units (within the same squad) do not have their NVGs removed.  I observed the units through what should have been multiple loops and the NVGs were never removed.

 

I didnt  get any errors.

 

**EDIT**

 

My guess is that this issue relates to how the unit is equipped upon spawning.  It seems there is a delay between when the unit spawns and when it receives its gear.  The unit spawns in, gets HMD_Checked true'd, and then receives its gear...?

Share this post


Link to post
Share on other sites
8 hours ago, Blitzen88 said:

It seems there is a delay between when the unit spawns and when it receives its gear.

How are the units receiving gear?

Share this post


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

How are the units receiving gear?

For whatever reason my SpawnAI Module does not spawn units with all of their gear; they spawn in with their uniform, vest, backpack, and weapon but do not have first aidkits, weapon scopes, etc.  I made a script to fix the issue:

 

/*==========================================================================================

				Arma III Attachment(s) Fix

Created by Blitzen
Updated: 7/22/2019

===========================================================================================

* AI infantry units that are spawned by the AI Spawn Module are, for whatever reason, stripped of their weapon scopes and attachments

* This script re-applys weapon scopes and lasers back to units depending upon the units class

* Call with: _this execVM "Scripts\SpawnAI_AttachmentsFix.sqf"
===========================================================================================*/

params[ "_group", "_module", "_groupData" ];

//Define Unit Types (Case Sensitive!)

_SquadLeader = ["O_Soldier_SL_F", "B_Soldier_SL_F", "I_Soldier_SL_F"];

_RiflemanAT = ["O_Soldier_LAT_F", "B_Soldier_LAT_F", "I_Soldier_LAT_F"];

_TeamLeader = ["O_Soldier_TL_F", "B_Soldier_TL_F", "I_Soldier_TL_F"];

_Ammobearer = ["O_Soldier_A_F", "B_Soldier_A_F", "I_Soldier_A_F"];

_Rifleman = ["O_Soldier_F", "B_Soldier_F", "I_Soldier_F"];

_Marksman = ["O_soldier_M_F", "B_soldier_M_F", "I_Soldier_M_F"];

_Autorifleman = ["O_Soldier_AR_F", "B_Soldier_AR_F", "I_Soldier_AR_F"];

_Medic = ["O_medic_F", "B_medic_F", "I_medic_F"];

_Grenadier = ["O_Soldier_GL_F", "B_Soldier_GL_F", "I_Soldier_GL_F"];

_MissleSpecialist = ["O_Soldier_AT_F", "B_Soldier_AT_F", "I_Soldier_AT_F"];

_AsstMissleSpecialist = ["O_Soldier_AAT_F", "B_Soldier_AAT_F", "I_Soldier_AAT_F"];

_HeavyGunner = ["O_HeavyGunner_F", "B_HeavyGunner_F"];

_AsstAutorifleman = ["O_Soldier_AAR_F", "B_Soldier_AAR_F", "I_Soldier_AAR_F"];

_Sharpshooter = ["O_Sharpshooter_F", "B_Sharpshooter_F", "I_Sharpshooter_F"];

//START
{
	_x params[ "_unit" ];
	_unitType = typeOf _unit;

//East
//---------------------------------------

if ( side _group isEqualTo East ) then {

if (_unitType in _SquadLeader) then {[_unit, configfile >> "CfgVehicles" >> "O_Soldier_SL_F"] call BIS_fnc_loadinventory;};

if (_unitType in _RiflemanAT) then {[_unit, configfile >> "CfgVehicles" >> "O_Soldier_LAT_F"] call BIS_fnc_loadinventory;};

if (_unitType in _TeamLeader) then {[_unit, configfile >> "CfgVehicles" >> "O_Soldier_TL_F"] call BIS_fnc_loadinventory;};

if (_unitType in _Ammobearer) then {[_unit, configfile >> "CfgVehicles" >> "O_Soldier_A_F"] call BIS_fnc_loadinventory;};

if (_unitType in _Rifleman) then {[_unit, configfile >> "CfgVehicles" >> "O_Soldier_F"] call BIS_fnc_loadinventory;};

if (_unitType in _Marksman) then {[_unit, configfile >> "CfgVehicles" >> "O_soldier_M_F"] call BIS_fnc_loadinventory;};

if (_unitType in _Autorifleman) then {[_unit, configfile >> "CfgVehicles" >> "O_Soldier_AR_F"] call BIS_fnc_loadinventory;};

if (_unitType in _Medic) then {[_unit, configfile >> "CfgVehicles" >> "O_medic_F"] call BIS_fnc_loadinventory;};

if (_unitType in _Grenadier) then {[_unit, configfile >> "CfgVehicles" >> "O_Soldier_GL_F"] call BIS_fnc_loadinventory;};

if (_unitType in _MissleSpecialist) then {[_unit, configfile >> "CfgVehicles" >> "O_Soldier_AT_F"] call BIS_fnc_loadinventory;};

if (_unitType in _AsstMissleSpecialist) then {[_unit, configfile >> "CfgVehicles" >> "O_Soldier_AAT_F"] call BIS_fnc_loadinventory;};

if (_unitType in _HeavyGunner) then {[_unit, configfile >> "CfgVehicles" >> "O_HeavyGunner_F"] call BIS_fnc_loadinventory;};

if (_unitType in _AsstAutorifleman) then {[_unit, configfile >> "CfgVehicles" >> "O_Soldier_AAR_F"] call BIS_fnc_loadinventory;};

if (_unitType in _Sharpshooter) then {[_unit, configfile >> "CfgVehicles" >> "O_Sharpshooter_F"] call BIS_fnc_loadinventory;};

//_unit linkItem "NVGoggles_OPFOR";

};

//West
//---------------------------------------	
if ( side _group isEqualTo West ) then {

if (_unitType in _SquadLeader) then {[_unit, configfile >> "CfgVehicles" >> "B_Soldier_SL_F"] call BIS_fnc_loadinventory;};

if (_unitType in _RiflemanAT) then {[_unit, configfile >> "CfgVehicles" >> "B_Soldier_LAT_F"] call BIS_fnc_loadinventory;};

if (_unitType in _TeamLeader) then {[_unit, configfile >> "CfgVehicles" >> "B_Soldier_TL_F"] call BIS_fnc_loadinventory;};

if (_unitType in _Ammobearer) then {[_unit, configfile >> "CfgVehicles" >> "B_Soldier_A_F"] call BIS_fnc_loadinventory;};

if (_unitType in _Rifleman) then {[_unit, configfile >> "CfgVehicles" >> "B_Soldier_F"] call BIS_fnc_loadinventory;};

if (_unitType in _Marksman) then {[_unit, configfile >> "CfgVehicles" >> "B_soldier_M_F"] call BIS_fnc_loadinventory;};

if (_unitType in _Autorifleman) then {[_unit, configfile >> "CfgVehicles" >> "B_Soldier_AR_F"] call BIS_fnc_loadinventory;};

if (_unitType in _Medic) then {[_unit, configfile >> "CfgVehicles" >> "B_medic_F"] call BIS_fnc_loadinventory;};

if (_unitType in _Grenadier) then {[_unit, configfile >> "CfgVehicles" >> "B_Soldier_GL_F"] call BIS_fnc_loadinventory;};

if (_unitType in _MissleSpecialist) then {[_unit, configfile >> "CfgVehicles" >> "B_Soldier_AT_F"] call BIS_fnc_loadinventory;};

if (_unitType in _AsstMissleSpecialist) then {[_unit, configfile >> "CfgVehicles" >> "B_Soldier_AAT_F"] call BIS_fnc_loadinventory;};

if (_unitType in _HeavyGunner) then {[_unit, configfile >> "CfgVehicles" >> "B_HeavyGunner_F"] call BIS_fnc_loadinventory;};

if (_unitType in _AsstAutorifleman) then {[_unit, configfile >> "CfgVehicles" >> "B_Soldier_AAR_F"] call BIS_fnc_loadinventory;};

if (_unitType in _Sharpshooter) then {[_unit, configfile >> "CfgVehicles" >> "B_Sharpshooter_F"] call BIS_fnc_loadinventory;};

//_unit linkItem "NVGoggles";

};

//Independent
//---------------------------------------	
if ( side _group isEqualTo Independent ) then {

if (_unitType in _SquadLeader) then {[_unit, configfile >> "CfgVehicles" >> "I_Soldier_SL_F"] call BIS_fnc_loadinventory;};

if (_unitType in _RiflemanAT) then {[_unit, configfile >> "CfgVehicles" >> "I_Soldier_LAT_F"] call BIS_fnc_loadinventory;};

if (_unitType in _TeamLeader) then {[_unit, configfile >> "CfgVehicles" >> "I_Soldier_TL_F"] call BIS_fnc_loadinventory;};

if (_unitType in _Ammobearer) then {[_unit, configfile >> "CfgVehicles" >> "I_Soldier_A_F"] call BIS_fnc_loadinventory;};

if (_unitType in _Rifleman) then {[_unit, configfile >> "CfgVehicles" >> "I_Soldier_F"] call BIS_fnc_loadinventory;};

if (_unitType in _Marksman) then {[_unit, configfile >> "CfgVehicles" >> "I_soldier_M_F"] call BIS_fnc_loadinventory;};

if (_unitType in _Autorifleman) then {[_unit, configfile >> "CfgVehicles" >> "I_Soldier_AR_F"] call BIS_fnc_loadinventory;};

if (_unitType in _Medic) then {[_unit, configfile >> "CfgVehicles" >> "I_medic_F"] call BIS_fnc_loadinventory;};

if (_unitType in _Grenadier) then {[_unit, configfile >> "CfgVehicles" >> "I_Soldier_GL_F"] call BIS_fnc_loadinventory;};

if (_unitType in _MissleSpecialist) then {[_unit, configfile >> "CfgVehicles" >> "I_Soldier_AT_F"] call BIS_fnc_loadinventory;};

if (_unitType in _AsstMissleSpecialist) then {[_unit, configfile >> "CfgVehicles" >> "I_Soldier_AAT_F"] call BIS_fnc_loadinventory;};

if (_unitType in _AsstAutorifleman) then {[_unit, configfile >> "CfgVehicles" >> "I_Soldier_AAR_F"] call BIS_fnc_loadinventory;};

if (_unitType in _Sharpshooter) then {[_unit, configfile >> "CfgVehicles" >> "I_Sharpshooter_F"] call BIS_fnc_loadinventory;};

//_unit linkItem "NVGoggles_Indep";

};

Sleep 2;

}forEach units _group;
//END

Note that the _unit linkitem NVgoggles lines were commented out whenever I tested the script.

Share this post


Link to post
Share on other sites

TEST_MISSION put through very little testing other than to make sure there where no errors.

Does that work as you expect? In regards to unit loadouts from spawnAI module.

 

As I said in your previous thread, you should really try and find what is causing your issue with loadouts from spawnAI not being correct and causing you to have to reapply them. I do not have the same problem from vanilla myself.

  • Like 1

Share this post


Link to post
Share on other sites
12 hours ago, Larrow said:

TEST_MISSION put through very little testing other than to make sure there where no errors.

Does that work as you expect? In regards to unit loadouts from spawnAI module.

 

As I said in your previous thread, you should really try and find what is causing your issue with loadouts from spawnAI not being correct and causing you to have to reapply them. I do not have the same problem from vanilla myself.

I tested the mission out and it appears to work.  I have no idea what I am doing differently.

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

×