knifeprty 1 Posted March 10, 2013 How would I go about removing gear from opfor such as nvgs? Its there a way to edit the missions .sqm so all of opfor has the same gear loadout? Or must I do this individually on each unit? If so what is the script llne for that? Share this post Link to post Share on other sites
GRS 10 Posted March 10, 2013 (edited) RemoveAllItems this ; removeUniform this; this addUniform "name"; Removevest this; this addvest "name"; removeHeadgear this; this addHeadgear "name"; removeAllWeapons this; to add weapons, add the magazines first, then weapon: this addmagazine "name"; this addweapon "name"; To remove NVG: this unassignItem "NVGoggles"; this removeItem "NVGoggles"; To add goggles/glasses: this addGoggles "name"; You can also use: this additem "name"; to add items like medkits. and: this addPrimaryWeaponItem "name"; to add stuff to guns. (command is different for primary/secondary, obviously). Classname info: http://www.armaholic.com/forums.php?m=posts&q=20801 Write the loadouts you want in scripts and execute them from the init line of each unit you want to have said loadout. Here is the template I always used to make custom weapon setups in OFP/ARMA/ArmA2. To the best of my knowledge, it should still work, but someone else will need to confirm: _unit = _this Select 0; RemoveAllWeapons _unit; _unit AddMagazine "name"; // repeat for as many mags as needed _unit AddWeapon "name"; _unit SelectWeapon "name(same as above)"; //_unit AddMagazine "name"; //if you want launchers or pistols, do the same as above but minus the selectWeapon //_unit AddWeapon "name"; // ^^^ //Add gear, goggles, items, weapon attachments, etc here. Exit; Save it as a script and execute it in the init line of the desired unit. Edited March 10, 2013 by GRS Share this post Link to post Share on other sites
nicolasroger 11 Posted March 10, 2013 use the command "removeAllAssignedItems unitName" (see this: http://community.bistudio.com/wiki/removeAllAssignedItems ) in the Init field of the units. If you only want to remove a single item, use "removeItem" ( http://community.bistudio.com/wiki/removeItem ). You will need to find the classname of the object you want to remove. You might need to unassigne it before removing it. I didn't test it so I don't know. Unassigning it might be enough to prevent them from using it too. You will have to do some tests. EDIT: looks like someone was quicker than me! Share this post Link to post Share on other sites
knifeprty 1 Posted March 10, 2013 Thanks to both of you! I will be having a lot of fun now. Share this post Link to post Share on other sites
GRS 10 Posted March 10, 2013 Any time. Also, not sure since I've never tried but you could try using a large trigger to execute the script for each unit inside it. Probably something like condition: opfor present on act: {nul = [_x] execVM "scriptname.sqf"} foreach thislist; I do not know if that is how it would be done, but that's the basic idea, for ArmA2 anyways. I'm still making the switch editor wise. So far it has been very smooth. I personally prefer to just add the exec to each unit's init to allow various loadouts. Share this post Link to post Share on other sites
knifeprty 1 Posted March 10, 2013 Never thought of that GRS. Will give it a go. Sounds logical Share this post Link to post Share on other sites
2nd ranger 282 Posted March 10, 2013 To remove NVGs from every OPFOR unit: { if (side _x == east) then { _x unassignItem "NVGoggles"; _x removeItem "NVGoggles"; }; } foreach allunits; Share this post Link to post Share on other sites
BirdFilm 1 Posted March 15, 2013 (edited) @2nd Ranger: Excuse the simple question, from where would you run that bit of code to ensure all opfor gear was changed? Thanks, Dom. [Edit: never mind, I tried running it in a unit's init and it worked fine, thanks for code] Edited March 15, 2013 by BirdFilm Share this post Link to post Share on other sites
shoomfie 10 Posted September 19, 2013 was there something that changed at release in regards to removing NVGs? I can't seem to get them to remove. this's exactly what I'm using in the AI's Init file (per unit as I want some with NVG's): this unassignitem "NVGoggles"; this removeweapon "NVGoggles"; Share this post Link to post Share on other sites
kylania 568 Posted September 19, 2013 Opfor NVGs are called "NVGoggles_OPFOR" now. Share this post Link to post Share on other sites
Tyl3r99 41 Posted October 18, 2014 is there a similar script to make them all have flashlights? instead of manually inserting into every unit kinda thing? Share this post Link to post Share on other sites
Schatten 290 Posted October 18, 2014 _unit addPrimaryWeaponItem "acc_flashlight"; Share this post Link to post Share on other sites
jshock 513 Posted October 18, 2014 (edited) _unit addPrimaryWeaponItem "acc_flashlight"; More in-depth and ensuring the weapon doesn't have a IR Laser on it: //If using editor placed units, place the following in your init.sqf if (side _x = EAST) then { { _x removePrimaryWeaponItem "acc_pointer_IR"; _x addPrimaryWeaponItem "acc_flashlight"; _x enableGunLights "forceon";//<<Turns on the light as well. } foreach allUnits; }; Edited October 18, 2014 by JShock Share this post Link to post Share on other sites
iceman77 18 Posted October 18, 2014 Fixed* ;) { if (side _x = EAST) then { _x removePrimaryWeaponItem "acc_pointer_IR"; _x addPrimaryWeaponItem "acc_flashlight"; _x enableGunLights "forceon";//<<Turns on the light as well. }; } foreach allUnits; Share this post Link to post Share on other sites
jshock 513 Posted October 18, 2014 Fixed* ;) { if (side _x = EAST) then { _x removePrimaryWeaponItem "acc_pointer_IR"; _x addPrimaryWeaponItem "acc_flashlight"; _x enableGunLights "forceon";//<<Turns on the light as well. }; } foreach allUnits; Hehe, lol, yea...brain feels a bit off today :p. Share this post Link to post Share on other sites
Beerkan 71 Posted October 19, 2014 (edited) This old bear again.. Adding-flashlight-to-enemy If you see this question asked again.. link to it. Edited October 19, 2014 by Beerkan Share this post Link to post Share on other sites
Jona33 51 Posted October 19, 2014 { if (side _x == EAST) then { _x removePrimaryWeaponItem "acc_pointer_IR"; _x addPrimaryWeaponItem "acc_flashlight"; _x enableGunLights "forceon";//<<Turns on the light as well. }; } foreach allUnits; Extra fix? (Double equals) Share this post Link to post Share on other sites
jshock 513 Posted October 19, 2014 Yes that would make even more sense now wouldn't it, at this point it would probably just be better to go with Beerkan's plan....lol :p Share this post Link to post Share on other sites
iceman77 18 Posted October 19, 2014 { if (side _x == EAST) then { _x removePrimaryWeaponItem "acc_pointer_IR"; _x addPrimaryWeaponItem "acc_flashlight"; _x enableGunLights "forceon";//<<Turns on the light as well. }; } foreach allUnits; Extra fix? (Double equals) Good catch. Hadn't spotted that. Share this post Link to post Share on other sites
becario 1 Posted February 7, 2015 Is there any way to do this same thing, but with units placed by a script? I use a script to create small groups, and I'd want to use it in a night infiltration style mission, and this code only works with editor-placed units. I also have my BluFor without nvgs, and I don't want them stealing NVGs from dead enemies. apart, of course, of using nvg would be a huge advantage to IAs. This is the script I use to spawn units: if (!isServer) exitWith {}; waituntil {!isnil "bis_fnc_init"}; //create AI Group 1 AM1 = createGroup east; sleep 0.5; "O_soldier_TL_F" createUnit [getMarkerPos "AM1", AM1,"AM1_1 = this", 0.6, "sergeant"]; sleep 0.2; "O_soldier_AR_F" createUnit [getMarkerPos "AM1", AM1,"AM1_2= this", 0.5, "corporal"]; sleep 0.2; "O_soldier_GL_F" createUnit [getMarkerPos "AM1", AM1,"AM1_3 = this", 0.5, "corporal"]; sleep 0.2; "O_soldier_F" createUnit [getMarkerPos "AM1", AM1,"AM1_4 = this", 0.5, ""]; sleep 0.2; "O_soldier_F" createUnit [getMarkerPos "AM1", AM1,"AM1_5 = this", 0.5, ""]; sleep 0.2; [AM1, getMarkerPos "MARKER", 600 ] call bis_fnc_taskAttack; [AM1, 1] setWaypointSpeed "FULL"; [AM1, 1] setWaypointCombatMode "RED"; [AM1, 1] setWaypointBehaviour "AWARE"; sleep 0.2; Share this post Link to post Share on other sites
jshock 513 Posted February 7, 2015 Change the "forEach allUnits" to "forEach units group AM1" Share this post Link to post Share on other sites
becario 1 Posted February 12, 2015 Change the "forEach allUnits" to "forEach units group AM1" tried this and didn't work. bear in mind they don't spawn until a trigger is executed. that is my problem, that those units are not present at the beginning of the mission Share this post Link to post Share on other sites
jshock 513 Posted February 12, 2015 Then put this in the code that creates those units, or execute an sqf file with this in it after those units have been created. Share this post Link to post Share on other sites
becario 1 Posted February 14, 2015 I thought I had replied. I came up with that same idea (executing a new sqf with some delay) the next morning (I hadn't checked the forums). I forgot to came here to tell my solution: sleep 7; { if (side _x == east) then { _x unassignItem "NVGoggles_OPFOR"; _x removeItem "NVGoggles_OPFOR"; _x removePrimaryWeaponItem "acc_pointer_IR"; _x addPrimaryWeaponItem "acc_flashlight"; _x enableGunLights "forceon"; } } ForEach allUnits; Share this post Link to post Share on other sites