Jump to content
Sign in to follow this  
Undeceived

How to remove a CERTAIN headgear from the random civilian headgear

Recommended Posts

Hello guys,

I'm trying to remove a certain cap from the civilians at mission start. This cap is reserved for a special occasion in the campaign I'm creating, this is why no one must wear it. :p

And there are dozens of civilians in my missions - this is why I simply can't edit everyone of them.

To do this I want to check at the mission's start if someone is wearing this cap: H_Cap_blk_CMMG

It seems I'm still a noob when it comes to conditions or code which goes further than unit1 dofire unit2; or something like that... Can you please help me with that?

I want something like this in my init.sqf:

{check if someone is wearing "H_Cap_blk_CMMG"} for all civilian units;

removeHeadGear from these units;

:) This may sound a bit stupid, but I really have no idea how to "convert" it into sqf...

Can anyone help me? Thanks a lot!! :)

Share this post


Link to post
Share on other sites

Here you go:

{
if (side _x == civilian) then {
	if (headgear _x == "H_Cap_blk_CMMG") then {
		removeHeadgear _x;
	};
};
} forEach allUnits;

Edited by Tajin
missing "then"

Share this post


Link to post
Share on other sites
Here you go:

Wow, it looks so simple! :D Thanks a lot, Tajin, it works perfectly! Much appreciated! :)

There was a "then" missing - I added it:

{
if (side _x == civilian) then {
	if (headgear _x == "H_Cap_blk_CMMG") then {
		removeHeadgear _x;
	};
};
} forEach allUnits;

Share this post


Link to post
Share on other sites

oh, right.

I make that mistake sometimes.... too much js. ;)

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  

×