Jump to content
777eza

Checking CfgRespawnInventory Classes

Recommended Posts

Hello, so what I want to do is make a script that rearms infantry. I have a endless defense mission and respawn loadouts, however I want an addiction on a box to call a script that resupply them with ammo and items. Now what I have now is multiple addActions for each loadout but I don't like that I want a single addActions. so I made a script that checks there weapon and gives them the ammo based on there weapon. Problem is I can't really give say the explosive specialist claymores unless the explosive specialist has a different gun then the rest of them. So I was wondering if there is a way to check the player loadout class from the respawnInventory template? ( so if player loadout class == "AT" then {code})

 

I took a look at the scripting commands but the best I could find is isClass but I couldn't get it to work.

Share this post


Link to post
Share on other sites

There are multiple ways to do this. Here are a few... The easiest way in my opinion is this:

Use typeOf command to check if they are X class or not.

if ((typeOf player in ["B_soldier_exp_F", "B_recon_exp_F"])) then
{
	hintSilent "True!";
};

The downside to this method is that, classes will need to have a different classname. Another method would be:

https://community.bistudio.com/wiki/setUnitTrait

https://community.bistudio.com/wiki/getUnitTrait

You could also check to see if the player has say a mine detector item in their loadout but again, if another class carries one as well then yeah...

You could find something in the config viewer that only X class will have. Something unique.

I quickly checked under the "B_soldier_exp_F" class and found this:

(probably not the best thing to check against)

icon = "iconManExplosive";
if ((getText (configFile >> "CfgVehicles" >> (typeOf player) >> "icon") isEqualTo "iconManExplosive")) then
{
	hintSilent "I am a REAL EXPLOSIVES SPECIALIST!";
};

 

Share this post


Link to post
Share on other sites

 

Share this post


Link to post
Share on other sites
On 8/27/2017 at 8:04 PM, HazJ said:

There are multiple ways to do this. Here are a few... The easiest way in my opinion is this:

Use typeOf command to check if they are X class or not...

 

 

thanks for the info tho there all the same class

 

On 8/29/2017 at 1:44 AM, Larrow said:

 

i should of know you'd have an answer Larrow, your very helpful thank you!

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

×