cheesus182 10 Posted March 20, 2013 Hey guys, Im looking for a way to force vehicle lights to always stay on. The vehicle is being controlled by an AI and as soon as an enemy enters the area it automatically switches off the lights. Currently im using waypoints with behaviour set to "safe" a game logic with: this action ["LightOn", Hunter2]; Im not sure if the above does anything at all but well its a try. If anyone knows how to force the lights to stay on, I would really apreciate it! Thanks! Share this post Link to post Share on other sites
eggbeast 3673 Posted March 20, 2013 setting safe and careless would also help - if they detect enemy they go aware/danger and combat and basically turn them off. Share this post Link to post Share on other sites
Moerderhoschi 107 Posted March 20, 2013 For AI units write in the initbox: if (isServer) then {0=[this]spawn{while{alive driver (_this select 0)}do{driver (_this select 0) action ["LightOn", (_this select 0)]}}}; Share this post Link to post Share on other sites
cheesus182 10 Posted March 21, 2013 For AI units write in the initbox: if (isServer) then {0=[this]spawn{while{alive driver (_this select 0)}do{driver (_this select 0) action ["LightOn", (_this select 0)]}}}; Yesss. Worked great! Thanks a bunch! Share this post Link to post Share on other sites
eggbeast 3673 Posted March 22, 2013 interesting approach does it override his combat mode wanting to switch them off? does that make him repeatedly switch his lights on and off? like an internal struggle? Share this post Link to post Share on other sites
fabio_chavez 103 Posted May 29, 2013 (edited) For AI units write in the initbox: if (isServer) then {0=[this]spawn{while{alive driver (_this select 0)}do{driver (_this select 0) action ["LightOn", (_this select 0)]}}}; this turns the vehicle lights into fast flickering stroboscopes somehow!!! ---------- Post added at 22:39 ---------- Previous post was at 22:07 ---------- looks like this :/ http://www.youtube.com/watch?v=sX0VP7G_IbU ---------- Post added at 22:54 ---------- Previous post was at 22:39 ---------- i guess the reason is the bots think its daylight, how can i convince them its not? EDIT: it seems that the strobing only occurs when there are more than one AI with this init line, like the can be only one vehicle lit at once and the light jumps from car to car really fast. The fewer cars are left with lights on the higher the strobe frequency. Edited May 29, 2013 by Fabio_Chavez Share this post Link to post Share on other sites
bakerman 247 Posted May 29, 2013 I always use this. null=[] spawn { while {true} do { player action ["lightOn", VEHICLE_NAME]; sleep 0.01};}; Share this post Link to post Share on other sites
fabio_chavez 103 Posted May 29, 2013 but it doesnt work at daytime? Share this post Link to post Share on other sites
kremator 1065 Posted May 29, 2013 How is this a user mission ? WRONG section - try config and scripting perhaps ? Share this post Link to post Share on other sites
bakerman 247 Posted May 29, 2013 ^ This. To be fair, that section is easily overlooked by newcomers (like myself) because it's listed outside of the normal Arma3 forum section. but it doesnt work at daytime? I just tested it. It works just fine in daylight? :confused: Share this post Link to post Share on other sites
fabio_chavez 103 Posted May 30, 2013 @bakerman, is that an init line? if i put this in the init box of an AI civilian offroad, it doesnt spawn with light on, neither at daytime nor at nighttime null=[] spawn { while {true} do { player action ["lightOn", VEHICLE_NAME]; sleep 0.01};}; ---------- Post added at 12:43 ---------- Previous post was at 12:02 ---------- @moederhoschi, your code doesnt seem to do what id like it, to do but what it deas instead is intressting nonetheless ;P 2 Share this post Link to post Share on other sites
bakerman 247 Posted May 30, 2013 You'll have to change "VEHICLE_NAME" to the name of the vehicle you wish to edit. You can put that line in the unit init or in a trigger, doesn't really matter. Share this post Link to post Share on other sites
pierremgi 4851 Posted August 12, 2016 All considerations above are outdated. There is no mean to have light on, on a AI driven vehicle with setPilotLight or SetCollisionLight or driver ... action ["lightOn",...] if the vehicle has a different behavior than CARELESS or SAFE. That means, if SAFE, the vehicle will switch off the headlights automatically, entering in AWARE or COMBAT behavior due to the Arma engine. Any loop is useless here! Share this post Link to post Share on other sites
Grenadier-Ghost 1 Posted September 5, 2016 I have devised a simple way to Have a beautiful lighthouse on the helicopter. No script and work in SP and MP. This system can be used for any Vehicle! I made a simple demo for download. Tell me what you think! link demo Share this post Link to post Share on other sites
ampersand38 344 Posted April 30, 2018 Just have an identical empty vehicle with Quote this setPilotLight true; this attachTo [_actualVehicle, [0,0,0]]; Share this post Link to post Share on other sites
AZCoder 921 Posted May 4, 2018 ["1", "onEachFrame", {player action ["lightOn",VEHICLE_NAME];}] call BIS_fnc_addStackedEventHandler; If you delete the vehicle at some point, you must remove the event handler to avoid spamming the log // "1" is whatever ID you give it above ["1", "onEachFrame"] call BIS_fnc_removeStackedEventHandler; I use this on helicopters. Share this post Link to post Share on other sites
aviaator6 0 Posted March 4 Since this thread was very helpful for me, I've taken the liberty to update the code provided by AZ to use mission event handlers instead. Init of the helicopter involved (adjust vehicle_variable_name as you would): 1 = addMissionEventHandler ["EachFrame", { player action ["lightOn", vehicle_variable_name]; }]; this addEventHandler ["Killed", { removeMissionEventHandler ["EachFrame", 1]; }]; This will result in affected AI-controlled helicopters keeping their spotlights on persistently. Most likely works with land vehicles' headlights as well, but I've tested it with Prairie Fire UH-1s. Share this post Link to post Share on other sites