Jump to content
Sign in to follow this  
Cerebus06

Absolutely cannot remove NVGoggles from Player Group

Recommended Posts

I've been fighting this for the last couple of hours - I've combed through the forums here and at ArmaHolic with no success.

 

I'm trying to remove the Night Vision Goggles from all members of the Players group (a 5 man team of SF soldiers).  This is such a simple thing that I'm stumped why it's become so problematic.  Initially, I added the following - which is the standard method - to each soldier's INIT field:

 

this unassignItem "NVGoggles";
this removeItem "NVGoggles";

and this didn't work.  Rather surprised, I tried another take on it:

 

this unassignItem "NVGoggles";
removeItem "NVGoggles";

and this didn't work either.  So I decided (since I have several changes I want to make to the loadout of each soldier) to create an SQF file and try that.  I created a LOADOUT.SQF file, and entered the following into it:

 

// Set Variables
_soldier = _this select 0;

// Remove Headgear and NVGs
removeHeadgear _soldier;
_soldier unassignItem "NVGoggles";
_soldier removeItem "NVGoggles";

// Add Booniehat and Magazines
_soldier addHeadgear "H_Booniehat_tna_F";
(vestContainer _soldier) addMagazineCargoGlobal ["30Rnd_65x39_caseless_mag",2];

putting this into the INIT field of each soldier.  This STILL didn't work.  The Booniehats and the added rifle magazines are added, but the NVG's are still there.  At this point, I don't know what's going on.  I gave some thought to the possibility that my addons could be causing the problem, so I reloaded the game with no addons, and am still getting the same results.

 

It's things like this that make me wish that it was possible to simply edit the loadout of individual soldiers within the Editor itself.

 

Am I doing something wrong?  Have I encountered some kind of weird bug?

Share this post


Link to post
Share on other sites

Are you sure if the classname of the goggles ? IIRC there are several types according to the side.

  • Like 1

Share this post


Link to post
Share on other sites

Oooh man.  *facepalm*

 

I never even thought of that.  I became so convinced it was a scripting problem or something similar I never considered the possibility that I was making a call to the wrong NVG classname.  So, naturally, when I changed my SQF to

_soldier unassignItem "NVGoggles_tna_F";
_soldier removeItem "NVGoggles_tna_F";

it worked perfectly.

 

Thanks for that suggestion ProfTournesol.  Definitely a lesson learned there.

  • Like 2

Share this post


Link to post
Share on other sites

You can optimize the unassigning and removal of an assigned item by using the unlinkItem command.  For example:
_soldier unlinkItem "NVGoggles_tna_F";

Will unassign and remove the item.  linkItem will add/assign the item.

Share this post


Link to post
Share on other sites

Thanks to you both for the info there.  I wasn't aware of the HMD command, and "unLinkItem" makes things a lot easier.  Thanks!

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  

×