Jump to content
Sign in to follow this  
bakerman

Helicopter LightOn Problem

Recommended Posts

I'm trying to make a helicopter (piloted by AI) keep its main light on while flying with the "lightOn" action, but I can't get it to work.

This is what I've tried so far.

Helicopter init

this setBehaviour "SAFE"; 
this setCombatMode "BLUE"; 
player action ["lightOn", this];

I've searched the forum and online for a solution to my problem to no avail.

According to what I've read online the above init should work. :confused:

How do I keep the AI from immediately turning the light off?

Share this post


Link to post
Share on other sites

this setBehaviour "careless"

Lights on only seems to turn on the collision lights, you would have to find the action to turn on the spotlight.

Edited by cobra4v320

Share this post


Link to post
Share on other sites

He has the correct action but AI turn it off, you can however turn it on quicker than they can turn it off.

name your chopper heli and then place this in the init or in a radio trigger on act

 null=[] spawn { while {true} do {  player action ["lightOn", heli];sleep 0.01};};

Share this post


Link to post
Share on other sites

@cobra4v320 The lightOn action is for the spotlight, works with an empty or player heli.

Thanks F2k Sel that works. :)

On further testing it seems that a 1ms delay is not fast enough to keep the AI from turning the light off completely, so the light is just pulsating on and off really fast. As long as this pulse is faster than the game FPS it is not visible, however the pulsating light is visible once I get over 100FPS by looking directly at the ground. Setting the delay to 0.001 fixes this for me, however it does seem like a massive waste of CPU cycles.

Is there no way to completely stop the AI from turning the light off?

Share this post


Link to post
Share on other sites

I found a way you can simulate the heli to be using the spotlight, it works well for me. It creates a light on and under the heli, on the ground. Try

light = "#lightpoint" createVehicleLocal position this; light setLightBrightness 0.5; light setLightAmbient[0.0, 0.0, 0.0]; light setLightColor[1.0, 1.0, 1.0]; light lightAttachObject [this, [0,0,-10]];light = "#lightpoint" createVehicleLocal position this; light setLightBrightness 0.5; light setLightAmbient[0.0, 0.0, 0.0]; light setLightColor[1.0, 1.0, 1.0]; light lightAttachObject [this, [0,0,-20]];

Share this post


Link to post
Share on other sites

I have already tested the lightpoint method. The problem with it is that the light from the point is not focused like the spotlight of a helicopter. It creates the effect of an invisible lightbulb dangling underneath the helicopter, which unlike the stock lights illuminates the helicopter more than the ground.

Share this post


Link to post
Share on other sites

Collision lights - you need to sync 2 modules to the helicopter or script mode/behaviour:

_unit action ["CollisionLightOn", (vehicle _unit)];
_unit action ["CollisionLightOff", (vehicle _unit)];

I can keep the collision lights on with: Modules: Object Modifier: Mode Object - careless/never fire - sync to helicopter

Edited by Mattar_Tharkari

Share this post


Link to post
Share on other sites

Look at this post:

http://forums.bistudio.com/showthread.php?149512-Placing-objects-not-feature-in-editor-(i-e-Osprey-wreck-fishing-boat-wreck-etc)&p=2331524&viewfull=1#post2331524

Use this in the configDump.sqf

[configFile >> "CfgActions"] call compile preprocessFileLineNumbers "dumpConfig.sqf""][configFile >> "CfgVehicles"] call compile preprocessFileLineNumbers "dumpConfig.sqf";

Share this post


Link to post
Share on other sites

So I have the collision lights on now... but the main light won't go on. Here's what I have in the helicopter initialization (Heli1)

this action ["CollisionLightOn", (vehicle Heli1)]; this action ["lightOn", (vehicle Heli1)];

I also have the module modify behavior set as previously suggested. Any help is appreciated.

Thanks!

Edited by Asclepius
Semi-solved

Share this post


Link to post
Share on other sites

Your answer was on the first page

 null=[] spawn { while {true} do {  player action ["lightOn", heli]; player action ["collisionlightOn", heli]; sleep 0.01};};  

Edited by cobra4v320

Share this post


Link to post
Share on other sites

I'm marking this as solved as the code above from F2k Sel turns on helicopter lights (thanks once again). This is not perfect but there doesn't seem to be any other way to do it.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×