Jump to content
Sign in to follow this  
InfantryChild

Run Script for Class Name ONLY (?)

Recommended Posts

I've been struggling with this for hours.

This is part of a spawning script, and the code is by default being passed to all units being spawned. I want to limit it to a certain class, and have other loadouts for other classes. This is all within the EOS script.

I want a specific unit class to be given this script, but not others, within my loadout script.

 //I NEED SOMETHING HERE TO LIMIT THIS TO A SPECIFIC UNIT CLASS

	_unit addHeadgear _RandomHeadgear;
	_unit addWeapon _RandomWeapon;
	_unit addGoggles _RandomGoggles;
	_unit addVest _RandomVest;
	_unit forceaddUniform _RandomUniform;

	//Add Magazines
	_unit addMagazines ["30Rnd_9x21_Mag", 6];

					} forEach (units _grp); 

Share this post


Link to post
Share on other sites

what class? here is a snippet from one of my scripts maybe it will help a bit:

{
_Ucheck = _x;
_type = typeOf _Ucheck; 
_displayname = getText(configfile >> "CfgVehicles" >> _type >> "displayName");
if (_displayname == "Ammo Bearer") then { what ever you want};

} forEach (units _grp);

Share this post


Link to post
Share on other sites

Encapsalte the entire thing with an if statement:

if (typeOf _unit isEqualTo "Classname") then
{
//stuff
};

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  

×