Jump to content
Sign in to follow this  
tinter

Remove NVGs and give flashlight to certain units only

Recommended Posts

I was wondering if it was possible to make it so that only squad leaders and certain other units have NVGs, and all others get flashlights for their gun. I'm spawning enemies by script, they're AI, so it would need to be a script that checks in every few seconds or so, I'd presume.

Share this post


Link to post
Share on other sites

If you search or browse these forums you'll find a recent thread about removing NVGs. Simply add a class check to that and adjust what you add/remove.

Share this post


Link to post
Share on other sites

will something like this work? i'm not sure

AddGear = True;
while {true} do {

//<------------- spawn your dudes here

removeallweapons _x;
removeallassigneditems _x;
removeallcontainers _x;
_x addUniform "U_B_CombatUniform_mcam_tshirt";
_x addbackpack "B_Kitbag_Base"; 
_x addvest "V_PlateCarrierIA1_dgtl"; 
_x addheadgear "H_Watchcap_blk"; 
_x addmagazines ["30Rnd_556x45_Stanag", 8];   
_x addmagazines ["UGL_FlareCIR_F",3];
_x addweapon "arifle_Mk20_GL_F"; 
_x addMagazines ["HandGrenade", 2]; 
_x addweapon "ItemCompass";
_x addweapon "ItemGPS";
_x addweapon "ItemMap";
_x addweapon "ItemRadio";
_x addweapon "ItemWatch";
_x addItem "FirstAidKit";
_x addPrimaryWeaponItem "optic_ACO_grn"; 
_x addPrimaryWeaponItem "acc_pointer_IR"; 
_x addMagazines ["9Rnd_45ACP_Mag", 4]; 
_x addweapon "hgun_ACPC2_F";
_x addweapon "Binocular";
_x assignItem "Binocular";
_x addItem "NVGoggles";
_x assignItem "NVGoggles";

AddGear = False; //gear added is done exit loop
};

ofcourse add your correct weapons to it etc

Share this post


Link to post
Share on other sites

I know how to remove NVG and add flashlights. And I guess I could just loop the script so it would work for all newly spawned enemies, but I haven't heard about how to do a class check? I'm having a bit of trouble finding anything related to it.

---------- Post added at 22:33 ---------- Previous post was at 22:30 ----------

I was thinking more something that goes like this:

Warning, pseudo code.

checking = false
check classname of each spawned opfor unit
if a leader or some other thing then do nothing
else then remove nvgs and add flashlights to gun and make them use it
wait 10 seconds or whatever.
checking=true to loop

Share this post


Link to post
Share on other sites

If you're spawning enemies, just equip them how you want when you spawn them. No need to constantly be cycling through. :)

Commands you'll wanna look into are leader and typeOf possibly.

{
   if((side _x == opfor) && ((leader group _x) != _x)) then { // if you're a baddie and not your own group leader
       _x unassignItem "NVGoggles";
       _x removeItem "NVGoggles";
       // add flashlight or whatever
   };
} foreach (allUnits);  

Share this post


Link to post
Share on other sites

I'm spawning them using the EOS script. It's not my script so I'm not sure how I'd go about editing them like that.

---------- Post added at 23:38 ---------- Previous post was at 23:36 ----------

Anyway, thanks for the help. I'm sure I'll be able to work something out now. I appreciate it.

Share this post


Link to post
Share on other sites
If you're spawning enemies, just equip them how you want when you spawn them. No need to constantly be cycling through. :)

Commands you'll wanna look into are leader and typeOf possibly.

{
   if((side _x == opfor) && ((leader group _x) != _x)) then { // if you're a baddie and not your own group leader
       _x unassignItem "NVGoggles";
       _x removeItem "NVGoggles";
       // add flashlight or whatever
   };
} foreach (allUnits);  

Your code is giving me an error about _x being an undefined variable. It's stopping the script from working.

Share this post


Link to post
Share on other sites

You must have typed something wrong or be running some other script or have a conflict. That code as written works in the debug console, a trigger, run from a script from a trigger, from init.sqf and from a unit's init field and worked every time and didn't give any errors.

Share this post


Link to post
Share on other sites

Alright, I'll try to mess with it a bit.

Share this post


Link to post
Share on other sites

It's east, not opfor. Are you sure it's not opfor that's undefined, rather than _x? Try copy-pasting the error message next time.

Also, to add flashlight, use:

_x addPrimaryWeaponItem "acc_flashlight";

Share this post


Link to post
Share on other sites

I actually managed to fix it, but it was right before I went to work so I didn't get to post it here. It was indeed a problem on my side, but no big issue.

Here's the code I used.

_loop=true;
while {_loop} do {
{
   if((side _x == opfor) && ((leader group _x) != _x)) then { // if you're a baddie and not your own group leader
       _x unassignItem "NVGoggles";
       _x removeItem "NVGoggles";
       _x removePrimaryWeaponItem "acc_pointer_ir";
	_x addPrimaryWeaponItem "acc_flashlight";
	_x enableGunLights "ForceOn";
   };
} foreach (allUnits);
sleep 30;
};

Share this post


Link to post
Share on other sites

In ArmA 3 opfor and blufor work for east and west as a Side. Embrace the future! Heh

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  

×