Jump to content
textanker

Random Weapons / Uniforms for AI Spawning?

Recommended Posts

I have searched, I swear! 

 

I want to have the ability to have an AI soldier get random weapons and gear when the mission starts. Does anyone have something? 

 

Thanks!

Share this post


Link to post
Share on other sites

Little script of my selfmade wasteland mod, just for a similar scenario:

 

/*@params:
    _this, Object. Player or AI. Soldier to add random gear to.

    The functions got a few random templates to choose from. For whole randomness,
    you just need to make an array of weps and choose a random one.
*/
randomGearBot = {
	removeAllWeapons _this;
	removeAllItems _this;
	removeAllAssignedItems _this;
	removeUniform _this;
	removeVest _this;
	removeBackpack _this;
	removeHeadgear _this;
	removeGoggles _this;

	switch (floor (random 3)) do {
		case 0: {
			_this forceAddUniform "U_I_G_resistanceLeader_F";
			_this addItemToUniform "16Rnd_9x21_Mag";
			for "_i" from 1 to 3 do {_this addItemToUniform "30Rnd_556x45_Stanag";};
			_this addVest "V_TacVest_khk";
			for "_i" from 1 to 2 do {_this addItemToVest "16Rnd_9x21_Mag";};
			_this addBackpack "B_AssaultPack_khk";
			for "_i" from 1 to 7 do {_this addItemToBackpack "30Rnd_556x45_Stanag";};
			for "_i" from 1 to 5 do {_this addItemToBackpack "30Rnd_9x21_Mag";};
			_this addHeadgear "H_ShemagOpen_khk";
			_this addGoggles "G_Shades_Black";

			_this addWeapon "arifle_TRG21_F";
			_this addPrimaryWeaponItem "acc_pointer_IR";
			_this addPrimaryWeaponItem "optic_Aco";
			_this addWeapon "hgun_P07_F";
			_this addHandgunItem "muzzle_snds_L";

			_this linkItem "ItemCompass";
			_this linkItem "ItemWatch";
			_this linkItem "O_UavTerminal";
			_this linkItem "NVGoggles_OPFOR";

			[_this,"TFAegis"] call bis_fnc_setUnitInsignia;
		};
		case 1: {
			_this forceAddUniform "U_I_OfficerUniform";
			for "_i" from 1 to 2 do {_this addItemToUniform "16Rnd_9x21_Mag";};
			for "_i" from 1 to 2 do {_this addItemToUniform "20Rnd_762x51_Mag";};
			_this addVest "V_TacVest_camo";
			for "_i" from 1 to 3 do {_this addItemToVest "20Rnd_762x51_Mag";};
			for "_i" from 1 to 3 do {_this addItemToVest "30Rnd_9x21_Mag";};
			if((random 100) > 70) then {
				_this addBackpack "B_TacticalPack_rgr";
				for "_i" from 1 to 3 do {_this addItemToBackpack "20Rnd_762x51_Mag";};
				_this addItemToBackpack "30Rnd_9x21_Mag";
			} else {
				if((random 100) > 70) then {
					switch (floor random 3) do {
						case 0: {_this addBackpack "B_UAV_01_backpack_F";};
						case 1: {_this addBackpack "O_UAV_01_backpack_F";};
						case 2: {_this addBackpack "I_UAV_01_backpack_F";};
					};
				};
			};
			_this addHeadgear "H_HelmetIA";
			_this addGoggles "G_Shades_Green";

			_this addWeapon "srifle_EBR_F";
			_this addWeapon "hgun_P07_F";

			_this linkItem "ItemCompass";
			_this linkItem "I_UavTerminal";
			_this linkItem "NVGoggles_OPFOR";

			[_this,"111thID"] call bis_fnc_setUnitInsignia;
		};
		case 2:{
			_this forceAddUniform "U_I_CombatUniform_shortsleeve";
			for "_i" from 1 to 2 do {_this addItemToUniform "FirstAidKit";};
			_this addItemToUniform "MineDetector";
			_this addVest "V_Chestrig_rgr";
			for "_i" from 1 to 5 do {_this addItemToVest "30Rnd_65x39_caseless_mag";};
			for "_i" from 1 to 2 do {_this addItemToVest "16Rnd_9x21_Mag";};
			if((random 100) > 70) then {
				_this addBackpack "B_AssaultPack_dgtl";
				_this addItemToBackpack "FirstAidKit";
				for "_i" from 1 to 3 do {_this addItemToBackpack "30Rnd_65x39_caseless_mag";};
				for "_i" from 1 to 2 do {_this addItemToBackpack "30Rnd_65x39_caseless_mag_Tracer";};
				for "_i" from 1 to 4 do {_this addItemToBackpack "30Rnd_9x21_Mag";};
				_this addItemToBackpack "MiniGrenade";
				for "_i" from 1 to 2 do {_this addItemToBackpack "SmokeShellRed";};
			} else {
				if((random 100) > 70) then {
					switch (floor random 3) do {
						case 0: {_this addBackpack "B_UAV_01_backpack_F";};
						case 1: {_this addBackpack "O_UAV_01_backpack_F";};
						case 2: {_this addBackpack "I_UAV_01_backpack_F";};
					};
				};
			};
			_this addHeadgear "H_Bandanna_khk";
			_this addGoggles "G_Aviator";

			_this addWeapon "arifle_MXC_Black_F";
			_this addWeapon "hgun_Rook40_F";
			_this addWeapon "Binocular";

			_this linkItem "ItemMap";
			_this linkItem "ItemCompass";
			_this linkItem "ItemWatch";
			_this linkItem "ItemRadio";
			_this linkItem "NVGoggles_INDEP";

			[_this,"TFAegis"] call bis_fnc_setUnitInsignia;
		};
	};
	switch (floor random 3) do {
		case 0:{
			_this setSkill ["aimingspeed", 0.15];
			_this setSkill ["spotdistance", 0.15];
			_this setSkill ["aimingaccuracy", 0.1];
			_this setSkill ["aimingshake", 0.1];
			_this setSkill ["spottime", 0.3];
			_this setSkill ["spotdistance", 0.5];
			_this setSkill ["commanding", 0.5];
			_this setSkill ["general", 0.6];
		};
		case 1:{
			_this setSkill ["aimingspeed", 0.2];
			_this setSkill ["spotdistance", 0.2];
			_this setSkill ["aimingaccuracy", 0.2];
			_this setSkill ["aimingshake", 0.2];
			_this setSkill ["spottime", 0.4];
			_this setSkill ["spotdistance", 0.6];
			_this setSkill ["commanding", 0.6];
			_this setSkill ["general", 0.7];
		};
		case 2:{
			_this setSkill ["aimingspeed", 0.3];
			_this setSkill ["spotdistance", 0.3];
			_this setSkill ["aimingaccuracy", 0.3];
			_this setSkill ["aimingshake", 0.3];
			_this setSkill ["spottime", 0.5];
			_this setSkill ["spotdistance", 0.8];
			_this setSkill ["commanding", 0.8];
			_this setSkill ["general", 0.9];
		};
	};
};
  • Like 1

Share this post


Link to post
Share on other sites

Take a look at BIS_fnc_addWeapon, really helpful command to reduce the amount of lines in your code.

 

Cheers

 

 

Thanks mate, but it was a old script of me, simple techniques.. :D But thanks for that helpful attitude, I appriciate that!

Share this post


Link to post
Share on other sites

Place 5 triggers on the map.

Within each trigger is a command that adds uniforms, equipment and weapons to soldiers.

Arrange that one trigger is selected at random begins over players starting position.

From the players point of view the AI always start the mission with a different loadout.

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

×