Jump to content
Sign in to follow this  
Cougs

turning on/off search lights

Recommended Posts

I want Blufor to stumble into a trigger during a night mission and when they do I want a bunch of search lights manned by OPFOR to suddenly turn on and give Blufor the willies. :D

If I put down a manned search light it is on by default. If I put down an empty search light then it can't be manned by anyone and never turns on.

How can I

a) init a searchlight so it is off then turn it on with a trigger

or

b) init a searchlight so it is empty and off, then man it (and turn it on) via trigger

? Ta in advance.

Share this post


Link to post
Share on other sites

I recently did quite similar stuff and it turned out once again that all the BIS commands do not work as I would expect them to work.

Here is what I did to work around the strange behaviour:

I place an empty searchlight, call it eg. searchLight_1. Then I place an operator (rifleman) next to it call it searchLightGunner_1.

Next step is a trigger (multiple/blue/present on activation: detectedArea_1 = true; publicVariable "detectedArea_1";

On deactivation: detectedArea_1 = false; publicVariable "detected_Area_1";

place another trigger: multiple , Condition: isServer && detectedArea_1

On activation I call a script: nul = [searchLight_1, searchLightGunner_1, ["sl_1_1", "sl_1_2", "sl_1_3", "sl_1_4", "sl_1_5"], 5, 1] execVM "searchLight.sqf";

on deactivation: searchLightGunner_1 action ["getOut", searchLight_1]; searchLightGunner_1 stop true;

I wanted the searchlights to scan randomly between some markers (sl_1_1, etc.) If you want just one point to be illuminated you could just use one marker and leave out the random stuff; for example: nul = [searchLight_1, searchLightGunner_1, marker_1] execVM "searchLight.sqf";

------- searchLight.sqf -----

_light = _this select 0;

_lighter = _this select 1;

_marker = _this select 2;

// just for the case....

_lighter disableAI "TARGET";

_lighter disableAI "AUTOTARGET";

while {detectedArea_1} do {

_lighter action ["getInGunner",_light];

_light doWatch (getMarkerPos _marker);

};

// Maybe you need something like this here....

_lighter action ["getOut",_light];

_lighter stop true;

----

Something like that should work... maybe there is a more elegant way to get what you want, as I just took the stuff from a more complex issue....

Edited by IronEddie

Share this post


Link to post
Share on other sites

just set the damage to 1 and the man gets out of the light and to turn it back on just setdamage back to 0 in a trigger.

Share this post


Link to post
Share on other sites

Create 4 searchlights name them light1 thru light4

Create a trigger

Activation:blufor

Detected: by opfor

set to: repeatedly

Condition

this and (daytime > 20.00 || daytime < 4.5)

On activation

for "_i" from 1 to 4 do {_light = "light" + str(_i); player action["lighton",call compile format["%1",_light]];}

On deactivation

for "_i" from 1 to 4 do {_light = "light" + str(_i); player action["lightoff",call compile format["%1",_light]];}

Edited by cobra4v320

Share this post


Link to post
Share on other sites

Nice. I had an OPFOR MOVEINGUNNER staticsearchlight and that works but what you've got above is better -I'll try that out -thx!!

Share this post


Link to post
Share on other sites

Here is a searchlight script in sqs :o If anyone has it in sqf please let me know! :o

[Name, left value, right value] exec "light.sqs"

Light.sqs

_unit = _this select 0;
_left = _this select 1;
_right = _this select 2;
_dir = (getDir _Unit);
#Start
? !(alive _unit) : exit;
~0.5
_dir = _dir+1;
_unit setFormDir _dir;
?(_dir > _right) : goto "Next"
goto "Start"
#Next
? !(alive _unit) : exit;
~0.5
_dir = _dir -1;
_unit setFormDir _dir;
?(_dir < _left) : goto "Start";
goto "Next"

Edited by cobra4v320

Share this post


Link to post
Share on other sites

I use this as it's very simple.

Just point the unit to look in the main direction you want and set degrees to say 90 and it will look 45deg left and right of it's start direction.

// nul=[obj,deg] execVM "movesearch.sqf";

_unit = _this select 0;
_deg  = _this select 1;

_face = getdir _unit;
_gman = (gunner (vehicle _unit));

while {(alive _gman) &&  (alive _unit)} do
{
_gman setformdir _face+((random -(_deg)+(_deg/2)));

sleep (random 6)+2;
};

Share this post


Link to post
Share on other sites

Heya ~ I couldn't get this to work ~ and I couldn't spot the error. What was the more complex issue version? Something on the line : _light doWatch (getMarkerPos _marker); ??

Edited by Foxsch
extra info

Share this post


Link to post
Share on other sites
Just to bring this to attention, the simple guard script works great with search lights. Simple-Guard-Post-Script With this they look up and down aswell as scanning with optional range.
That works absolutely perfectly PlacidPaul ~ Thank you :cool:

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×