Norbak 10 Posted February 8, 2015 Anyone know how to turn the vehicles and everything (Air,Car,...) lights Off around 2000 meters (for example) using a script? Thank you guys. Share this post Link to post Share on other sites
Schatten 268 Posted February 8, 2015 I think that's impossible because there isn't such scripting command. Share this post Link to post Share on other sites
Norbak 10 Posted February 8, 2015 VehicleLights = nearestObjects [player, ["Car","Tank","Air"], 1000];player action ["lightOff", VehicleLights]; is this possible?. I didn't test yet. Share this post Link to post Share on other sites
Schatten 268 Posted February 8, 2015 Not sure. If player isn't in vehicle he can't turn light off. Share this post Link to post Share on other sites
Norbak 10 Posted February 8, 2015 Yeah, not working. Even {_x setdamage XX;} isn't working on vehicle lights. Share this post Link to post Share on other sites
Schatten 268 Posted February 9, 2015 Try to use this code: _nearestVehicles = nearestObjects [player, ["Car", "Tank", "Air"], 1000]; { _vehicle = _x; if (({alive _x} count (crew _vehicle)) == 0) then { _unitGroup = createGroup civilian; _unit = "TK_CIV_Takistani01_EP1" createUnit [getPos _vehicle, _unitGroup]; _unit moveInDriver _vehicle; _unit action ["lightOff", _vehicle]; deleteVehicle _unit; deleteGroup _unitGroup; }; } forEach _nearestVehicles; Share this post Link to post Share on other sites
Norbak 10 Posted February 9, 2015 Not working. Spawning civilians outside the vehicles. Btw, that method could cause more lag than we would like to have. Thank you, Schatten. You're great. Share this post Link to post Share on other sites
Schatten 268 Posted February 9, 2015 Not working. Spawning civilians outside the vehicles. Replace string with createUnit to _unit = _unitGroup createUnit ["TK_CIV_Takistani01_EP1", getPos _vehicle, [], 0, "NONE"]; Btw, that method could cause more lag than we would like to have. Decrease radius, reduce list of vehicles. Share this post Link to post Share on other sites
Norbak 10 Posted February 9, 2015 (edited) Civilians respawn inside vehicles , turn lights off but don't get out or delete. Strange. I tried: _v = vehicle _unit; _unit action ["eject",_v]; deleteVehicle _unit; .But nothing happens. Edited February 9, 2015 by kyopower Share this post Link to post Share on other sites
samatra 85 Posted February 9, 2015 There is no scripting command to turn them off, but you can break the lights. fnc_killLights = { private "_cfg"; _cfg = configFile >> "CfgVehicles" >> (typeOf _this) >> "Reflectors"; for "_i" from 0 to count(_cfg) - 1 do { _this setHit [getText((_cfg select _i) >> "selection"), 1]; }; }; myvehicle call fnc_killLights; Share this post Link to post Share on other sites
Norbak 10 Posted February 9, 2015 (edited) It doesn't work. Maybe because i don't understand that script Edited February 9, 2015 by kyopower Share this post Link to post Share on other sites
samatra 85 Posted February 9, 2015 It doesn't work. Maybe because i don't understand that script It does work. You need to define fnc_killLights function somewhere and then pass vehicle that you want break lights for as argument (myvehicle call fnc_killLights). Share this post Link to post Share on other sites
Schatten 268 Posted February 10, 2015 kyopower, save code while {true} do { _nearestVehicles = nearestObjects [player, ["Car", "Tank", "Air"], 1000]; { _reflectors = configFile >> "CfgVehicles" >> (typeOf _x) >> "Reflectors"; _reflectorsNumber = count _reflectors; for "_i" from 0 to (_reflectorsNumber - 1) do { _reflector = _reflectors select _i; _x setHit [getText (_reflector >> "selection"), 1]; }; } forEach _nearestVehicles; sleep 10; }; and launch from init.sqf using execVM "scriptName.sqf"; This script doesn't work properly. For example, it destroys only front lights of HMMWV CROWS (M2). Share this post Link to post Share on other sites
Norbak 10 Posted February 10, 2015 Yes. It works a bit. Some "Reflectors" doesn't destroy, such as airplanes and some choppers. But it's great. Thank you guys. Any idea about "positioning lights" of helis and planes? Share this post Link to post Share on other sites
Schatten 268 Posted February 10, 2015 Seems, this code works: while {true} do { _nearestVehicles = nearestObjects [player, ["Car", "Tank", "Air"], 1000]; { _vehicle = _x; if (({alive _x} count (crew _vehicle)) == 0) then { _unitGroup = createGroup civilian; _unit = _unitGroup createUnit ["TK_CIV_Takistani01_EP1", getPos _vehicle, [], 0, "NONE"]; _unit moveInDriver _vehicle; _unit action ["lightOff", _vehicle]; moveOut _unit; deleteVehicle _unit; deleteGroup _unitGroup; }; } forEach _nearestVehicles; sleep 10; }; Share this post Link to post Share on other sites
Norbak 10 Posted February 10, 2015 I think the previous script will do better for me. Thank you guys. Share this post Link to post Share on other sites
Schatten 268 Posted February 10, 2015 Any idea about "positioning lights" of helis and planes? SaMatra's solution destroys all reflectors, which are accessible through config. Unfortunately, some reflectors are unaccessible. So if you want turn off all reflectors you need to use my solution, but it's more resource-intensive. Share this post Link to post Share on other sites
Norbak 10 Posted February 10, 2015 Yes , lag. Your choice is nice but i think i may use to destroy everything hehe. Share this post Link to post Share on other sites