De_little_Bubi 1 Posted March 6, 2013 Anybody know what i have to put as init script to make a unit own a flashlight and give the ai the ability to use it? (+ removing NV but i guess thats like in a2) Share this post Link to post Share on other sites
tonic-_- 53 Posted March 6, 2013 To remove NVG's this unassignItem "NVGoggles"; this removeItem "NVGoggles"; To add flashlight & assign it this removeItemFromPrimaryWeapon "acc_pointer_IR"; this addPrimaryWeaponItem "acc_flashlight"; Don't know if AI will use the flashlight though. Share this post Link to post Share on other sites
Sheps 0 Posted March 6, 2013 To remove NVG's this unassignItem "NVGoggles"; this removeItem "NVGoggles"; To add flashlight & assign it this removeItemFromPrimaryWeapon "acc_pointer_IR"; this addPrimaryWeaponItem "acc_flashlight"; Don't know if AI will use the flashlight though. Yeah the AI doesn't seem to want to use the flashlights unfortunately. Share this post Link to post Share on other sites
DrunkenVeteran 10 Posted March 6, 2013 Have you tried setting them to "Aware"? I remember trying to do this in ARMA 2. I believe with them set at "Aware" any units with flashlights at night will use them. Share this post Link to post Share on other sites
De_little_Bubi 1 Posted March 6, 2013 Got it! First i thought it will work out with http://community.bistudio.com/wiki/enableGunLights but nope. tried it with aware: nope. Making a waypoint with behaviour "combat" is the way to go! ( + the init scripts from you guys for getting the flashlight initially) thanks guys! Share this post Link to post Share on other sites
DrunkenVeteran 10 Posted March 6, 2013 That's what it was, "Combat" I knew one of those behaviors worked. Nice to see you got it working. Share this post Link to post Share on other sites
Orion987 1 Posted March 6, 2013 Does anyone know a way to force the flashlights on? I want to have a patrol walking around in safe mode (so they look casual) but they won't use their lights until they enter combat mode, where they obviously don't look casual. Share this post Link to post Share on other sites
everyone 10 Posted March 13, 2013 Does anyone know a way to force the flashlights on? I want to have a patrol walking around in safe mode (so they look casual) but they won't use their lights until they enter combat mode, where they obviously don't look casual. I've been trying to get this to work also, with no luck. I've toggled through just about every setting for waypoints, and the only thing that makes them use their flashlights is combat mode... which also makes them spastic. If anyone has any luck figuring this out, it would be much appreciated. Share this post Link to post Share on other sites
Mattar_Tharkari 10 Posted March 13, 2013 Had a go with the GunLightOn action but it didn't work? {_x action ["GunLightOn", (vehicle _x)]} forEach (units grpA); {_x action ["GunLightOn", _x]} forEach (units grpA); _unit action ["GunLightOn", _unit]; It works on the player only: player action ["GunLightOn", player]; 1 Share this post Link to post Share on other sites
f2k sel 164 Posted March 13, 2013 group this enableGunLights "forceon" works in all modes for me. Share this post Link to post Share on other sites
everyone 10 Posted March 13, 2013 After years of working with Arma2, I'm still pretty terrible at figuring out scripting syntax (most of it is trial and error, and very frustrating). player action ["gunlighton",player] works when put into the player unit's init box, as does this action ["GunLightOn",this]; Neither command seems to work when applied to an AI unit however. Next I tried group this enableGunLights "forceon" in the init box of a leader of a group of units... voila, it worked, but only for the group leader (the guy whose initbox I put it in). I can also just put in this enablegunlights "forceon" and that does the trick as well for each individual unit. Maybe I'm just not grouping them correctly? It has been at least a year since I last really spent time with the editor, I'm just now getting back into it with the alpha, and the new layout keeps causing minor confusion... that could be it. Regardless, I clearly need to bone up on my syntax. What does adding a _ in front of a line do? I haven't figured that out, though I realize it has something to do with local vs global variables. Share this post Link to post Share on other sites
f2k sel 164 Posted March 13, 2013 (edited) {_x enableGunLights "forceon"} foreach units group this; make sure they have lights on the gun. If you made them into a group blue=group this you could use blue enableGunLights "forceon" or {_x enableGunLights "forceon"} foreach units blue; Edited March 13, 2013 by F2k Sel Share this post Link to post Share on other sites
everyone 10 Posted March 13, 2013 Hmm, also noticing some oddities... after double-checking to make sure all four units were identically coded, I confirmed that all four were patrolling with lights on. Weirdly enough, when I move my spawn point to 300m away, only three of the four guys have their lights on. Might be something weird with the dynamic lights setting. I'll fiddle with it some more and see how it works out. So far though it appears to be (mostly) working, so thanks for the help guys. :) How would I make them into a group? From my earlier experience I remember creating groups manually by click-dragging from each unit to the group leader with the grouping tool. Do I just do that, then add blue=group this to the group leader's init? Share this post Link to post Share on other sites
f2k sel 164 Posted March 13, 2013 Yes leader init. The lights are a bit strange. If you start amongst them all the lights are on but if you start at a distance sometime only a few come on when you get close and chemlight can be seen further away than flash light. Share this post Link to post Share on other sites
everyone 10 Posted March 13, 2013 Interesting, while testing it out by spawning 300m away and then running closer to them (seeing if/when the off lights in the group would come on) the game froze and crashed, and my display driver crashed and recovered. Now the game crashes to desktop on launch... even after verifying the integrity of the game files in steam. This might take a while. Moral of the story: don't screw with those flashlights. Share this post Link to post Share on other sites
cuel 25 Posted March 13, 2013 enableGunLights takes a bool, not a string. So this enableGunLights true; is the correct syntax. Share this post Link to post Share on other sites
f2k sel 164 Posted March 13, 2013 It was but correct but if you highlight enableGunLights in the edit and press F1 it now displays new information.. Share this post Link to post Share on other sites
everyone 10 Posted March 13, 2013 Hm still can't seem to get the group thing working. I made four units, then using the Group tool, dragged a blue line from from each unit to the one designated as the group leader. In his initbox, I put: Grp1=group this; Grp1 enablegunlights "forceon"; His light is on, the three squadmates' lights are not on. {_x enableGunLights "forceon"} foreach units Grp1; also doesn't seem to work. I'm not too worried, as it works when I enable it for each individual unit, but it would be nice to streamline the process since I'm going to have a few different patrols, all with their gunlights activated. Share this post Link to post Share on other sites
f2k sel 164 Posted March 14, 2013 I copied your code in my leaders init and all lights come on. I'm using the latest beta so that may be why it works for me. Share this post Link to post Share on other sites
marker 1 Posted March 14, 2013 It was but correct but if you highlight enableGunLights in the edit and press F1 it now displays new information.. What have I missed? Share this post Link to post Share on other sites
R4IDER 10 Posted April 3, 2013 Try this, { if (side _x == east) then { _x unassignItem "NVGoggles"; _x removeItem "NVGoggles"; _x removeItemFromPrimaryWeapon "acc_pointer_IR"; _x addPrimaryWeaponItem "acc_flashlight"; _x enableGunLights "forceon"; }; } foreach allunits; put it in a trigger in the middle of the map with a size of 4200 by 4200 with activation OPFOR present Share this post Link to post Share on other sites
Ronin[NR] 1 Posted September 28, 2013 (edited) Or in the init field of the group leader, use the following: { _x unassignItem "NVGoggles"; _x removeItem "NVGoggles"; _x RemovePrimaryWeaponItem "acc_pointer_IR"; _x addPrimaryWeaponItem "acc_flashlight"; _x enableGunLights "forceon"; }foreach units group this; http://i791.photobucket.com/albums/yy193/Quelidge/flashlights.png (527 kB) Edited September 28, 2013 by Ronin =ASP= 1 Share this post Link to post Share on other sites
dakaodo 52 Posted August 28, 2015 Thanks, Ronin! I had already fumbled my way into the lines to remove and add items. I used unlinkItem as one line entry instead of two lines for unassignItem and removeItem. Unlink does both steps at once. Also, it's been 2 weeks since I looked it up and wrote it, but I believe that you can just addPrimaryWeaponItem and it'll overwrite whatever item is already mounted.The only thing I could not figure out from other threads was how to forceOn those damned flashlights. I used in my unit init fields (doesn't work): this enableGunLights "forceOn"; But using the init.sqf version with { if(side _x == west) then { <blah blah blah assign flashlights> _x enableGunLights "forceOn"; }; } foreach (allUnits); worked like a charm! I don't know if I done goofed some unit init syntax somewhere, but I'm just glad I got it to work at all w/ your suggestion. Share this post Link to post Share on other sites
loopdk 92 Posted August 28, 2015 Player addPrimaryWeaponItem "acc_flashlight"; Player enablegunlights "forceOn" will work IF the weapon has rail for flashlight! Share this post Link to post Share on other sites