Jump to content
Sign in to follow this  
Jona33

Easy British unit script

Recommended Posts

Hi

UPDATE 26/09/2014. This is now an outdated script, updated version is available here: http://forums.bistudio.com/showthread.php?183684-Jona-s-Easy-Redress-Functions

Was working on this for a mission I was making but figured I would expand it a bit and release it so that anyone else who wants to can use it.

Very simply it's a function that allows you to dress any unit in the British equipment that is currently in game (black MXs, British plate carriers and uniform). It's nothing particularly special but hey, here it is. This contains most units, not all. Some such as pilots, helicopter crew and divers are not included because there's nothing really I can change that would make a significant difference. (Note the sniper and spotter units do not have ghillie suits, there are not ghillie suits in British camouflage available.) Feel free to use it in whatever projects you like.

Key differences between US and British Kit.

All regular British forces have some kind of body armour. Tactical vests are routinely seen, especially among support infantry. (Snipers and SF units have the choice.)

The MX is painted black and all infantry have some kind of sight fitted to their weapon.

Only squad and team leaders have IR pointers.

British forces only have one kind of helmet.

The standard issue pistol is the four-five .45 rather than the P07, the increase in power is seen as necessary.

Different backpacks tend to be used (the exception being the bags for static weapons.)

DOWNLOAD LINK REMOVED, SEE TOP LINE

INSTRUCTIONS

1. Place fn_redressBrit.sqf in your missions folder somewhere (I create a folder called functions and place it in there).

2. Include the following in your description.ext

class CfgFunctions
{
class JNA
{
	class Redress
	{
		class RedressBrit {file = "Functions\fn_redressBrit.sqf";};
	};
};
};

3. Call the function in the following way: (this information is contained within fn_redressBrit.sqf as well).

[unit,Role,British voices,Random Uniform] call JNA_fnc_redressBrit;

0: Unit: the unit that will recieve the loadout

1: Role : the type of loadout it will recieve (default Rifleman)

-Valid Strings for Role

OFF=Officer

SL=Squad leader

TL=Team Leader

AR=Autorifleman

CLS=Combat Life Saver

R=Rifleman

R_AT=Rifleman (AT)

AAR=Assistant Autorifleman

AB=Ammobearer

MRKS=Marksman

PARA=Paratrooper

CREW=Vehicle Crewman

UAV=UAV operator

EXP=Explosive Specialist

MS_AT=Missile Specialist-Anti Tank (Titan)

AMS_AT=Assistant Missile Specialist-Anti Tank (Titan)

MS_AA=Missile Specialist-Anti Air (Titan)

AMS_AA=Assistant Missile Specialist-Anti Air (Titan)

REP=Repair Specialist

ENG=Engineer

R_L=Rifleman (Light)

R_UN=Rifleman (Unarmed)

SNIPER=SNIPER (No Ghillie)

SPOT=SPOTTER (No Ghillie)

REC_MRKS=Recon Marksman

REC_SC=Recon Scout

REC_JTAC=Recon JTAC

REC_AT=Recon Scout (AT)

REC_TL=Recon Team Leader

REC_DEMO=Recon Demo Specialist

REC_CLS=Recon Paramedic

ASST_HMG/GMG=Assisstant Gunner HMG/GMG

GUN_GMG=Gunner GMG

GUN_HMG=Gunner HMG

GUN_MORT=Gunner Mk6 Mortar

ASST_MORT=Assisstant Gunner Mk6 Mortar

2: British Voices: Whether or not that a British voice will be assigned to a unit, Can be "True" or "False". (Should be set to false when that character has a set identity. If set to true the voice will be random each time).

3: Random Uniform: Whether or not random uniform (from the three British ones) is used, default true, Can be "True" or "False".

Examples:

[this,"MRKS","true","true"] call JNA_fnc_redressBrit

-Will be a british marksman, will have a british voice and the uniform will be randomly chosen at the start of each mission.

[this,"OFF","false","false"] call JNA_fnc_redressBrit

-British officer, not random uniform (will always have sleeves rolled down in this case) and will not use a british voice by default.

IMPORTANT-Certain units have hardcoded properties, e.g. you can give any unit a CLS loadout but it can only use the medikit if the unit itself is a CLS.

Edited by Jona33
Wrong link

Share this post


Link to post
Share on other sites

Nice one, with a little bit of work you could get these to appear in the editor under the unit menu. It would just be a case of configing new units off of the base units you are using.

Apart from that it's nice to see a bit more variety in the loadouts with the British Camo.

Share this post


Link to post
Share on other sites
Nice one, with a little bit of work you could get these to appear in the editor under the unit menu. It would just be a case of configing new units off of the base units you are using.

Apart from that it's nice to see a bit more variety in the loadouts with the British Camo.

Of course, and I might do that but that would mean a mod would be required for any mission that uses the new units correct? However I kind of fancy learning some of that stuff so I might give it a go.

Share this post


Link to post
Share on other sites

Here's a suggestion on tightening up how you assign equipment. Edit as required

//Give Unit Essential items
{_unit linkItem _x} forEach ["ItemWatch","ItemGPS","ItemRadio","ItemCompass","ItemMap"];

//Add NVGoggles if it's night time.
_GiveGoggles = sunOrMoon;
_items = assigneditems _unit;
if !("NVGoggles" in _items && _GiveGoggles < 1) then {_unit assignitem "NVGoggles";_unit linkitem "NVGoggles";};

//Give Unit primary weapons and magazines based on Side
_unit addMagazine "3Rnd_HE_Grenade_shell";
[_unit,"arifle_MX_GL_Black_Hamr_pointer_F",1,"30Rnd_65x39_caseless_mag_Tracer"] call BIS_fnc_addWeapon;

//Give Unit primary weapon attachments based on side and weapon capability
_unit addprimaryweaponitem "acc_flashlight";

//Give Unit secondary weapons and magazines based on weapon capability
[_unit, "hgun_Pistol_heavy_01_MRD_F",1] call BIS_fnc_addWeapon;

//Give unit ammo and extras and place in Uniform Vest and Backpack
{_unit addItemToUniform "FirstAidKit"} foreach [1,2,3];
_unit addItemToUniform "HandGrenade";
_unit addItemToUniform "SmokeShell";
_unit addItemToUniform "Chemlight_blue";

{_unit addItemToVest "30Rnd_65x39_caseless_mag_Tracer"} foreach [1,2,3,4,5,6,7,8,9,10];

_unit addItemToBackpack "FirstAidKit";
{_unit addItemToBackpack "30Rnd_65x39_caseless_mag_Tracer"} foreach [1,2];
{_unit addItemToBackpack "3Rnd_HE_Grenade_shell"} foreach [1,2,3,4,5,6];
{_unit addItemToBackpack "HandGrenade"} foreach [1,2,3,4];
{_unit addItemToBackpack "11Rnd_45ACP_Mag"} foreach [1,2];

//Give Unit Specialist Equipment
_unit addweapon "Binocular";

Share this post


Link to post
Share on other sites
Here's a suggestion on tightening up how you assign equipment. Edit as required

Nice, I might just do that.

EDIT: Is there and advantage to using

{_unit addItemToVest "30Rnd_65x39_caseless_mag"} foreach [1,2,3,4,5,6,7,8,9,10];

compared to

for "_i" from 1 to 10 do {_unit addItemToVest "30Rnd_65x39_caseless_mag";};

Edited by Jona33

Share this post


Link to post
Share on other sites

Mmm... Interesting question. The answer should be, whichever one takes the least amount of time.

So to test this, I added the following to my loadout script.

_begin = diag_tickTime;
{_unit addItemToVest "30Rnd_65x39_caseless_mag_Tracer"} foreach [1,2,3,4,5,6,7,8,9,10,11,12];
_end = diag_tickTime;
hintSilent format ["Time in Seconds %1",_begin - _end];

and compared it with

_begin = diag_tickTime;
for "_i" from 1 to 12 do {_unit addItemToVest "30Rnd_65x39_caseless_mag_Tracer";}; 
_end = diag_tickTime;
hintSilent format ["Time in Seconds %1",_begin - _end];

And the answer was....

to NINE decimal places...

in seconds.... (on my PC)....

EXACTLY THE SAME!!

0.000976563 seconds.

---------- Post added at 09:55 PM ---------- Previous post was at 09:54 PM ----------

I should add my mission is loading another 20 units with their loadout scripts, and the timer was only running on 1 unit.

Share this post


Link to post
Share on other sites

Thanks very much, in that case I think I'll stick to the second option, just seems easier to me.

EDIT:

		//Removal
		removeAllItems _unit;
		removeAllAssignedItems _unit;	
		removeVest _unit;
		removeUniform _unit;
		removeHeadgear _unit;
		removeBackpack _unit;
		removeAllWeapons _unit;

		//Clothing
		_defaultUniform="U_B_CTRG_1";
		if (_RandUniform=="True") then {
		JNA_Uniform=_Uniforms call Bis_fnc_selectRandom;
		}
		else
		{JNA_Uniform=_defaultUniform};		
		_unit forceAddUniform JNA_Uniform;
		_unit addVest "V_TacVest_oli";
		_unit addHeadgear "H_MilCap_gry";

		//Weapons
		[_unit,"arifle_MXC_Black_F",1] call Bis_fnc_AddWeapon;
		[_unit,"hgun_Pistol_heavy_01_F",1] call Bis_fnc_AddWeapon;
		_unit addPrimaryWeaponItem "optic_Aco";

		//Magazines
		_unit addItemToUniform "FirstAidKit";
		for "_i" from 1 to 2 do {_unit addItemToUniform "30Rnd_65x39_caseless_mag";};
		_unit addItemToVest "30Rnd_65x39_caseless_mag";
		for "_i" from 1 to 2 do {_unit addItemToVest "11Rnd_45ACP_Mag";};
		_unit addItemToVest "SmokeShell",1;
		_unit addItemToVest "SmokeShellGreen",1;
		for "_i" from 1 to 2 do {_unit addItemToVest "Chemlight_green";};

		//Items
		{_unit linkItem _x} forEach ["ItemWatch","ItemRadio","ItemCompass","ItemMap"];

Does that seem like a reasonable way of setting it out?

Edited by Jona33

Share this post


Link to post
Share on other sites

Looking good...

Note in the Bis_fnc_AddWeapon the qty 1 refers to the number of ammo to add. i.e.

[_unit,"arifle_MXC_Black_F",1] call Bis_fnc_AddWeapon;

the "1" means 1 item of default ammo.

You could have

[_unit,"arifle_MXC_Black_F",5] call Bis_fnc_AddWeapon;

which would add 5 ammo to the unit, (the first being loaded into the weapon and not actually taking up an inventory slot).

Or you can actually specify the ammo type to use e.g. this example which will load 5 tracer mags.

[_unit,"arifle_MXC_Black_F",5,"30Rnd_65x39_caseless_mag_Tracer"] call BIS_fnc_addWeapon;

On another note, to remove ALL items from a unit I use this...

//remove ALL Units equipment etc
removeAllWeapons _unit;
removeAllAssignedItems _unit;
removeAllContainers _unit;
removeHeadgear _unit;
removeGoggles _unit;

Edited by Beerkan

Share this post


Link to post
Share on other sites
Looking good...

Note in the Bis_fnc_AddWeapon the qty 1 refers to the number of ammo to add. i.e.

[_unit,"arifle_MXC_Black_F",1] call Bis_fnc_AddWeapon;

the "1" means 1 item of default ammo.

You could have

[_unit,"arifle_MXC_Black_F",5] call Bis_fnc_AddWeapon;

which would add 5 ammo to the unit, (the first being loaded into the weapon and not actually taking up an inventory slot).

Or you can actually specify the ammo type to use e.g. this example which will load 5 tracer mags.

[_unit,"arifle_MXC_Black_F",5,"30Rnd_65x39_caseless_mag_Tracer"] call BIS_fnc_addWeapon;

Yep, figured as much but I thought that it would be clearer (for me at least) to split what is actually being loaded into the inventory (rather than the weapon).

On another note, to remove ALL items from a unit I use this...

//remove ALL Units equipment etc
removeAllWeapons _unit;
removeAllAssignedItems _unit;
removeAllContainers _unit;
removeHeadgear _unit;
removeGoggles _unit;

Thanks, I'll use that.

Share this post


Link to post
Share on other sites

Ok, the new version is uploaded and the link in the first post has been updated, it's basically just a rework of how everything is added, it's now consistent and much clearer. Used exactly the same way as before.

Massive thanks to Beerkan for showing me a better way of organising it.

Share this post


Link to post
Share on other sites

14/08/2014

https://www.mediafire.com/?jlac8f11ucdbuvb

Alternative version is now available, this is effectively a quick way of doing it, instead of you deciding what loadout you want it simply detects what unit you have placed and modifies the appropriate loadout. So if I place a marksman and call it the marksman loadout is automatically given. This means that it works well with Bis_fnc_spawnGroup and it works with vehicles and boats.

Parameters
0: Unit (OBJECT): the unit that will recieve the loadout				
1: British Voices (STRING)-OPTIONAL: Whether or not that a British voice will be assigned  to a unit, Can be "True" or "False". (Should be set to false when that character has a set identity. If set to true the voice will be random each time). Default: True.
2: RandomUniform (STRING)-OPTIONAL: Whether or not random uniform is used, default true, Can be "True" or "False". 

Examples:
[this,"true","true"] call JNA_fnc_redressBritAlt
-Will give unit British clothes, a random British uniform and a British voice.

_grp1=[getMarkerPos "ARandomMarker", WEST , (configFile >> "CfgGroups" >> "WEST" >> "BLU_F" >> "Infantry" >> "BUS_InfSquad")] call BIS_fnc_spawnGroup;
{[_x] call JNA_fnc_RedressBritAlt} forEach units _grp1;
-Will spawn a standard US Infantry squad, then make the units British, note that the optional parameters are not given so they will default to true.

_grpTank=[getMarkerPos "ARandomMarker", WEST , (configFile >> "CfgGroups" >> "WEST" >> "BLU_F" >> "Armor" >> "BUS_TankPlatoon_AA")] call BIS_fnc_spawnGroup;
{[_x] call JNA_fnc_RedressBritAlt} forEach units _grpTank;
-Will spawn a a combined tank platoon (two AA vehicles and two tanks) then make the crew members British, note that the optional parameters are not given so they will default to true.

Place the following in your description.ext

class CfgFunctions
{
class JNA
{
	class Redress
	{
		class RedressBritAlt {file = "Functions\fn_redressBritAlternative.sqf";};
	};
};
};

Edited by Jona33

Share this post


Link to post
Share on other sites

(typo in the example above for a single unit)

Works great! Even easier to use now with autodetect

Share this post


Link to post
Share on other sites
(typo in the example above for a single unit)

Works great! Even easier to use now with autodetect

Thanks very much, I'll correct that.

EDIT: Updated version on mediafire, changes basically nothing part from the aforementioned typo and marked the variables as private (best practice apparently).

Edited by Jona33

Share this post


Link to post
Share on other sites

I really like this script, it effectively adds a whole faction without a single addon.

I notice in this thread:

http://forums.bistudio.com/showthread.php?150633-How-to-make-civilians-as-enemies-and-equip-them-with-weapons-some-of-the-gear

that you have redressing scripts for FIA and "MFA".

How would I go about using multiple redressing scripts in the one mission?

ie How do I edit the description.ext?

I'd like to add other redressing scripts when I get a chance:

Cops & Robbers - Pistols, SMGs and light vests only...

Islamic State - Shemags, Katibas & CSAT voices...

Mercenaries - Wide variety of equipment, American, British and Greek voices mixed...

Share this post


Link to post
Share on other sites
I really like this script, it effectively adds a whole faction without a single addon.

I notice in this thread:

http://forums.bistudio.com/showthread.php?150633-How-to-make-civilians-as-enemies-and-equip-them-with-weapons-some-of-the-gear

that you have redressing scripts for FIA and "MFA".

How would I go about using multiple redressing scripts in the one mission?

ie How do I edit the description.ext?

I'd like to add other redressing scripts when I get a chance:

Cops & Robbers - Pistols, SMGs and light vests only...

Islamic State - Shemags, Katibas & CSAT voices...

Mercenaries - Wide variety of equipment, American, British and Greek voices mixed...

class CfgFunctions
{
   class JNA
   {
       class Redress
       {
           class redressFIA {file = "Functions\fn_redressFIA.sqf";};
           class redressBrit {file = "Functions\fn_redressBrit.sqf";};
           class redressMFA {file = "Functions\fn_redressMFA.sqf";};
       };
   };
};  

And you can continue to add functions in that vein as much as you like, if they're written by somebody else then you can make it look like this.

class CfgFunctions
{
   class JNA
   {
       class Redress
       {
           class redressFIA {file = "Functions\fn_redressFIA.sqf";};
           class redressBrit {file = "Functions\fn_redressBrit.sqf";};
           class redressMFA {file = "Functions\fn_redressMFA.sqf";};
       };
   };
  class SomebodyElsesTag
   {
       class Whatever
       {
           class randomFunction {file = "Functions\fn_random.sqf";};
       };
   };
};  

A general note, there's an updated version of this soon to be released, I've just got to update about ten more units, it doesn't really change anything for the user (some of the default uniforms might change) but it basically makes it simpler. Along with it I've got the FIA, MFA, CSAT Special Forces Division (basically CSAT Special Forces posing as guerillas) and a small police department one with a light cop, a heavy cop, an officer and a SWAT Cop. More usefully I've written a script that will allow you to create your own redress function by automatically exporting the loadout from the game. If I get round to it I'll release it later tonight.

Share this post


Link to post
Share on other sites

hi jona33 any chance you could show me how to merge this

class CfgFunctions
       {
       #include "scripts\VAS\cfgfunctions.hpp"
    #include "taw_vd\CfgFunctions.hpp"
       };

with your code cant seem to figure it out fed up of my arma crashing looking forward to the update thanks

Share this post


Link to post
Share on other sites
hi jona33 any chance you could show me how to merge this:

with your code cant seem to figure it out fed up of my arma crashing looking forward to the update thanks

Should be easy as this:

class CfgFunctions
{
   #include "scripts\VAS\cfgfunctions.hpp" 
   #include "taw_vd\CfgFunctions.hpp" 

   class JNA
   {
       class Redress
       {
           class redressFIA {file = "Functions\fn_redressFIA.sqf";};
           class redressBrit {file = "Functions\fn_redressBrit.sqf";};
           class redressMFA {file = "Functions\fn_redressMFA.sqf";};
       };
   };
};  

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
Sign in to follow this  

×